# Distributed reconfiguration

## Preprocessing

This process prepares files for distributed reconfigurations.

```
$ ./rofi-distribute-preprocessing --help
RoFI Distributed Preprocessing: Tool for preparing files for distrbuted reconfiguration.
Usage:
  rofi-distribute-preprocessing [OPTION...]

  -h, --help            Print help
  -i, --init arg        Initial config file
  -g, --goal arg        Goal config file
  -d, --directory arg   Directory for module's configs
```

Example:

```
./rofi-distribute-preprocessing -i ../data/init.in -g ../data/goal.in -d preprocessing
```

## Distributed reconfiguration

This tool computes a reconfiguration path in distributed environment.

You can choose the algorithm using the `--alg` option with two possible arguments:

* `full`: Full configuration knowledge.
* `partial`: Partial configuration knowledge -- fully distributed.

If the `full` algorithm is chosen, you can choose from different evaluation functions for A* algorithm - the evaluation functions are the same as in the reconfiguration section.

```
$ ./distribute/rofi-distribute --help
RoFI Distributed Reconfiguration: Tool for distributed computation of a reconfiguration path.
Usage:
  distribute/rofi-distribute [OPTION...]

  -h, --help           Print help
  -d, --directory arg  Directory for module's configs
  -a, --alg arg        Algorithm for reconfiguration:
                       full, partial
  -e, --eval arg       Evaluation function for full A* algorithm:
                       trivial, dMatrix, dCenter, dJoint, dAction
```

Examples:

```
mpiexec -np 4 ./distribute/rofi-distribute -d preprocessing --alg partial
```

```
mpiexec --hostfile host-file -np 20 ./distribute/rofi-distribute -d preprocessing -a full --eval dCenter
```
## Postprocessing

This tool processes given temporary timestamped file to a sequence of configurations.

```
$ ./rofi-ditribute-postprocessing --help
RoFI Distributed Postprocessing: Tool for processing given temporary timestamped file to a sequence of configurations.
Usage:
  rofi-distribute-postprocessing [OPTION...]
  -h, --help            Print help
  -t, --dictionary arg  Dictionary file
  -i, --input arg       File with timestamped actions
```

Example:

```
./rofi-distribute-postprocessing -t processing/dictionary -i file
```

## How to do distributed reconfiguration in one step

Use the script distribute.sh in distribute/scripts directory.

Options:

```
  -h, --help           Print help
  -i, --init arg       Initial config file
  -g, --goal arg       Goal config file
  -d, --directory arg  Directory for module's configs
  -f, --hostfile arg   Host's file for mpiexec
  -a, --alg arg        Algorithm for reconfiguration:
                       full, partial
  -e, --eval arg       Evaluation function for full A* algorithm:
                       trivial, dMatrix, dCenter, dJoint, dAction
```

Examples:

```
./distribute.sh -i ../data/init.in -g ../data/goal.in -d processing -a partial
```

```
./distribute.sh -i ../data/init.in -g ../data/goal.in -d processing -a full -e dMatrix -f host-file
```

