Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
Google.OrTools.Sat.CpModel Class Reference

Wrapper class around the cp_model proto. More...

Public Member Functions

 CpModel ()
 
IntVar NewIntVar (long lb, long ub, string name)
 Integer variables and constraints.
 
IntVar NewIntVarFromDomain (Domain domain, string name)
 Creates an integer variable with given domain.
 
IntVar NewConstant (long value)
 Creates a constant variable.
 
BoolVar NewBoolVar (string name)
 Creates a Boolean variable with given domain.
 
ILiteral TrueLiteral ()
 Returns a constant true literal.
 
ILiteral FalseLiteral ()
 Returns a constant false literal.
 
Constraint AddLinearConstraint (LinearExpr expr, long lb, long ub)
 Adds lb ≤ expr ≤ ub.
 
Constraint AddLinearExpressionInDomain (LinearExpr expr, Domain domain)
 Adds expr ∈ domain.
 
Constraint Add (BoundedLinearExpression lin)
 Adds a linear constraint to the model.
 
Constraint AddAllDifferent (IEnumerable< LinearExpr > exprs)
 Adds the constraint AllDifferent(exprs).
 
Constraint AddElement (IntVar index, IEnumerable< IntVar > vars, IntVar target)
 Adds the element constraint: variables[index] == target.
 
Constraint AddElement (IntVar index, IEnumerable< long > values, IntVar target)
 Adds the element constraint: values[index] == target.
 
Constraint AddElement (IntVar index, IEnumerable< int > values, IntVar target)
 Adds the element constraint: values[index] == target.
 
CircuitConstraint AddCircuit ()
 Adds and returns an empty circuit constraint.
 
MultipleCircuitConstraint AddMultipleCircuit ()
 Adds and returns an empty multiple circuit constraint.
 
TableConstraint AddAllowedAssignments (IEnumerable< IntVar > vars)
 Adds AllowedAssignments(variables).
 
TableConstraint AddForbiddenAssignments (IEnumerable< IntVar > vars)
 Adds ForbiddenAssignments(variables).
 
AutomatonConstraint AddAutomaton (IEnumerable< IntVar > vars, long starting_state, IEnumerable< long > final_states)
 Adds an automaton constraint.
 
Constraint AddInverse (IEnumerable< IntVar > direct, IEnumerable< IntVar > reverse)
 Adds Inverse(variables, inverseVariables).
 
ReservoirConstraint AddReservoirConstraint (long minLevel, long maxLevel)
 Adds a reservoir constraint with optional refill/emptying events.
 
void AddMapDomain (IntVar var, IEnumerable< IntVar > bool_vars, long offset=0)
 Adds var == i + offset ⇔ bool_vars[i] == true for all i.
 
Constraint AddImplication (ILiteral a, ILiteral b)
 Adds a ⇒ b.
 
Constraint AddBoolOr (IEnumerable< ILiteral > literals)
 Adds Or(literals) == true.
 
Constraint AddAtLeastOne (IEnumerable< ILiteral > literals)
 Same as AddBoolOr: ∑(literals) ≥ 1.
 
Constraint AddAtMostOne (IEnumerable< ILiteral > literals)
 Adds AtMostOne(literals): ∑(literals) ≤ 1.
 
Constraint AddExactlyOne (IEnumerable< ILiteral > literals)
 Adds ExactlyOne(literals): ∑(literals) == 1.
 
Constraint AddBoolAnd (IEnumerable< ILiteral > literals)
 Adds And(literals) == true.
 
Constraint AddBoolXor (IEnumerable< ILiteral > literals)
 Adds XOr(literals) == true.
 
Constraint AddMinEquality (LinearExpr target, IEnumerable< LinearExpr > exprs)
 Adds target == Min(exprs).
 
Constraint AddMaxEquality (LinearExpr target, IEnumerable< LinearExpr > exprs)
 Adds target == Max(exprs).
 
Constraint AddDivisionEquality< T, N, D > (T target, N num, D denom)
 Adds target == num / denom (integer division rounded towards 0).
 
Constraint AddAbsEquality (LinearExpr target, LinearExpr expr)
 Adds target == abs(expr).
 
Constraint AddModuloEquality< T, V, M > (T target, V v, M m)
 Adds target == v % m.
 
Constraint AddMultiplicationEquality (LinearExpr target, IEnumerable< LinearExpr > exprs)
 Adds target == ∏(exprs).
 
Constraint AddMultiplicationEquality (LinearExpr target, LinearExpr left, LinearExpr right)
 Adds target == left * right.
 
