DotNet Reference
.Net Reference
IntegerExpressions.cs
Go to the documentation of this file.
41 System.Runtime.InteropServices.CollectionsMarshal.GetValueRefOrAddDefault(dict, key, out _) += increment;
55 internal static void TrySetCapacity<TField, TValues>(this RepeatedField<TField> field, IEnumerable<TValues> values)
64 internal static void TryEnsureCapacity<TValue, TValues>(this List<TValue> list, IEnumerable<TValues> values)
66 // Check for ICollection as the generic version is not covariant and TValues could be LinearExpr, IntVar, ...
363 internal static long GetVarValueMap(LinearExpr e, Dictionary<int, long> dict, Queue<Term> terms)
413 internal static LinearExpr RebuildLinearExprFromLinearExpressionProto(LinearExpressionProto proto,
538 public LinearExprBuilder AddWeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<long> coefficients)
549 public LinearExprBuilder AddWeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<int> coefficients)
560 public LinearExprBuilder AddWeightedSum(IEnumerable<ILiteral> literals, IEnumerable<int> coefficients)
571 public LinearExprBuilder AddWeightedSum(IEnumerable<ILiteral> literals, IEnumerable<long> coefficients)
582 public LinearExprBuilder AddWeightedSum(IEnumerable<BoolVar> vars, IEnumerable<long> coefficients)
593 public LinearExprBuilder AddWeightedSum(IEnumerable<BoolVar> vars, IEnumerable<int> coefficients)
BoolVar(CpModelProto model, String name)
Definition: IntegerExpressions.cs:792
BoolVar(CpModelProto model, int index)
Definition: IntegerExpressions.cs:796
LinearExpr NotAsExpr()
Returns the Boolean negation of that variable as a linear expression.
Definition: IntegerExpressions.cs:807
Holds a linear constraint: expression ∈ domain
Definition: IntegerExpressions.cs:861
static BoundedLinearExpression operator<=(BoundedLinearExpression a, long v)
Definition: IntegerExpressions.cs:940
LinearExpr Right
Definition: IntegerExpressions.cs:984
BoundedLinearExpression(long lb, LinearExpr expr, long ub)
Definition: IntegerExpressions.cs:871
BoundedLinearExpression(LinearExpr left, LinearExpr right, bool equality)
Definition: IntegerExpressions.cs:880
BoundedLinearExpression(LinearExpr left, long v, bool equality)
Definition: IntegerExpressions.cs:889
static BoundedLinearExpression operator<(BoundedLinearExpression a, long v)
Definition: IntegerExpressions.cs:949
static BoundedLinearExpression operator>(BoundedLinearExpression a, long v)
Definition: IntegerExpressions.cs:967
override string ToString()
Definition: IntegerExpressions.cs:921
static BoundedLinearExpression operator>=(BoundedLinearExpression a, long v)
Definition: IntegerExpressions.cs:958
Holds a integer variable with a discrete domain.
Definition: IntegerExpressions.cs:706
int GetIndex()
Returns the index of the variable in the underlying CpModelProto.
Definition: IntegerExpressions.cs:734
int Index
Returns the index of the variable in the underlying CpModelProto.
Definition: IntegerExpressions.cs:741
string Name()
Returns the name of the variable given upon creation.
Definition: IntegerExpressions.cs:772
IntVar(CpModelProto model, int index)
Definition: IntegerExpressions.cs:727
IntVar(CpModelProto model, Domain domain, string name)
Definition: IntegerExpressions.cs:707
IntVar(CpModelProto model, long lb, long ub, string name)
Definition: IntegerExpressions.cs:716
A builder class for linear expressions.
Definition: IntegerExpressions.cs:443
LinearExprBuilder Add(LinearExpr expr)
Adds expr to the builder.
Definition: IntegerExpressions.cs:451
LinearExprBuilder AddSum(IEnumerable< BoolVar > vars)
Adds sum(vars) to the builder.
Definition: IntegerExpressions.cs:527
LinearExprBuilder AddSum(IEnumerable< ILiteral > literals)
Adds sum(literals) to the builder.
Definition: IntegerExpressions.cs:516
LinearExprBuilder AddTerm(ILiteral literal, long coefficient)
Adds literal * coefficient to the builder.
Definition: IntegerExpressions.cs:483
LinearExprBuilder AddSum(IEnumerable< LinearExpr > exprs)
Adds sum(exprs) to the builder.
Definition: IntegerExpressions.cs:505
LinearExprBuilder AddWeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< int > coefficients)
Adds sum(exprs[i] * coeffs[i]) to the builder.
Definition: IntegerExpressions.cs:549
LinearExprBuilder AddWeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< long > coefficients)
Adds sum(exprs[i] * coeffs[i]) to the builder.
Definition: IntegerExpressions.cs:538
LinearExprBuilder(int sizeHint=2)
Definition: IntegerExpressions.cs:444
LinearExprBuilder Add(ILiteral literal)
Adds literal to the builder.
Definition: IntegerExpressions.cs:457
LinearExprBuilder AddWeightedSum(IEnumerable< BoolVar > vars, IEnumerable< int > coefficients)
Adds sum(vars[i] * coeffs[i]) to the builder.
Definition: IntegerExpressions.cs:593
LinearExprBuilder AddTerm(LinearExpr expr, long coefficient)
Adds expr * coefficient to the builder.
Definition: IntegerExpressions.cs:476
LinearExprBuilder AddWeightedSum(IEnumerable< ILiteral > literals, IEnumerable< long > coefficients)
Adds sum(literals[i] * coeffs[i]) to the builder.
Definition: IntegerExpressions.cs:571
override string ToString()
Definition: IntegerExpressions.cs:603
LinearExprBuilder AddWeightedSum(IEnumerable< BoolVar > vars, IEnumerable< long > coefficients)
Adds sum(vars[i] * coeffs[i]) to the builder.
Definition: IntegerExpressions.cs:582
LinearExprBuilder AddTerm(BoolVar var, long coefficient)
Adds var * coefficient to the builder.
Definition: IntegerExpressions.cs:498
LinearExprBuilder Add(long constant)
Adds constant to the builder.
Definition: IntegerExpressions.cs:469
LinearExprBuilder AddWeightedSum(IEnumerable< ILiteral > literals, IEnumerable< int > coefficients)
Adds sum(literals[i] * coeffs[i]) to the builder.
Definition: IntegerExpressions.cs:560
Holds a linear expression: sum (ai * xi) + b.
Definition: IntegerExpressions.cs:108
static LinearExpr Affine(LinearExpr expr, long coeff, long offset)
Creates expr * coeff + offset.
Definition: IntegerExpressions.cs:189
static LinearExpr operator*(LinearExpr a, long v)
Definition: IntegerExpressions.cs:252
static LinearExpr Constant(long value)
Creates a constant expression.
Definition: IntegerExpressions.cs:211
static LinearExpr Sum(IEnumerable< LinearExpr > exprs)
Creates Sum(exprs).
Definition: IntegerExpressions.cs:110
static BoundedLinearExpression operator<(LinearExpr a, long v)
Definition: IntegerExpressions.cs:317
static LinearExpr Affine(BoolVar var, long coeff, long offset)
Creates var * coeff + offset.
Definition: IntegerExpressions.cs:205
static BoundedLinearExpression operator==(LinearExpr a, LinearExpr b)
Definition: IntegerExpressions.cs:267
static LinearExpr Term(BoolVar var, long coeff)
Creates var * coeff.
Definition: IntegerExpressions.cs:183
static BoundedLinearExpression operator>(LinearExpr a, long v)
Definition: IntegerExpressions.cs:297
static BoundedLinearExpression operator>=(LinearExpr a, long v)
Definition: IntegerExpressions.cs:287
static BoundedLinearExpression operator<=(LinearExpr a, long v)
Definition: IntegerExpressions.cs:307
static LinearExpr WeightedSum(IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
Creates Sum(vars[i] * coeffs[i]).
Definition: IntegerExpressions.cs:158
static LinearExpr WeightedSum(IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
Creates Sum(literals[i] * coeffs[i]).
Definition: IntegerExpressions.cs:140
static LinearExpr Term(ILiteral literal, long coeff)
Creates literal * coeff.
Definition: IntegerExpressions.cs:170
static LinearExpr WeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
Creates Sum(exprs[i] * coeffs[i]).
Definition: IntegerExpressions.cs:134
static LinearExpr Sum(IEnumerable< BoolVar > vars)
Creates Sum(vars).
Definition: IntegerExpressions.cs:122
static LinearExpr WeightedSum(IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
Creates Sum(vars[i] * coeffs[i]).
Definition: IntegerExpressions.cs:152
static LinearExpr operator+(LinearExpr a, LinearExpr b)
Definition: IntegerExpressions.cs:222
static LinearExpr WeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
Creates Sum(exprs[i] * coeffs[i]).
Definition: IntegerExpressions.cs:128
static BoundedLinearExpression operator<(LinearExpr a, LinearExpr b)
Definition: IntegerExpressions.cs:342
static BoundedLinearExpression operator>(LinearExpr a, LinearExpr b)
Definition: IntegerExpressions.cs:332
static BoundedLinearExpression operator<(long v, LinearExpr a)
Definition: IntegerExpressions.cs:322
static LinearExpr Affine(ILiteral literal, long coeff, long offset)
Creates literal * coeff + offset.
Definition: IntegerExpressions.cs:199
static BoundedLinearExpression operator>(long v, LinearExpr a)
Definition: IntegerExpressions.cs:302
static LinearExpr Term(LinearExpr expr, long coeff)
Creates expr * coeff.
Definition: IntegerExpressions.cs:164
static BoundedLinearExpression operator!=(LinearExpr a, LinearExpr b)
Definition: IntegerExpressions.cs:272
static LinearExpr Sum(IEnumerable< ILiteral > literals)
Creates Sum(literals).
Definition: IntegerExpressions.cs:116
static LinearExpr operator-(LinearExpr a, LinearExpr b)
Definition: IntegerExpressions.cs:237
static LinearExpr WeightedSum(IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
Creates Sum(literals[i] * coeffs[i]).
Definition: IntegerExpressions.cs:146
static LinearExprBuilder NewBuilder(int sizeHint=2)
Creates a builder class for linear expression.
Definition: IntegerExpressions.cs:217
override string ToString()
Definition: IntegerExpressions.cs:844
LinearExpr NotAsExpr()
Returns the Boolean negation of the literal as a linear expression.
Definition: IntegerExpressions.cs:839
NotBoolVar(BoolVar boolvar)
Definition: IntegerExpressions.cs:817
Holds a Boolean variable or its negation.
Definition: IntegerExpressions.cs:26
LinearExpr NotAsExpr()
Returns the Boolean negation of the literal as a linear expression.
Definition: Constraints.cs:15
Definition: IntArrayHelper.cs:15
Definition: IntArrayHelper.cs:15
Definition: IntegerExpressions.cs:91