Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
ortools.linear_solver.pywraplp.Constraint Class Reference

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 763 of file pywraplp.py.

Inheritance diagram for ortools.linear_solver.pywraplp.Constraint:

Public Member Functions

 __init__ (self, *args, **kwargs)
 name (self)
 Clear (self)
 SetCoefficient (self, var, coeff)
 GetCoefficient (self, var)
 lb (self)
 ub (self)
 SetBounds (self, lb, ub)
 set_is_lazy (self, laziness)
 index (self)
 dual_value (self)
 basis_status (self)
 Lb (self)
 Ub (self)
 SetLb (self, x)
 SetUb (self, x)
 DualValue (self)

Properties

 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

Constructor & Destructor Documentation

◆ __init__()

ortools.linear_solver.pywraplp.Constraint.__init__ ( self,
* args,
** kwargs )

Definition at line 772 of file pywraplp.py.

Member Function Documentation

◆ basis_status()

ortools.linear_solver.pywraplp.Constraint.basis_status ( self)
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 839 of file pywraplp.py.

◆ Clear()

ortools.linear_solver.pywraplp.Constraint.Clear ( self)
Clears all variables and coefficients. Does not clear the bounds.

Definition at line 780 of file pywraplp.py.

◆ dual_value()

ortools.linear_solver.pywraplp.Constraint.dual_value ( self)
Advanced usage: returns the dual value of the constraint in the current
solution (only available for continuous problems).

Definition at line 832 of file pywraplp.py.

◆ DualValue()

ortools.linear_solver.pywraplp.Constraint.DualValue ( self)

Definition at line 866 of file pywraplp.py.

◆ GetCoefficient()

ortools.linear_solver.pywraplp.Constraint.GetCoefficient ( self,
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 793 of file pywraplp.py.

◆ index()

ortools.linear_solver.pywraplp.Constraint.index ( self)
Returns the index of the constraint in the MPSolver::constraints_.

Definition at line 828 of file pywraplp.py.

◆ Lb()

ortools.linear_solver.pywraplp.Constraint.Lb ( self)

Definition at line 854 of file pywraplp.py.

◆ lb()

ortools.linear_solver.pywraplp.Constraint.lb ( self)
Returns the lower bound.

Definition at line 800 of file pywraplp.py.

◆ name()

ortools.linear_solver.pywraplp.Constraint.name ( self)
Returns the name of the constraint.

Definition at line 776 of file pywraplp.py.

◆ set_is_lazy()

ortools.linear_solver.pywraplp.Constraint.set_is_lazy ( self,
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 812 of file pywraplp.py.

◆ SetBounds()

ortools.linear_solver.pywraplp.Constraint.SetBounds ( self,
lb,
ub )
Sets both the lower and upper bounds.

Definition at line 808 of file pywraplp.py.

◆ SetCoefficient()

ortools.linear_solver.pywraplp.Constraint.SetCoefficient ( self,
var,
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 784 of file pywraplp.py.

◆ SetLb()

ortools.linear_solver.pywraplp.Constraint.SetLb ( self,
x )

Definition at line 860 of file pywraplp.py.

◆ SetUb()

ortools.linear_solver.pywraplp.Constraint.SetUb ( self,
x )

Definition at line 863 of file pywraplp.py.

◆ Ub()

ortools.linear_solver.pywraplp.Constraint.Ub ( self)

Definition at line 857 of file pywraplp.py.

◆ ub()

ortools.linear_solver.pywraplp.Constraint.ub ( self)
Returns the upper bound.

Definition at line 804 of file pywraplp.py.

Property Documentation

◆ thisown

ortools.linear_solver.pywraplp.Constraint.thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
static

Definition at line 770 of file pywraplp.py.


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