IntervalVar NewIntervalVar< S, D, E > (S start, D size, E end, string name)
 Scheduling support.
 
IntervalVar NewFixedSizeIntervalVar< S > (S start, long size, string name)
 Creates an interval variable from an affine expression start, and a fixed size.
 
IntervalVar NewOptionalIntervalVar< S, D, E > (S start, D size, E end, ILiteral is_present, string name)
 Creates an optional interval variable from three affine expressions start, size, and end, and a literal is_present.
 
IntervalVar NewOptionalFixedSizeIntervalVar< S > (S start, long size, ILiteral is_present, string name)
 Creates an optional interval variable from an affine expression start, a fixed size, and a literal is_present.
 
Constraint AddNoOverlap (IEnumerable< IntervalVar > intervals)
 
NoOverlap2dConstraint AddNoOverlap2D ()
 Adds NoOverlap2D().
 
CumulativeConstraint AddCumulative< C > (C capacity)
 Adds Cumulative(capacity).
 
void Minimize (LinearExpr obj)
 Objective.
 
void Maximize (LinearExpr obj)
 Adds a maximization objective of a linear expression.
 
void AddDecisionStrategy (IEnumerable< IntVar > vars, DecisionStrategyProto.Types.VariableSelectionStrategy var_str, DecisionStrategyProto.Types.DomainReductionStrategy dom_str)
 Search Decision.
 
void AddHint (IntVar var, long value)
 Adds variable hinting to the model.
 
void AddHint (ILiteral lit, bool value)
 Adds variable hinting to the model.
 
void ClearHints ()
 Clears all hinting from the model.
 
void AddAssumption (ILiteral lit)
 Adds a literal to the model as assumption.
 
void AddAssumptions (IEnumerable< ILiteral > literals)
 Adds multiple literals to the model as assumptions.
 
void ClearAssumptions ()
 Clears all assumptions from the model.
 
String ModelStats ()
 Returns some statistics on model as a string.
 
Boolean ExportToFile (String file)
 Write the model as a protocol buffer to file.
 
String Validate ()
 Returns a non empty string explaining the issue if the model is invalid.
 

Properties

CpModelProto Model [get]
 Getters.
 

Detailed Description

Wrapper class around the cp_model proto.

Definition at line 23 of file CpModel.cs.

Constructor & Destructor Documentation

◆ CpModel()

Google.OrTools.Sat.CpModel.CpModel ( )
inline

Definition at line 25 of file CpModel.cs.

Member Function Documentation

◆ Add()

Constraint Google.OrTools.Sat.CpModel.Add ( BoundedLinearExpression lin)
inline

Adds a linear constraint to the model.

Definition at line 192 of file CpModel.cs.

◆ AddAbsEquality()

Constraint Google.OrTools.Sat.CpModel.AddAbsEquality ( LinearExpr target,
LinearExpr expr )
inline

Adds target == abs(expr).

Definition at line 734 of file CpModel.cs.

◆ AddAllDifferent()

Constraint Google.OrTools.Sat.CpModel.AddAllDifferent ( IEnumerable< LinearExpr > exprs)
inline

Adds the constraint AllDifferent(exprs).

Definition at line 220 of file CpModel.cs.

◆ AddAllowedAssignments()

TableConstraint Google.OrTools.Sat.CpModel.AddAllowedAssignments ( IEnumerable< IntVar > vars)
inline

Adds AllowedAssignments(variables).

An AllowedAssignments constraint is a constraint on an array of variables that forces, when all variables are fixed to a single value, that the corresponding list of values is equal to one of the tuples of the tupleList.

Parameters
varsa list of variables
Returns
an instance of the TableConstraint class without any tuples. Tuples can be added directly to the table constraint

Definition at line 347 of file CpModel.cs.

◆ AddAssumption()

void Google.OrTools.Sat.CpModel.AddAssumption ( ILiteral lit)
inline

Adds a literal to the model as assumption.

Definition at line 1074 of file CpModel.cs.

◆ AddAssumptions()

void Google.OrTools.Sat.CpModel.AddAssumptions ( IEnumerable< ILiteral > literals)
inline

Adds multiple literals to the model as assumptions.

Definition at line 1080 of file CpModel.cs.

◆ AddAtLeastOne()

Constraint Google.OrTools.Sat.CpModel.AddAtLeastOne ( IEnumerable< ILiteral > literals)
inline

Same as AddBoolOr: ∑(literals) ≥ 1.

