# HeuristicLab JSON Command Line Interface (HL JSON CLI)
The HeuristicLab JSON command line interface is a new type of application for HeuristicLab. The intended use is the execution of configurable tasks on a command line interface (CLI). We use JSON files to define such tasks.
---
## Supported tags and respective `Dockerfile` links
* `latest`
---
## Quick reference
* Maintained by: [HEAL](https://heal.heuristiclab.com)
* Download and Documentation of the standalone version: [HeuristicLab](https://dev.heuristiclab.com)
* Build on top of: [mono](https://hub.docker.com/_/mono)
---
## Usage
Step - 1: Prepare your [template](#create-a-template) and [configuration](#create-a-configuration) file.
Step - 2: Run the container with the following command:
```
docker run --rm -it -v :/files healresearch/heuristiclab-json-cli:latest /files/.json /files/.json /files/.json
```
* Replace `` with the path of the folder which contains the template (with the linked .hl-file) and configuration files.
* Replace `` with your template JSON file.
* Replace `` with your configuration JSON file.
* Replace `` with a desired output JSON file (this file is overwritten if it already exists).
This command starts the execution of the template file with the desired configuration, and saves the generated results into the `.json` file.
NOTE: The algorithm saves the results of finished runs continuously, this can cause the creation of output files while the algorithm is still running.
---
## Create a template
Step - 1 Checkout the [SVN branch](https://src.heuristiclab.com/svn/core/branches/3026_IntegrationIntoSymSpace) and build the solution files `HeuristicLab.ExtLibs.sln` and `HeuristicLab 3.3.sln`. After the build process, the binaries are located in the folder `bin`.
Step - 2: Start HeuristicLab with the application `Optimizer` and configure the desired problem/algorithm combination.
Step - 3: Start the algorithm and let it run until it generated all types of results. The results are located in the tab `Results`, typically it is sufficient to let the algorithm finish one generation/iteration.
Step - 4: Navigate to: _File_ -> _Export_ -> _Json-Template_ to open the JSON template export dialog.
Step - 5: The first tab `Parameters` lists every configurable parameter. Each selected parameter is saved in the template and is dynamically changeable with a configuration later on. All other (unselected) parameters are fixed and cannot be modified with a configuration file.
Step - 6: The second tab `Results` lists all possible results. Select all types of results which are required for the output.
Step - 7: Set a name for the template and save it to the desired destination. This generates two files (e.g. `Template.json` and `Template.hl`), both of them represent the template. It is possible to move those files into different folders, but you need to adapt the property `HLFileLocation` in the JSON file.
---
## Create a configuration
Step - 1: Create a new JSON file, e.g. `Config.json`.
Step - 2: The content of `Config.json` is an array of JSON objects. Copy all desired `Parameters` of the template JSON file into your configuration file and adapt the values to fit your needs. The following code shows an exemplary content of `Config.json`:
```json
[
{
"Value": 250,
"Name": "PopulationSize",
"Description": "The size of the population of solutions.",
"Path": "Genetic Algorithm (GA).PopulationSize"
},
{
"Value": 0.35,
"Name": "MutationProbability",
"Description": "The probability that the mutation operator is applied on a solution.",
"Path": "Genetic Algorithm (GA).MutationProbability"
}
]
```
This example shows the dynamic change of the properties `PopulationSize` to 250 and `MutationProbability` to 0.35.
NOTE - A: Every parameter needs to be part of the list `Parameters` of the template JSON file.
NOTE - B: The following properties cannot get configured in the configuration file and are ignored within the instantiation process:
* `Minimum`
* `Maximum`
* `ConcreteRestrictedItems`
* `ColumnsResizable`
* `RowsResizable`
* `Resizable`
NOTE - C: The property `Path` is necessary to be able to assign it with the associated object in HeuristicLab (works like an unique identifier). Everything else should be optional.
---
## License
HeuristicLab is licensed under the [GNU GPL v3](http://www.gnu.org/licenses/gpl-3.0.html). More information can be found [here](https://dev.heuristiclab.com/trac.fcgi/wiki/Download#License).
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.