Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
Google.OrTools.ModelBuilder.LinearConstraint Class Reference

Wrapper around a linear constraint stored in the ModelBuilderHelper instance. More...

Detailed Description

Wrapper around a linear constraint stored in the ModelBuilderHelper instance.

Definition at line 27 of file ModelBuilderConstraint.cs.

Public Member Functions

 LinearConstraint (ModelBuilderHelper helper)
 LinearConstraint (ModelBuilderHelper helper, int index)
void AddTerm (Variable var, double coeff)
 Adds var * coeff to the constraint.
void SetVariableCoefficient (Variable var, double coeff)
 Sets the coefficient of var to coeff, adding or removing a term if needed.
void ClearTerms ()
 Clear all terms of the constraint.
LinearConstraint WithName (String name)
 Inline name setter.

Properties

int Index [get]
 Returns the index of the constraint in the model.
ModelBuilderHelper Helper [get]
 Returns the constraint builder.
double LowerBound [get, set]
 The lower bound of the constraint.
double UpperBound [get, set]
 The upper bound of the constraint.
String Name [get, set]
 The name of the variable given upon creation.

Constructor & Destructor Documentation

◆ LinearConstraint() [1/2]

Google.OrTools.ModelBuilder.LinearConstraint.LinearConstraint ( ModelBuilderHelper helper)
inline

Definition at line 29 of file ModelBuilderConstraint.cs.

◆ LinearConstraint() [2/2]

Google.OrTools.ModelBuilder.LinearConstraint.LinearConstraint ( ModelBuilderHelper helper,
int index )
inline

Definition at line 35 of file ModelBuilderConstraint.cs.

Member Function Documentation

◆ AddTerm()

void Google.OrTools.ModelBuilder.LinearConstraint.AddTerm ( Variable var,
double coeff )
inline

Adds var * coeff to the constraint.

Parameters
varthe variable of the term to add
coeffthe coefficient of the term to add

Definition at line 105 of file ModelBuilderConstraint.cs.

◆ ClearTerms()

void Google.OrTools.ModelBuilder.LinearConstraint.ClearTerms ( )
inline

Clear all terms of the constraint.

Definition at line 123 of file ModelBuilderConstraint.cs.

◆ SetVariableCoefficient()

void Google.OrTools.ModelBuilder.LinearConstraint.SetVariableCoefficient ( Variable var,
double coeff )
inline

Sets the coefficient of var to coeff, adding or removing a term if needed.

Parameters
varthe variable of the term to set
coeffthe coefficient of the term to set

Definition at line 115 of file ModelBuilderConstraint.cs.

◆ WithName()

LinearConstraint Google.OrTools.ModelBuilder.LinearConstraint.WithName ( String name)
inline

Inline name setter.

Parameters
namethe new name of the variable
Returns
this

Definition at line 133 of file ModelBuilderConstraint.cs.

Property Documentation

◆ Helper

ModelBuilderHelper Google.OrTools.ModelBuilder.LinearConstraint.Helper
get

Returns the constraint builder.

Definition at line 54 of file ModelBuilderConstraint.cs.

◆ Index

int Google.OrTools.ModelBuilder.LinearConstraint.Index
get

Returns the index of the constraint in the model.

Definition at line 44 of file ModelBuilderConstraint.cs.

◆ LowerBound

double Google.OrTools.ModelBuilder.LinearConstraint.LowerBound
getset

The lower bound of the constraint.

Definition at line 64 of file ModelBuilderConstraint.cs.

◆ Name

String Google.OrTools.ModelBuilder.LinearConstraint.Name
getset

The name of the variable given upon creation.

Definition at line 90 of file ModelBuilderConstraint.cs.

◆ UpperBound

double Google.OrTools.ModelBuilder.LinearConstraint.UpperBound
getset

The upper bound of the constraint.

Definition at line 77 of file ModelBuilderConstraint.cs.


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