Converts a model into a text format similar to IBM CP Optimizer file format. The result is human readable and can be stored in a file.
|The model to be exported.|
|The parameters to pass to the solver (they are mostly unused).|
|The stream to which the solver output should be redirected.|
A string containing the model in text format.
Unlike JSON format, there is no way to convert the text format back into an instance of Model.
The result so similar to the file format used by IBM CP Optimizer that, under some circumstances, the result can be used as an input file for CP Optimizer. However there are some differences between OptalCP and CP Optimizer that makes it impossible to make sure the result is always valid for CP Optimizer. Known issues are:
- OptalCP supports optional integer expressions, while CP Optimizer does not. If the model contains optional integer expressions, the result will not be valid for CP Optimizer or it will be badly interpreted. For example, in order to get valid CP Optimizer file, don't use function start, use startOr instead.
- For the same reason, prefer precedence constraints such as
- Negative heights in cumulative expressions (e.g. in stepAtStart) are not supported by CP Optimizer.
The function is using OptalCP solver for the conversion, therefore it is
asynchronous. To wait the result, use
In case of an error this function returns a rejected promise.