[ library(eplex) | Reference Manual | Alphabetic Index ]

optimize(+Objective, -Cost, +Options)

EplexInstance:optimize(+Objective, -Cost, +Options)

Setup problem, solve and instantiate problem variables
Objective
Objective function: min(CostExpr) or max(CostExpr)
Options
List of solver options
Cost
Output: cost of returned solution

Description

Take the problem defined by all the constraints that have been set up so far, and solve it for the given objective function. If successful, instantiate all problem variables to their solution values.

This is a convenience predicate that combines solver setup, invocation and result retrieval. It is essentially defined as:

    optimize(OptExpr, Cost, Options) :-
        eplex_solver_setup(Objective, _, Options, [])
        eplex_solve(Cost),
        eplex_get(vars, VArr),
        eplex_get(typed_solution, SolutionVector),
        VArr = SolutionVector.                  % do the bindings
    

For the solver options, see eplex_solver_setup/4.

Examples

see optimize/2

See Also

$= / 2, $=< / 2, $>= / 2, $:: / 2, integers / 1, reals / 1, eplex_solver_setup / 4, eplex_solve / 1, eplex_get / 2, eplex_var_get / 3, optimize / 2