Definition at line 590 of file CpModel.cs.

◆ AddAtMostOne()

Constraint Google.OrTools.Sat.CpModel.AddAtMostOne ( IEnumerable< ILiteral > literals)
inline

Adds AtMostOne(literals): ∑(literals) ≤ 1.

Definition at line 600 of file CpModel.cs.

◆ AddAutomaton()

AutomatonConstraint Google.OrTools.Sat.CpModel.AddAutomaton ( IEnumerable< IntVar > vars,
long starting_state,
IEnumerable< long > final_states )
inline

Adds an automaton constraint.

An automaton constraint takes a list of variables (of size n), an initial state, a set of final states, and a set of transitions that will be added incrementally directly on the returned AutomatonConstraint instance. A transition is a triplet (tail, transition, head), where tail and head are states, and transition is the label of an arc from head to tail, corresponding to the value of one variable in the list of variables.

This automaton will be unrolled into a flow with n + 1 phases. Each phase contains the possible states of the automaton. The first state contains the initial state. The last phase contains the final states.

Between two consecutive phases i and i + 1, the automaton creates a set of arcs. For each transition (tail, label, head), it will add an arc from the state tail of phase i and the state head of phase i + 1. This arc labeled by the value label of the variables variables[i]. That is, this arc can only be selected variables[i]a is assigned the value label.

A feasible solution of this constraint is an assignment of variables such that, starting from the initial state in phase 0, there is a path labeled by the values of the variables that ends in one of the final states in the final phase.

Parameters
varsa non empty list of variables whose values correspond to the labels of the arcs traversed by the automaton
starting_statethe initial state of the automaton
final_statesa non empty list of admissible final states
Returns
an instance of the AutomatonConstraint class

Definition at line 415 of file CpModel.cs.

◆ AddBoolAnd()

Constraint Google.OrTools.Sat.CpModel.AddBoolAnd ( IEnumerable< ILiteral > literals)
inline

Adds And(literals) == true.

Definition at line 638 of file CpModel.cs.

◆ AddBoolOr()

Constraint Google.OrTools.Sat.CpModel.AddBoolOr ( IEnumerable< ILiteral > literals)
inline

Adds Or(literals) == true.

Definition at line 571 of file CpModel.cs.

◆ AddBoolXor()

Constraint Google.OrTools.Sat.CpModel.AddBoolXor ( IEnumerable< ILiteral > literals)
inline

Adds XOr(literals) == true.

Definition at line 657 of file CpModel.cs.

◆ AddCircuit()

CircuitConstraint Google.OrTools.Sat.CpModel.AddCircuit ( )
inline

Adds and returns an empty circuit constraint.

A circuit is a unique Hamiltonian path in a subgraph of the total graph. In case a node i is not in the path, then there must be a loop arc i -> i associated with a true literal. Otherwise this constraint will fail.

Definition at line 307 of file CpModel.cs.

◆ AddCumulative< C >()

CumulativeConstraint Google.OrTools.Sat.CpModel.AddCumulative< C > ( C capacity)
inline

Adds Cumulative(capacity).

This constraint enforces that:

forall t:
∑( demands[i] if (start(intervals[t]) ≤ t < end(intervals[t])) and
(t is present) ) ≤ capacity
Parameters
capacitythe maximum capacity of the cumulative constraint. It must be a positive affine expression
Returns
an instance of the CumulativeConstraint class. this class allows adding (interval, demand) pairs incrementally

Definition at line 984 of file CpModel.cs.

◆ AddDecisionStrategy()

void Google.OrTools.Sat.CpModel.AddDecisionStrategy ( IEnumerable< IntVar > vars,
DecisionStrategyProto.Types.VariableSelectionStrategy var_str,
DecisionStrategyProto.Types.DomainReductionStrategy dom_str )
inline

Search Decision.

Adds DecisionStrategy(variables, var_str, dom_str)..

Definition at line 1024 of file CpModel.cs.

◆ AddDivisionEquality< T, N, D >()

Constraint Google.OrTools.Sat.CpModel.AddDivisionEquality< T, N, D > ( T target,
N num,
D denom )
inline

Adds target == num / denom (integer division rounded towards 0).

Definition at line 716 of file CpModel.cs.

◆ AddElement() [1/3]

Constraint Google.OrTools.Sat.CpModel.AddElement ( IntVar index,
IEnumerable< int > values,
IntVar target )
inline

Adds the element constraint: values[index] == target.

Definition at line 281 of file CpModel.cs.

