Java Reference

Java Reference

MPConstraint

Detailed Description

The class for constraints of a Mathematical Programming (MP) model.



A constraint is represented as a linear equation or inequality.

Definition at line 18 of file MPConstraint.java.

Public Member Functions

synchronized void delete ()
 
String name ()
 Returns the name of the constraint. More...
 
void setCoefficient (MPVariable var, double coeff)
 Sets the coefficient of the variable on the constraint. More...
 
double getCoefficient (MPVariable var)
 Gets the coefficient of a given variable on the constraint (which is 0 if
the variable does not appear in the constraint). More...
 
double lb ()
 Returns the lower bound. More...
 
double ub ()
 Returns the upper bound. More...
 
void setLb (double lb)
 Sets the lower bound. More...
 
void setUb (double ub)
 Sets the upper bound. More...
 
void setBounds (double lb, double ub)
 Sets both the lower and upper bounds. More...
 
boolean isLazy ()
 Advanced usage: returns true if the constraint is "lazy" (see below). More...
 
void setIsLazy (boolean laziness)
 Advanced usage: sets the constraint "laziness". More...
 
int index ()
 Returns the index of the constraint in the MPSolver::constraints_. More...
 
double dualValue ()
 Advanced usage: returns the dual value of the constraint in the current
solution (only available for continuous problems). More...
 
MPSolver.BasisStatus basisStatus ()
 Advanced usage: returns the basis status of the constraint. More...
 

Protected Member Functions

 MPConstraint (long cPtr, boolean cMemoryOwn)
 

Constructor & Destructor Documentation

◆ MPConstraint()

MPConstraint ( long  cPtr,
boolean  cMemoryOwn 
)
inlineprotected

Definition at line 22 of file MPConstraint.java.

Member Function Documentation

◆ basisStatus()

MPSolver.BasisStatus basisStatus ( )
inline

Advanced usage: returns the basis status of the constraint.



It is only available for continuous problems).

Note that if a constraint "linear_expression in [lb, ub]" is transformed
into "linear_expression + slack = 0" with slack in [-ub, -lb], then this
status is the same as the status of the slack variable with AT_UPPER_BOUND
and AT_LOWER_BOUND swapped.

Definition at line 155 of file MPConstraint.java.

◆ delete()

synchronized void delete ( )
inline

Definition at line 36 of file MPConstraint.java.

◆ dualValue()

double dualValue ( )
inline

Advanced usage: returns the dual value of the constraint in the current
solution (only available for continuous problems).

Definition at line 141 of file MPConstraint.java.

◆ getCoefficient()

double getCoefficient ( MPVariable  var)
inline

Gets the coefficient of a given variable on the constraint (which is 0 if
the variable does not appear in the constraint).

Definition at line 67 of file MPConstraint.java.

◆ index()

int index ( )
inline

Returns the index of the constraint in the MPSolver::constraints_.

Definition at line 133 of file MPConstraint.java.

◆ isLazy()

boolean isLazy ( )
inline

Advanced usage: returns true if the constraint is "lazy" (see below).

Definition at line 109 of file MPConstraint.java.

◆ lb()

double lb ( )
inline

Returns the lower bound.

Definition at line 74 of file MPConstraint.java.

◆ name()

String name ( )
inline

Returns the name of the constraint.

Definition at line 49 of file MPConstraint.java.

◆ setBounds()

void setBounds ( double  lb,
double  ub 
)
inline

Sets both the lower and upper bounds.

Definition at line 102 of file MPConstraint.java.

◆ setCoefficient()

void setCoefficient ( MPVariable  var,
double  coeff 
)
inline

Sets the coefficient of the variable on the constraint.



If the variable does not belong to the solver, the function just returns,
or crashes in non-opt mode.

Definition at line 59 of file MPConstraint.java.

◆ setIsLazy()

void setIsLazy ( boolean  laziness)
inline

Advanced usage: sets the constraint "laziness".



This is only supported for SCIP and has no effect on other
solvers.


When laziness is true, the constraint is only considered by the Linear
Programming solver if its current solution violates the constraint. In this
case, the constraint is definitively added to the problem. This may be
useful in some MIP problems, and may have a dramatic impact on performance.

For more info see: http://tinyurl.com/lazy-constraints.

Definition at line 126 of file MPConstraint.java.

◆ setLb()

void setLb ( double  lb)
inline

Sets the lower bound.

Definition at line 88 of file MPConstraint.java.

◆ setUb()

void setUb ( double  ub)
inline

Sets the upper bound.

Definition at line 95 of file MPConstraint.java.

◆ ub()

double ub ( )
inline

Returns the upper bound.

Definition at line 81 of file MPConstraint.java.


The documentation for this class was generated from the following file: