Skip to content

SolvConstraints

Mike edited this page May 22, 2026 · 3 revisions

A class to set/manage Solver constraints. Example usage:

Problem.Constraints.Add "B14:G14", slvGreaterThanEqual, 0
Class Method/Property Description
SolvConstraints Add Adds a constraint to the current problem.
SolvConstraints AddBounded Adds a bounded constraint to the current problem. Equivalent to adding both cellRef>=lowBound and cellRef<=highBound
SolvConstraints AreSatisfied Returns True if all model Constraints are satisfied.
SolvConstraints CellCount Gets the number of cells in <=, =, and >= constraints that count against Solver's 101-cell limit. Decision-variable cells are exempt and not counted. int/bin/alldif constraints are also excluded (their cells are decision variables by definition).
SolvConstraints Change Changes a constraint of the current problem. If cellRef AND relation do not match an existing constraint, then use Relax and Add instead.
SolvConstraints ChangeBounded Changes a bounded constraint of the current problem.
SolvConstraints Count Gets the total number of constraints set for the current problem.
SolvConstraints ItemLHS Returns the LHS cell range of constraint i (1-based).
SolvConstraints ItemRelation Returns the relation (SlvRelation) of constraint i (1-based).
SolvConstraints ItemRHS Returns the RHS of constraint i (1-based) as an en-US formula string, e.g. "=0" or "=$A$1".
SolvConstraints Relax Deletes a constraint from the current problem.
SolvConstraints RelaxAll Deletes all constraints from the current problem.
SolvConstraints RelaxBounded Deletes a bounded constraint from the current problem.

Clone this wiki locally