◆ AddElement() [2/3]

Constraint Google.OrTools.Sat.CpModel.AddElement ( IntVar index,
IEnumerable< IntVar > vars,
IntVar target )
inline

Adds the element constraint: variables[index] == target.

Definition at line 239 of file CpModel.cs.

◆ AddElement() [3/3]

Constraint Google.OrTools.Sat.CpModel.AddElement ( IntVar index,
IEnumerable< long > values,
IntVar target )
inline

Adds the element constraint: values[index] == target.

Definition at line 260 of file CpModel.cs.

◆ AddExactlyOne()

Constraint Google.OrTools.Sat.CpModel.AddExactlyOne ( IEnumerable< ILiteral > literals)
inline

Adds ExactlyOne(literals): ∑(literals) == 1.

Definition at line 619 of file CpModel.cs.

◆ AddForbiddenAssignments()

TableConstraint Google.OrTools.Sat.CpModel.AddForbiddenAssignments ( IEnumerable< IntVar > vars)
inline

Adds ForbiddenAssignments(variables).

A ForbiddenAssignments constraint is a constraint on an array of variables where the list of impossible combinations is provided in the tuples list.

Parameters
varsa list of variables
Returns
an instance of the TableConstraint class without any tuples. Tuples can be added directly to the table constraint

Definition at line 375 of file CpModel.cs.

◆ AddHint() [1/2]

void Google.OrTools.Sat.CpModel.AddHint ( ILiteral lit,
bool value )
inline

Adds variable hinting to the model.

Definition at line 1051 of file CpModel.cs.

◆ AddHint() [2/2]

void Google.OrTools.Sat.CpModel.AddHint ( IntVar var,
long value )
inline

Adds variable hinting to the model.

Definition at line 1043 of file CpModel.cs.

◆ AddImplication()

Constraint Google.OrTools.Sat.CpModel.AddImplication ( ILiteral a,
ILiteral b )
inline

Adds a ⇒ b.

Definition at line 554 of file CpModel.cs.

◆ AddInverse()

Constraint Google.OrTools.Sat.CpModel.AddInverse ( IEnumerable< IntVar > direct,
IEnumerable< IntVar > reverse )
inline

Adds Inverse(variables, inverseVariables).

An inverse constraint enforces that if direct[i] == j, then reverse[j] == i, and vice versa.

Parameters
directan array of integer variables
reversean array of integer variables
Returns
an instance of the Constraint class

Definition at line 446 of file CpModel.cs.

◆ AddLinearConstraint()

Constraint Google.OrTools.Sat.CpModel.AddLinearConstraint ( LinearExpr expr,
long lb,
long ub )
inline

Adds lb ≤ expr ≤ ub.

Definition at line 141 of file CpModel.cs.

◆ AddLinearExpressionInDomain()

Constraint Google.OrTools.Sat.CpModel.AddLinearExpressionInDomain ( LinearExpr expr,
Domain domain )
inline

Adds expr ∈ domain.

Definition at line 158 of file CpModel.cs.

◆ AddMapDomain()

void Google.OrTools.Sat.CpModel.AddMapDomain ( IntVar var,
IEnumerable< IntVar > bool_vars,
long offset = 0 )
inline

Adds var == i + offset ⇔ bool_vars[i] == true for all i.

Definition at line 509 of file CpModel.cs.

◆ AddMaxEquality()

Constraint Google.OrTools.Sat.CpModel.AddMaxEquality ( LinearExpr target,
IEnumerable< LinearExpr > exprs )
inline

Adds target == Max(exprs).

Definition at line 696 of file CpModel.cs.

◆ AddMinEquality()

Constraint Google.OrTools.Sat.CpModel.AddMinEquality ( LinearExpr target,
IEnumerable< LinearExpr > exprs )
inline

Adds target == Min(exprs).

Definition at line 676 of file CpModel.cs.

◆ AddModuloEquality< T, V, M >()

Constraint Google.OrTools.Sat.CpModel.AddModuloEquality< T, V, M > ( T target,
V v,
M m )
inline

Adds target == v % m.

Definition at line 752 of file CpModel.cs.

◆ AddMultipleCircuit()

MultipleCircuitConstraint Google.OrTools.Sat.CpModel.AddMultipleCircuit ( )
inline

Adds and returns an empty multiple circuit constraint.

A multiple circuit is set of cycles in a subgraph of the total graph. The node index by 0 must be part of all cycles of length > 1. Each node with index > 0 belongs to exactly one cycle. If such node does not belong in any cycle of length > 1, then there must be a looping arc on this node attached to a literal that will be true. Otherwise, the constraint will fail.

