Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/JsonInterface_DockerHub_Readme.md @ 18183

Last change on this file since 18183 was 18077, checked in by dpiringe, 3 years ago

#3026

  • added the dockerhub readme file
  • fixed a bug which caused changed values (changed by events) to be overwritten with wrong values
File size: 7.3 KB
Line 
1# HeuristicLab JSON Command Line Interface (HL JSON CLI)
2The 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.
3
4---
5## Supported tags and respective `Dockerfile` links
6* `latest`
7
8---
9## Quick reference
10* Maintained by: [HEAL](https://heal.heuristiclab.com)
11* Download and Documentation of the standalone version: [HeuristicLab](https://dev.heuristiclab.com)
12* Build on top of: [mono](https://hub.docker.com/_/mono)
13
14<!--## What is HeuristicLab?-->
15
16---
17## Usage
18<b>Step - 1:</b> Prepare your [template](#create-a-template) and [configuration](#create-a-configuration) file.
19
20<b>Step - 2:</b> Run the container with the following command:
21```
22docker run --rm -it -v <path-to-template-and-config-files>:/files healresearch/heuristiclab-json-cli:latest /files/<template>.json /files/<config>.json /files/<out>.json
23```
24* Replace `<path-to-template-and-config-files>` with the path of the folder which contains the template (with the linked .hl-file) and configuration files.
25* Replace `<template>` with your template JSON file.
26* Replace `<config>` with your configuration JSON file.
27* Replace `<out>` with a desired output JSON file (this file is overwritten if it already exists).
28
29This command starts the execution of the template file with the desired configuration, and saves the generated results into the `<out>.json` file.
30
31<b>NOTE:</b> The algorithm saves the results of finished runs continuously, this can cause the creation of output files while the algorithm is still running.
32
33---
34## <a name="create-a-template"></a>Create a template
35<b>Step - 1</b> 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`.
36
37<b>Step - 2:</b> Start HeuristicLab with the application `Optimizer` and configure the desired problem/algorithm combination.
38
39<b>Step - 3:</b> 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.
40
41<b>Step - 4:</b> Navigate to: _File_ -> _Export_ -> _Json-Template_ to open the JSON template export dialog.
42
43<b>Step - 5:</b> 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.
44
45<b>Step - 6:</b> The second tab `Results` lists all possible results. Select all types of results which are required for the output.
46
47<b>Step - 7:</b> 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.
48<!--
491. start HeuristicLab and configure your desired problem with the application `Optimizer`
502. start the algorithm and let it run until it generated all types of results (you can see the results in the tab “Results”, typically it is sufficient to let the algorithm finish one generation/iteration)
513. go to: File -> Export -> Json-Template (this opens a new dialog window)
525. select every parameter you wish to configure dynamically with the CLI (everything else is a fixed parameter and cannot be changed with a configuration file)
536. select every result type you need (tab `Results` in the `Export Json` window)
547. set a name for the template
558. click export and save it to your desired destination
569. it generates two files (for example: `Template.json` and `Template.hl`), both of them represent the template; you can move those files, but you need to adapt the property `HLFileLocation` contained in the JSON file
57-->
58
59---
60## <a name="create-a-configuration"></a>Create a configuration
61<b>Step - 1:</b> Create a new JSON file, e.g. `Config.json`.
62
63<b>Step - 2:</b> 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`:
64```json
65[
66  {
67    "Value": 250,
68    "Name": "PopulationSize",
69    "Description": "The size of the population of solutions.",
70    "Path": "Genetic Algorithm (GA).PopulationSize"
71  },
72  {
73    "Value": 0.35,
74    "Name": "MutationProbability",
75    "Description": "The probability that the mutation operator is applied on a solution.",
76    "Path": "Genetic Algorithm (GA).MutationProbability"
77  }
78]
79```
80This example shows the dynamic change of the properties `PopulationSize` to 250 and `MutationProbability` to 0.35.
81
82<b>NOTE - A:</b> Every parameter needs to be part of the list `Parameters` of the template JSON file.
83
84<b>NOTE - B:</b> The following properties cannot get configured in the configuration file and are ignored within the instantiation process:
85* `Minimum`
86* `Maximum`
87* `ConcreteRestrictedItems`
88* `ColumnsResizable`
89* `RowsResizable`
90* `Resizable`
91
92<b>NOTE - C:</b> 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.
93
94<!--
951. create an empty JSON file
962. the content of the configuration is an array of objects; in the following example, the population size of the algorithm is set to 250 and the mutation probability is set to 0.35:
97```json
98[
99  {
100    "Value": 250,
101    "Name": "PopulationSize",
102    "Description": "The size of the population of solutions.",
103    "Path": "Genetic Algorithm (GA).PopulationSize"
104  },
105  {
106    "Value": 0.35,
107    "Name": "MutationProbability",
108    "Description": "The probability that the mutation operator is applied on a solution.",
109    "Path": "Genetic Algorithm (GA).MutationProbability"
110  }
111]
112```
1133. copy all desired `Parameter` objects of the template JSON file into your configuration file (every template file consists of three parts: metadata, parameters and results)
1144. adapt the values as you wish
1155. every parameter object needs the property `Path` (the path describes the targeted object inside the object-graph in HeuristicLab and works like a unique identifier), everything else should be optional
116-->
117---
118## License
119HeuristicLab 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).
120
121As 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).
122
123As 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.
124<!--As usually with docker containers, a container contains other software which may be under other licenses.-->
Note: See TracBrowser for help on using the repository browser.