Function: model2js
▸ model2js(model
, params?
, log?
): Promise
<string
| undefined
>
Converts a model into equivalent JavaScript code. The result is human readable.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
model | Model | undefined | The model to be exported. |
params? | Parameters | undefined | The parameters to pass to the solver (they are mostly unused). |
log | undefined | WritableStream | process.stdout | The stream to which the solver output should be redirected. |
Returns
Promise
<string
| undefined
>
A string containing the model in JavaScript format.
Remarks
This function is experimental and the result is not guaranteed to be valid.
The result of this function can be stored in a file and executed using Node.js. It is meant as a way to export a model to a format that is executable, human readable, editable and independent of other libraries.
In case of an error this function returns a rejected promise.