Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
com.google.ortools.linearsolver.MPConstraint Class Reference

Public Member Functions

synchronized void delete ()
 
String name ()
 
void setCoefficient (MPVariable var, double coeff)
 
double getCoefficient (MPVariable var)
 
double lb ()
 
double ub ()
 
void setLb (double lb)
 
void setUb (double ub)
 
void setBounds (double lb, double ub)
 
boolean isLazy ()
 
void setIsLazy (boolean laziness)
 
int index ()
 
double dualValue ()
 
MPSolver.BasisStatus basisStatus ()
 

Protected Member Functions

 MPConstraint (long cPtr, boolean cMemoryOwn)
 
void finalize ()
 

Static Protected Member Functions

static long getCPtr (MPConstraint obj)
 
static long swigRelease (MPConstraint obj)
 

Protected Attributes

transient boolean swigCMemOwn
 

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.

Constructor & Destructor Documentation

◆ MPConstraint()

com.google.ortools.linearsolver.MPConstraint.MPConstraint ( long cPtr,
boolean cMemoryOwn )
protected

Definition at line 22 of file MPConstraint.java.

Member Function Documentation

◆ basisStatus()

MPSolver.BasisStatus com.google.ortools.linearsolver.MPConstraint.basisStatus ( )

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.

See also
MPSolver.BasisStatus.

Definition at line 169 of file MPConstraint.java.

◆ delete()

synchronized void com.google.ortools.linearsolver.MPConstraint.delete ( )

Definition at line 48 of file MPConstraint.java.

◆ dualValue()

double com.google.ortools.linearsolver.MPConstraint.dualValue ( )

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

Definition at line 153 of file MPConstraint.java.

◆ finalize()

void com.google.ortools.linearsolver.MPConstraint.finalize ( )
protected

Definition at line 44 of file MPConstraint.java.

◆ getCoefficient()

double com.google.ortools.linearsolver.MPConstraint.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).

Definition at line 79 of file MPConstraint.java.

◆ getCPtr()

static long com.google.ortools.linearsolver.MPConstraint.getCPtr ( MPConstraint obj)
staticprotected

Definition at line 27 of file MPConstraint.java.

◆ index()

int com.google.ortools.linearsolver.MPConstraint.index ( )

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

Definition at line 145 of file MPConstraint.java.

◆ isLazy()

boolean com.google.ortools.linearsolver.MPConstraint.isLazy ( )

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

Definition at line 121 of file MPConstraint.java.

◆ lb()

double com.google.ortools.linearsolver.MPConstraint.lb ( )

Returns the lower bound.

Definition at line 86 of file MPConstraint.java.

◆ name()

String com.google.ortools.linearsolver.MPConstraint.name ( )

Returns the name of the constraint.

Definition at line 61 of file MPConstraint.java.

◆ setBounds()

void com.google.ortools.linearsolver.MPConstraint.setBounds ( double lb,
double ub )

Sets both the lower and upper bounds.

Definition at line 114 of file MPConstraint.java.

◆ setCoefficient()

void com.google.ortools.linearsolver.MPConstraint.setCoefficient ( MPVariable var,
double coeff )

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 71 of file MPConstraint.java.

◆ setIsLazy()

void com.google.ortools.linearsolver.MPConstraint.setIsLazy ( boolean laziness)

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 138 of file MPConstraint.java.

◆ setLb()

void com.google.ortools.linearsolver.MPConstraint.setLb ( double lb)

Sets the lower bound.

Definition at line 100 of file MPConstraint.java.

◆ setUb()

void com.google.ortools.linearsolver.MPConstraint.setUb ( double ub)

Sets the upper bound.

Definition at line 107 of file MPConstraint.java.

◆ swigRelease()

static long com.google.ortools.linearsolver.MPConstraint.swigRelease ( MPConstraint obj)
staticprotected

Definition at line 31 of file MPConstraint.java.

◆ ub()

double com.google.ortools.linearsolver.MPConstraint.ub ( )

Returns the upper bound.

Definition at line 93 of file MPConstraint.java.

Member Data Documentation

◆ swigCMemOwn

transient boolean com.google.ortools.linearsolver.MPConstraint.swigCMemOwn
protected

Definition at line 20 of file MPConstraint.java.


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