Skip to main content

Function: solve

solve(model, params?, log?): Promise<SolveResult>

Solve the provided model and return the result.

Parameters

NameTypeDefault valueDescription
modelModelundefinedThe model to solve.
params?ParametersundefinedThe parameters to use for solving.
logundefined | WritableStreamprocess.stdoutThe stream to which the solver output (log, trace and warnings) should be redirected. When undefined then the output is ignored.

Returns

Promise<SolveResult>

The result of the solve.

Remarks

This function is asynchronous and returns a promise. Use e.g. await to wait for the result. When an error occurs then the returned promise is rejected and standard Error object is returned.

To communicate asynchronously with the solver, e.g. process every solution found, use class Solver instead.

For an example of using this function see Model.