DotNet Reference
.Net Reference
CpModel.cs
Go to the documentation of this file.
39 {
785 public Constraint AddMultiplicationEquality(LinearExpr target, LinearExpr left, LinearExpr right)
873 public IntervalVar NewOptionalIntervalVar<S, D, E>(S start, D size, E end, ILiteral is_present, string name)
904 public IntervalVar NewOptionalFixedSizeIntervalVar<S>(S start, long size, ILiteral is_present, string name)
pbc::RepeatedField< int > Literals
Definition: CpModel.pb.cs:561
Constraint AddAtLeastOne(IEnumerable< ILiteral > literals)
Same as AddBoolOr: ∑(literals) ≥ 1.
Definition: CpModel.cs:585
void Maximize(LinearExpr obj)
Adds a maximization objective of a linear expression.
Definition: CpModel.cs:1001
static long GetVarValueMap(LinearExpr e, long initial_coeff, Dictionary< IntVar, long > dict)
Definition: IntegerExpressions.cs:348
Some constraints supports linear expression instead of just using a reference to a variable.
Definition: CpModel.pb.cs:695
static LinearExpr Constant(long value)
Creates a constant expression.
Definition: IntegerExpressions.cs:196
IntervalVar NewIntervalVar< S, D, E >(S start, D size, E end, string name)
Creates an interval variable from three affine expressions start, size, and end.
Definition: CpModel.cs:815
Constraint AddLinearExpressionInDomain(LinearExpr expr, Domain domain)
Adds expr ∈ domain.
Definition: CpModel.cs:158
Constraint AddDivisionEquality< T, N, D >(T target, N num, D denom)
Adds target == num / denom (integer division rounded towards 0).
Definition: CpModel.cs:711
pbc::RepeatedField< long > Coeffs
Definition: CpModel.pb.cs:6449
pbc::RepeatedField< int > Vars
The linear terms of the objective to minimize.
Definition: CpModel.pb.cs:6438
global::Google.OrTools.Sat.LinearArgumentProto?? IntMod
The int_mod constraint forces the target to equal exprs[0] % exprs[1].
Definition: CpModel.pb.cs:5053
global::Google.OrTools.Sat.LinearExpressionProto Target
Definition: CpModel.pb.cs:990
Constraint AddNoOverlap(IEnumerable< IntervalVar > intervals)
Adds NoOverlap(intervalVars).
Definition: CpModel.cs:925
Define the strategy to follow when the solver needs to take a new decision.
Definition: CpModel.pb.cs:7125
IntVar NewIntVarFromDomain(Domain domain, string name)
Creates an integer variable with given domain.
Definition: CpModel.cs:76
Definition: util/Domain.cs:11
pbc::RepeatedField< global::Google.OrTools.Sat.LinearExpressionProto > Exprs
Definition: CpModel.pb.cs:1004
long [] FlattenedIntervals()
Definition: util/Domain.cs:84
Constraint AddMinEquality(LinearExpr target, IEnumerable< LinearExpr > exprs)
Adds target == Min(exprs).
Definition: CpModel.cs:671
double Offset
The displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offse...
Definition: CpModel.pb.cs:6467
The circuit constraint is defined on a graph where the arc presence are controlled by literals.
Definition: CpModel.pb.cs:3199
Constraint AddElement(IntVar index, IEnumerable< long > values, IntVar target)
Adds the element constraint: values[index] == target.
Definition: CpModel.cs:260
Constraint AddExactlyOne(IEnumerable< ILiteral > literals)
Adds ExactlyOne(literals): ∑(literals) == 1.
Definition: CpModel.cs:614
Holds a linear constraint: expression ∈ domain
Definition: IntegerExpressions.cs:844
VariableSelectionStrategy
The order in which the variables above should be considered.
Definition: CpModel.pb.cs:7419
static string ValidateModel(Google.OrTools.Sat.CpModelProto model_proto)
Definition: CpSatHelper.cs:59
ReservoirConstraint AddReservoirConstraint(long minLevel, long maxLevel)
Adds a reservoir constraint with optional refill/emptying events.
Definition: CpModel.cs:492
global::Google.OrTools.Sat.PartialVariableAssignment SolutionHint
Solution hint.
Definition: CpModel.pb.cs:8813
Specialized NoOverlap2D constraint.
Definition: Constraints.cs:406
static string ModelStats(Google.OrTools.Sat.CpModelProto model_proto)
Definition: CpSatHelper.cs:49
Holds a integer variable with a discrete domain.
Definition: IntegerExpressions.cs:689
Constraint AddLinearConstraint(LinearExpr expr, long lb, long ub)
Adds lb ≤ expr ≤ ub.
Definition: CpModel.cs:141
Holds a Boolean variable or its negation.
Definition: IntegerExpressions.cs:25
Specialized multiple circuit constraint.
Definition: Constraints.cs:118
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:3827
Definition: IntArrayHelper.cs:14
bool Negated
If true, the meaning is "negated", that is we forbid any of the given tuple from a feasible assignmen...
Definition: CpModel.pb.cs:3851
Constraint AddInverse(IEnumerable< IntVar > direct, IEnumerable< IntVar > reverse)
Adds Inverse(variables, inverseVariables).
Definition: CpModel.cs:446
pbc::RepeatedField< int > EnforcementLiteral
The constraint will be enforced iff all literals listed here are true.
Definition: CpModel.pb.cs:4923
Container for nested types declared in the DecisionStrategyProto message type.
Definition: CpModel.pb.cs:7412
Constraint Add(BoundedLinearExpression lin)
Adds a linear constraint to the model.
Definition: CpModel.cs:192
global::Google.OrTools.Sat.AllDifferentConstraintProto?? AllDiff
The all_diff constraint forces all variables to take different values.
Definition: CpModel.pb.cs:5124
global::Google.OrTools.Sat.LinearConstraintProto?? Linear
The linear constraint enforces a linear inequality among the variables, such as 0 <= x + 2y <= 10.
Definition: CpModel.pb.cs:5109
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:7772
CircuitConstraint AddCircuit()
Adds and returns an empty circuit constraint.
Definition: CpModel.cs:307
The sum of the demands of the intervals at each interval point cannot exceed a capacity.
Definition: CpModel.pb.cs:2602
global::Google.OrTools.Sat.LinearArgumentProto?? LinMax
The lin_max constraint forces the target to equal the maximum of all linear expressions.
Definition: CpModel.pb.cs:5093
The linear sum vars[i] * coeffs[i] must fall in the given domain.
Definition: CpModel.pb.cs:1353
int GetIndex()
Returns the index of the variable in the underlying CpModelProto.
Definition: IntegerExpressions.cs:718
global::Google.OrTools.Sat.CumulativeConstraintProto?? Cumulative
The cumulative constraint ensures that for any integer point, the sum of the demands of the intervals...
Definition: CpModel.pb.cs:5301
Constraint AddAbsEquality(LinearExpr target, LinearExpr expr)
Adds target == abs(expr).
Definition: CpModel.cs:729
static bool WriteModelToFile(Google.OrTools.Sat.CpModelProto model_proto, string filename)
Definition: CpSatHelper.cs:69
pbc::RepeatedField< global::Google.OrTools.Sat.ConstraintProto > Constraints
Definition: CpModel.pb.cs:8727
All affine expressions must take different values.
Definition: CpModel.pb.cs:1167
BoolVar NewBoolVar(string name)
Creates an Boolean variable with given domain.
Definition: CpModel.cs:96
IntervalVar NewFixedSizeIntervalVar< S >(S start, long size, string name)
Creates an interval variable from an affine expression start, and a fixed size.
Definition: CpModel.cs:843
global::Google.OrTools.Sat.TableConstraintProto?? Table
The table constraint enforces what values a tuple of variables may take.
Definition: CpModel.pb.cs:5187
CumulativeConstraint AddCumulative< C >(C capacity)
Adds Cumulative(capacity).
Definition: CpModel.cs:981
global::Google.OrTools.Sat.BoolArgumentProto?? BoolOr
The bool_or constraint forces at least one literal to be true.
Definition: CpModel.pb.cs:4934
global::Google.OrTools.Sat.ElementConstraintProto?? Element
The element constraint forces the variable with the given index to be equal to the target.
Definition: CpModel.pb.cs:5140
global::Google.OrTools.Sat.LinearArgumentProto?? IntProd
The int_prod constraint forces the target to equal the product of all variables.
Definition: CpModel.pb.cs:5076
The constraint target = vars[index].
Definition: CpModel.pb.cs:1596
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:1406
pbc::RepeatedField< long > Domain
Definition: CpModel.pb.cs:1431
The values of the n-tuple formed by the given variables can only be one of the listed n-tuples in val...
Definition: CpModel.pb.cs:3774
void AddMapDomain(IntVar var, IEnumerable< IntVar > bool_vars, long offset=0)
Definition: CpModel.cs:504
global::Google.OrTools.Sat.AutomatonConstraintProto?? Automaton
The automaton constraint forces a sequence of variables to be accepted by an automaton.
Definition: CpModel.pb.cs:5203
void Minimize(LinearExpr obj)
Adds a minimization objective of a linear expression.
Definition: CpModel.cs:995
Constraint AddModuloEquality< T, V, M >(T target, V v, M m)
Adds target == v % m.
Definition: CpModel.cs:747
LinearExpr GetLinearExpr< X >(X x)
Definition: CpModel.cs:1174
Definition: IntArrayHelper.cs:14
Constraint AddBoolAnd(IEnumerable< ILiteral > literals)
Adds And(literals) == true.
Definition: CpModel.cs:633
TableConstraint AddAllowedAssignments(IEnumerable< IntVar > vars)
Adds AllowedAssignments(variables).
Definition: CpModel.cs:347
global::Google.OrTools.Sat.NoOverlapConstraintProto?? NoOverlap
The no_overlap constraint prevents a set of intervals from overlapping; in scheduling,...
Definition: CpModel.pb.cs:5269
Specialized cumulative constraint.
Definition: Constraints.cs:364
LinearExpr Right
Definition: IntegerExpressions.cs:968
global::Google.OrTools.Sat.BoolArgumentProto?? BoolAnd
The bool_and constraint forces all of the literals to be true.
Definition: CpModel.pb.cs:4953
Maintain a reservoir level within bounds.
Definition: CpModel.pb.cs:2874
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:748
global::Google.OrTools.Sat.BoolArgumentProto?? BoolXor
The bool_xor constraint forces an odd number of the literals to be true.
Definition: CpModel.pb.cs:5019
Definition: util/Domain.cs:17
global::Google.OrTools.Sat.ReservoirConstraintProto?? Reservoir
The reservoir constraint forces the sum of a set of active demands to always be between a specified m...
Definition: CpModel.pb.cs:5236
TableConstraint AddForbiddenAssignments(IEnumerable< IntVar > vars)
Adds ForbiddenAssignments(variables).
Definition: CpModel.cs:375
global::Google.OrTools.Sat.RoutesConstraintProto?? Routes
The routes constraint implements the vehicle routing problem.
Definition: CpModel.pb.cs:5171
global::Google.OrTools.Sat.BoolArgumentProto?? AtMostOne
The at_most_one constraint enforces that no more than one literal is true at the same time.
Definition: CpModel.pb.cs:4978
pbc::RepeatedField< global::Google.OrTools.Sat.IntegerVariableProto > Variables
The associated Protos should be referred by their index in these fields.
Definition: CpModel.pb.cs:8716
pbc::RepeatedField< int > Variables
The variables to be considered for the next decision.
Definition: CpModel.pb.cs:7184
Constraint AddMaxEquality(LinearExpr target, IEnumerable< LinearExpr > exprs)
Adds target == Max(exprs).
Definition: CpModel.cs:691
Definition: CpSatHelper.cs:15
global::Google.OrTools.Sat.NoOverlap2DConstraintProto?? NoOverlap2D
The no_overlap_2d constraint prevents a set of boxes from overlapping.
Definition: CpModel.pb.cs:5284
global::Google.OrTools.Sat.LinearExpressionProto Capacity
Definition: CpModel.pb.cs:2653
pbc::RepeatedField< global::Google.OrTools.Sat.LinearExpressionProto > Exprs
Definition: CpModel.pb.cs:1218
Holds a linear expression: sum (ai * xi) + b.
Definition: IntegerExpressions.cs:92
global::Google.OrTools.Sat.LinearArgumentProto?? IntDiv
The int_div constraint forces the target to equal exprs[0] / exprs[1].
Definition: CpModel.pb.cs:5036
Constraint AddMultiplicationEquality(LinearExpr target, LinearExpr left, LinearExpr right)
Adds target == left * right.
Definition: CpModel.cs:785
void AddAssumptions(IEnumerable< ILiteral > literals)
Adds multiple literals to the model as assumptions.
Definition: CpModel.cs:1057
LinearExpressionProto GetLinearExpressionProto(LinearExpr expr, bool negate=false)
Definition: CpModel.cs:1191
Constraint AddElement(IntVar index, IEnumerable< int > values, IntVar target)
Adds the element constraint: values[index] == target.
Definition: CpModel.cs:281
Specialized automaton constraint.
Definition: Constraints.cs:275
Specialized reservoir constraint.
Definition: Constraints.cs:306
Constraint AddMultiplicationEquality(LinearExpr target, IEnumerable< LinearExpr > exprs)
Adds target == ∏(exprs).
Definition: CpModel.cs:765
IntVar NewIntVar(long lb, long ub, string name)
Creates an integer variable with domain [lb, ub].
Definition: CpModel.cs:62
pbc::RepeatedField< long > Coeffs
Definition: CpModel.pb.cs:759
The two arrays of variable each represent a function, the second is the inverse of the first: f_direc...
Definition: CpModel.pb.cs:4027
Argument of the constraints of the form OP(literals).
Definition: CpModel.pb.cs:510
Constraint AddBoolOr(IEnumerable< ILiteral > literals)
Adds Or(literals) == true.
Definition: CpModel.cs:566
global::Google.OrTools.Sat.CircuitConstraintProto?? Circuit
The circuit constraint takes a graph and forces the arcs present (with arc presence indicated by a li...
Definition: CpModel.pb.cs:5156
int Index
Returns the index of the variable in the underlying CpModelProto.
Definition: IntegerExpressions.cs:725
pbc::RepeatedField< int > Intervals
Definition: CpModel.pb.cs:2211
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:1673
DomainReductionStrategy
Once a variable has been chosen, this enum describe what decision is taken on its domain.
Definition: CpModel.pb.cs:7433
pbc::RepeatedField< int > FDirect
Definition: CpModel.pb.cs:4079
MultipleCircuitConstraint AddMultipleCircuit()
Adds and returns an empty multiple circuit constraint.
Definition: CpModel.cs:325
void AddDecisionStrategy(IEnumerable< IntVar > vars, DecisionStrategyProto.Types.VariableSelectionStrategy var_str, DecisionStrategyProto.Types.DomainReductionStrategy dom_str)
Adds DecisionStrategy(variables, var_str, dom_str).
Definition: CpModel.cs:1021
Constraint AddAllDifferent(IEnumerable< LinearExpr > exprs)
Adds the constraint AllDifferent(exprs).
Definition: CpModel.cs:220
All the intervals (index of IntervalConstraintProto) must be disjoint.
Definition: CpModel.pb.cs:2160
pbc::RepeatedField< global::Google.OrTools.Sat.DecisionStrategyProto > SearchStrategy
Defines the strategy that the solver should follow when the search_branching parameter is set to FIXE...
Definition: CpModel.pb.cs:8791
AutomatonConstraint AddAutomaton(IEnumerable< IntVar > vars, long starting_state, IEnumerable< long > final_states)
Adds an automaton constraint.
Definition: CpModel.cs:415
void AddAssumption(ILiteral lit)
Adds a literal to the model as assumption.
Definition: CpModel.cs:1051
pbc::RepeatedField< long > Values
Definition: CpModel.pb.cs:7783
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,...
Definition: CpModel.cs:873
The "VRP" (Vehicle Routing Problem) constraint.
Definition: CpModel.pb.cs:3457
The boxes defined by [start_x, end_x) * [start_y, end_y) cannot overlap.
Definition: CpModel.pb.cs:2345
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,...
Definition: CpModel.cs:904
Boolean ExportToFile(String file)
Write the model as a protocol buffer to file.
Definition: CpModel.cs:1142
Constraint AddAtMostOne(IEnumerable< ILiteral > literals)
Adds AtMostOne(literals): ∑(literals) ≤ 1.
Definition: CpModel.cs:595
This constraint forces a sequence of variables to be accepted by an automaton.
Definition: CpModel.pb.cs:4239
Definition: CpModel.pb.cs:12
String Validate()
Returns a non empty string explaining the issue if the model is invalid.
Definition: CpModel.cs:1152
global::Google.OrTools.Sat.CpObjectiveProto Objective
The objective to minimize.
Definition: CpModel.pb.cs:8739
static LinearExpr Sum(IEnumerable< LinearExpr > exprs)
Creates Sum(exprs).
Definition: IntegerExpressions.cs:95
global::Google.OrTools.Sat.BoolArgumentProto?? ExactlyOne
The exactly_one constraint force exactly one literal to true and no more.
Definition: CpModel.pb.cs:5004
Constraint AddBoolXor(IEnumerable< ILiteral > literals)
Adds XOr(literals) == true.
Definition: CpModel.cs:652
global::Google.OrTools.Sat.InverseConstraintProto?? Inverse
The inverse constraint forces two arrays to be inverses of each other: the values of one are the indi...
Definition: CpModel.pb.cs:5219
This message encodes a partial (or full) assignment of the variables of a CpModelProto.
Definition: CpModel.pb.cs:7720
Constraint AddElement(IntVar index, IEnumerable< IntVar > vars, IntVar target)
Adds the element constraint: variables[index] == target.
Definition: CpModel.cs:239