Definition at line 325 of file CpModel.cs.

◆ AddMultiplicationEquality() [1/2]

Constraint Google.OrTools.Sat.CpModel.AddMultiplicationEquality ( LinearExpr target,
IEnumerable< LinearExpr > exprs )
inline

Adds target == ∏(exprs).

Definition at line 770 of file CpModel.cs.

◆ AddMultiplicationEquality() [2/2]

Constraint Google.OrTools.Sat.CpModel.AddMultiplicationEquality ( LinearExpr target,
LinearExpr left,
LinearExpr right )
inline

Adds target == left * right.

Definition at line 790 of file CpModel.cs.

◆ AddNoOverlap()

Constraint Google.OrTools.Sat.CpModel.AddNoOverlap ( IEnumerable< IntervalVar > intervals)
inline

Adds NoOverlap(intervalVars).

A NoOverlap constraint ensures that all present intervals do not overlap in time.

Parameters
intervalsthe list of interval variables to constrain
Returns
an instance of the Constraint class

Definition at line 928 of file CpModel.cs.

◆ AddNoOverlap2D()

NoOverlap2dConstraint Google.OrTools.Sat.CpModel.AddNoOverlap2D ( )
inline

Adds NoOverlap2D().

A NoOverlap2D constraint ensures that all present rectangles do not overlap on a plan. Each rectangle is aligned with the X and Y axis, and is defined by two intervals which represent its projection onto the X and Y axis.

Furthermore, one box is optional if at least one of the x or y interval is optional.

Returns
an instance of the NoOverlap2dConstraint class. This class allows adding rectangles incrementally

Definition at line 958 of file CpModel.cs.

◆ AddReservoirConstraint()

ReservoirConstraint Google.OrTools.Sat.CpModel.AddReservoirConstraint ( long minLevel,
long maxLevel )
inline

Adds a reservoir constraint with optional refill/emptying events.

Maintain a reservoir level within bounds. The water level starts at 0, and at any time, it must be within [min_level, max_level].

Given an event (time, levelChange, active), if active is true, and if time is assigned a value t, then the level of the reservoir changes by levelChange (which is constant) at time t. Therefore, at any time t:

∑(levelChanges[i] * actives[i] if times[i] ≤ t) in [min_level, max_level]

Note that min level must be ≤ 0, and the max level must be ≥ 0. Please use fixed level_changes to simulate an initial state.

Parameters
minLevelat any time, the level of the reservoir must be greater of equal than the min level. minLevel must me ≤ 0
maxLevelat any time, the level of the reservoir must be less or equal than the max level. maxLevel must be ≥ 0
Returns
an instance of the ReservoirConstraint class

Definition at line 492 of file CpModel.cs.

◆ ClearAssumptions()

void Google.OrTools.Sat.CpModel.ClearAssumptions ( )
inline

Clears all assumptions from the model.

Definition at line 1089 of file CpModel.cs.

◆ ClearHints()

void Google.OrTools.Sat.CpModel.ClearHints ( )
inline

Clears all hinting from the model.

Definition at line 1068 of file CpModel.cs.

◆ ExportToFile()

Boolean Google.OrTools.Sat.CpModel.ExportToFile ( String file)
inline

Write the model as a protocol buffer to file.

Parameters
filefile to write the model to. If the filename ends with txt, the model will be written as a text file, otherwise, the binary format will be used.
Returns
true if the model was correctly written

Definition at line 1166 of file CpModel.cs.

◆ FalseLiteral()

ILiteral Google.OrTools.Sat.CpModel.FalseLiteral ( )
inline

Returns a constant false literal.

Definition at line 118 of file CpModel.cs.

◆ Maximize()

void Google.OrTools.Sat.CpModel.Maximize ( LinearExpr obj)
inline

Adds a maximization objective of a linear expression.

Definition at line 1004 of file CpModel.cs.

◆ Minimize()

void Google.OrTools.Sat.CpModel.Minimize ( LinearExpr obj)
inline

Objective.

Adds a minimization objective of a linear expression.

Definition at line 998 of file CpModel.cs.

◆ ModelStats()

String Google.OrTools.Sat.CpModel.ModelStats ( )
inline

Returns some statistics on model as a string.

Definition at line 1151 of file CpModel.cs.

◆ NewBoolVar()

BoolVar Google.OrTools.Sat.CpModel.NewBoolVar ( string name)
inline

