Previous Up Next

10.6  Multiple Solver States

This library allows multiple solver states to be maintained in the same program. Each solver state represents an eplex problem. For the external solver, each solver state is completely independent. For ECLiPSe, the solver states may share variables in the constraints or objective functions, but the constraints posted to the problem and to the cutpools are specific to each solver state. The eplex library maintains separate solution values for each solver state, and it is up to the user to reconcile these solution values if they are different.

When two eplex variables are unified, then the library ensures that the now single variable maintains the eplex values from both variables. The one exception is when two variables from the same solver state is unified.In this case, eplex will merge its representations of the two columns into one: the bounds of the columns are merged (and failure will occur if the merged bound is empty); all the unified columns are constrained to integers if one of them was constrained to integer previously, and an equality constraint between the two variables is sent to the solver state, but the user can only obtain one eplex value from the unified variable, even though in the external solver, the variable is still represented as two variables (columns in the matrix).

It is possible to turn off this automatic sending of the equality constraints by specifying ‘no’ for the option post_equality_when_unified (in solver setup, or via eplex_set/2). The reason is that some solvers automatically perform unification when they know that two variables are the same. For example, for the constraint X $= Y + Z, if Y becomes 0, then X and Z may be unified by the solver maintaining the constraint. If the same constraint was also posted to the eplex solver state, then there is no need to send the redundant constraint. However, if the external solver state did not have the constraint, then it can become inconsistent with that of ECLiPSe if the equality constraint is not sent. Therefore, only turn off sending of equality constraints if you are certain you know what you are doing.

The merging of the bounds may trigger the solver if the bounds trigger condition was specified. Note however that the deviating_bounds trigger condition is not tested for, because there is no longer a valid solution value for the merged columns.

Previous Up Next