Setup the external solver as a simplex demon. A simplex demon collects linear constraints and re-solves the problem whenever the triggering conditions in TriggerModes are met.
Declaratively, this can be seen as a compound constraint representing all the individual linear constraints that have been set so far and are going to be set up later. Operationally, the delayed constraints are collected and an external solver is set up (as with lp_setup/4). Then the problem is solved once initially (if initial_solve option is yes) and a delayed goal lp_demon is set up which will re-trigger the solver when certain conditions are met.
CostExpr is a linear cost expression (or quadratic, if supported by the external solver).
Handle refers to the created solver state (as in lp_setup/4 or lp_read/3 described below). It can be used to access and modify the state of the solver, retrieve solution information etc.
Unlike with lp_solve/2, Cost will not be instantiated to a solution's cost, but only be bounded by it (if the solution is optimal): For a minimization problem, each solution's cost becomes a lower bound, for maximization an upper bound on Cost. This technique allows for repeated re-solving with reduced bounds or added constraints.
ListOfOptions is a list of solver options as described for lp_setup/4. In addition, the following extra options are also available:
The default value for Pool is pool(eplex) (for backward compatibility).
Priority is the scheduling priority with which the solver gets woken up. This priority determines whether the solver is run before or after other constraints. It is recommended to choose a priority that lies below the priority of more efficient propagation constraints, e.g. 5. 0 can also be specified, in which case the default priority for the predicate (5 unless changed) is used.
TriggerModes specifies under which conditions the solver demon will be re-triggered. It can be a list of the following specifiers
If several trigger conditions are specified, then any of them will trigger the solver.
When a solver demon runs frequently on relatively small problems, it can be important for efficiency to switch off the presolve option to reduce overheads.
The solver demon calls lp_solve/2 when it wakes up. See the description of lp_solve/2 for the handling of exceptions.
Note: Some external solvers need to write temporary files when they are solving a problem. These are written to the temporary directory specified in ECLiPSe's tmp_dir setting (get_flag/2, set_flag/2).
Some common invocations patterns for this predicate are the following.
The first triggers the solver only on instantiation of variables to
values that don't fit with the simplex solution:
lp_demon_setup(min(Expr), C, [], 5, [deviating_inst], H)
The next one is more eager and triggers on significant bound changes
or whenever new constraints arrive:
lp_demon_setup(max(Expr), C, [], 5, [new_constraint,deviating_bounds], H)