Creates a Boolean variable with given domain.

Definition at line 98 of file CpModel.cs.

◆ NewConstant()

IntVar Google.OrTools.Sat.CpModel.NewConstant ( long value)
inline

Creates a constant variable.

Definition at line 88 of file CpModel.cs.

◆ NewFixedSizeIntervalVar< S >()

IntervalVar Google.OrTools.Sat.CpModel.NewFixedSizeIntervalVar< S > ( S start,
long size,
string name )
inline

Creates an interval variable from an affine expression start, and a fixed size.

An interval variable is a constraint, that is itself used in other constraints like NoOverlap.

Parameters
startthe start of the interval. It needs to be an affine or constant expression. *
sizethe fixed size of the interval
namethe name of the interval variable
Returns
An IntervalVar object

Definition at line 847 of file CpModel.cs.

◆ NewIntervalVar< S, D, E >()

IntervalVar Google.OrTools.Sat.CpModel.NewIntervalVar< S, D, E > ( S start,
D size,
E end,
string name )
inline

Scheduling support.

Creates an interval variable from three affine expressions start, size, and end.

An interval variable is a constraint, that is itself used in other constraints like NoOverlap. Internally, it ensures that start + size == end.

Parameters
startthe start of the interval. It needs to be an affine or constant expression.
sizethe size of the interval. It needs to be an affine or constant expression.
endthe end of the interval. It needs to be an affine or constant expression.
namethe name of the interval variable
Returns
An IntervalVar object

Definition at line 820 of file CpModel.cs.

◆ NewIntVar()

IntVar Google.OrTools.Sat.CpModel.NewIntVar ( long lb,
long ub,
string name )
inline

Integer variables and constraints.

Creates an integer variable with domain [lb, ub].

Parameters
lbthe lower bound of the domain
ubthe upper bound of the domain
namethe name of the variable
Returns
a variable with the given domain

Definition at line 64 of file CpModel.cs.

◆ NewIntVarFromDomain()

IntVar Google.OrTools.Sat.CpModel.NewIntVarFromDomain ( Domain domain,
string name )
inline

Creates an integer variable with given domain.

Parameters
domainan instance of the Domain class
namethe name of the variable
Returns
a variable with the given domain

Definition at line 78 of file CpModel.cs.

◆ NewOptionalFixedSizeIntervalVar< S >()

IntervalVar Google.OrTools.Sat.CpModel.NewOptionalFixedSizeIntervalVar< S > ( S start,
long size,
ILiteral is_present,
string name )
inline

Creates an optional interval variable from an affine expression start, a fixed size, and a literal is_present.

An interval variable is a constraint, that is itself used in other constraints like NoOverlap.

Parameters
startthe start of the interval. It needs to be an affine or constant expression. *
sizethe fixed size of the interval
is_presenta literal that indicates if the interval is active or not. A inactive interval is simply ignored by all constraints.
namethe name of the interval variable
Returns
An IntervalVar object

Definition at line 907 of file CpModel.cs.

◆ NewOptionalIntervalVar< S, D, E >()

IntervalVar Google.OrTools.Sat.CpModel.NewOptionalIntervalVar< S, D, E > ( S start,
D size,
E end,
ILiteral is_present,
string name )
inline

Creates an optional interval variable from three affine expressions start, size, and end, and a literal is_present.

An interval variable is a constraint, that is itself used in other constraints like NoOverlap. Internally, it ensures that is_present ⇒ start + size == end.

Parameters
startthe start of the interval. It needs to be an affine or constant expression.
sizethe size of the interval. It needs to be an affine or constant expression.
endthe end of the interval. It needs to be an affine or constant expression.
is_presenta literal that indicates if the interval is active or not. A inactive interval is simply ignored by all constraints.
namethe name of the interval variable
Returns
An IntervalVar object

Definition at line 877 of file CpModel.cs.

◆ TrueLiteral()

ILiteral Google.OrTools.Sat.CpModel.TrueLiteral ( )
inline

Returns a constant true literal.

Definition at line 108 of file CpModel.cs.

◆ Validate()

String Google.OrTools.Sat.CpModel.Validate ( )
inline

Returns a non empty string explaining the issue if the model is invalid.

Definition at line 1176 of file CpModel.cs.

Property Documentation

◆ Model

CpModelProto Google.OrTools.Sat.CpModel.Model
get

Getters.

The underlying CpModelProto.

Definition at line 40 of file CpModel.cs.


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