From 6f0ab6f38cdbdd8817f6d33cbc2fe614333ccefb Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Sun, 16 Jan 2022 15:46:15 +0100 Subject: [PATCH] more CP-SAT C# doc --- .clang-format | 410 ---- docs/dotnet/Constraints_8cs_source.html | 571 ++--- docs/dotnet/CpModel_8cs_source.html | 56 +- docs/dotnet/CpSolver_8cs.html | 2 +- docs/dotnet/CpSolver_8cs_source.html | 448 ++-- docs/dotnet/IntegerExpressions_8cs.html | 6 + .../dotnet/IntegerExpressions_8cs_source.html | 1837 ++++++++--------- docs/dotnet/IntervalVariables_8cs_source.html | 6 +- docs/dotnet/SearchHelpers_8cs.html | 2 + docs/dotnet/SearchHelpers_8cs_source.html | 206 +- docs/dotnet/annotated.html | 16 +- ...OrTools_1_1Sat_1_1AutomatonConstraint.html | 30 +- ...ssGoogle_1_1OrTools_1_1Sat_1_1BoolVar.html | 195 +- ...ols_1_1Sat_1_1BoundedLinearExpression.html | 38 +- ..._1OrTools_1_1Sat_1_1CircuitConstraint.html | 30 +- ...oogle_1_1OrTools_1_1Sat_1_1Constraint.html | 28 +- ...sGoogle_1_1OrTools_1_1Sat_1_1CpSolver.html | 64 +- ...ls_1_1Sat_1_1CpSolverSolutionCallback.html | 15 +- ...rTools_1_1Sat_1_1CumulativeConstraint.html | 32 +- ...assGoogle_1_1OrTools_1_1Sat_1_1IntVar.html | 184 +- ...ogle_1_1OrTools_1_1Sat_1_1IntervalVar.html | 4 +- ...oogle_1_1OrTools_1_1Sat_1_1LinearExpr.html | 146 +- ..._1OrTools_1_1Sat_1_1LinearExprBuilder.html | 234 ++- ...OrTools_1_1Sat_1_1LogCallbackDelegate.html | 6 +- ...s_1_1Sat_1_1MultipleCircuitConstraint.html | 30 +- ...Tools_1_1Sat_1_1NoOverlap2dConstraint.html | 30 +- ...oogle_1_1OrTools_1_1Sat_1_1NotBoolVar.html | 164 +- ...ls_1_1Sat_1_1ObjectiveSolutionPrinter.html | 19 +- ...OrTools_1_1Sat_1_1ReservoirConstraint.html | 40 +- ..._1_1OrTools_1_1Sat_1_1TableConstraint.html | 36 +- docs/dotnet/hierarchy.html | 18 +- docs/dotnet/inherit_graph_0.map | 2 +- docs/dotnet/inherit_graph_0.md5 | 2 +- docs/dotnet/inherit_graph_12.map | 10 +- docs/dotnet/inherit_graph_12.md5 | 2 +- docs/dotnet/inherit_graph_5.map | 2 +- docs/dotnet/inherit_graph_5.md5 | 2 +- docs/dotnet/inherit_graph_9.map | 4 +- docs/dotnet/inherit_graph_9.md5 | 2 +- docs/dotnet/inherits.html | 18 +- ...eGoogle_1_1OrTools_1_1Sat_1_1ILiteral.html | 14 +- .../namespaceGoogle_1_1OrTools_1_1Sat.html | 10 +- docs/dotnet/namespaces.html | 16 +- ...tructGoogle_1_1OrTools_1_1Sat_1_1Term.html | 8 +- ortools/sat/csharp/Constraints.cs | 12 +- ortools/sat/csharp/CpSolver.cs | 22 +- ortools/sat/csharp/IntegerExpressions.cs | 75 +- ortools/sat/csharp/IntervalVariables.cs | 2 +- ortools/sat/csharp/SearchHelpers.cs | 20 + 49 files changed, 2610 insertions(+), 2516 deletions(-) delete mode 100644 .clang-format diff --git a/.clang-format b/.clang-format deleted file mode 100644 index d217c1c24d..0000000000 --- a/.clang-format +++ /dev/null @@ -1,410 +0,0 @@ ---- -Language: CSharp -# BasedOnStyle: Microsoft -AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignArrayOfStructures: None -AlignConsecutiveMacros: None -AlignConsecutiveAssignments: None -AlignConsecutiveBitFields: None -AlignConsecutiveDeclarations: None -AlignEscapedNewlines: Right -AlignOperands: Align -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: false -AllowShortBlocksOnASingleLine: Never -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: MultiLine -AttributeMacros: - - __capability -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterCaseLabel: false - AfterClass: true - AfterControlStatement: Always - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: false - AfterExternBlock: true - BeforeCatch: true - BeforeElse: true - BeforeLambdaBody: false - BeforeWhile: false - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeConceptDeclarations: true -BreakBeforeBraces: Custom -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 120 -CommentPragmas: '^ IWYU pragma:' -QualifierAlignment: Leave -CompactNamespaces: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DeriveLineEnding: true -DerivePointerAlignment: false -DisableFormat: false -EmptyLineAfterAccessModifier: Never -EmptyLineBeforeAccessModifier: LogicalBlock -ExperimentalAutoDetectBinPacking: false -PackConstructorInitializers: BinPack -BasedOnStyle: '' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -AllowAllConstructorInitializersOnNextLine: true -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IfMacros: - - KJ_IF_MAYBE -IncludeBlocks: Preserve -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - SortPriority: 0 - CaseSensitive: false - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - SortPriority: 0 - CaseSensitive: false - - Regex: '.*' - Priority: 1 - SortPriority: 0 - CaseSensitive: false -IncludeIsMainRegex: '(Test)?$' -IncludeIsMainSourceRegex: '' -IndentAccessModifiers: false -IndentCaseLabels: false -IndentCaseBlocks: false -IndentGotoLabels: true -IndentPPDirectives: None -IndentExternBlock: AfterExternBlock -IndentRequires: false -IndentWidth: 4 -IndentWrappedFunctionNames: false -InsertTrailingCommas: None -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true -LambdaBodyIndentation: Signature -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCBreakBeforeNestedBlockParam: true -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 1000 -PenaltyIndentedWhitespace: 0 -PointerAlignment: Right -PPIndentWidth: -1 -ReferenceAlignment: Pointer -ReflowComments: true -ShortNamespaceLines: 1 -SortIncludes: CaseSensitive -SortJavaStaticImport: Before -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeParensOptions: - AfterControlStatements: true - AfterForeachMacros: true - AfterFunctionDefinitionName: false - AfterFunctionDeclarationName: false - AfterIfMacros: true - BeforeNonEmptyParentheses: false -SpaceAroundPointerQualifiers: Default -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: Never -SpacesInConditionalStatement: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInLineCommentPrefix: - Minimum: 1 - Maximum: -1 -SpacesInParentheses: false -SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -BitFieldColonSpacing: Both -Standard: Latest -StatementAttributeLikeMacros: - - Q_EMIT -StatementMacros: - - Q_UNUSED - - QT_REQUIRE_VERSION -TabWidth: 4 -UseCRLF: false -UseTab: Never -WhitespaceSensitiveMacros: - - STRINGIZE - - PP_STRINGIZE - - BOOST_PP_STRINGIZE - - NS_SWIFT_NAME - - CF_SWIFT_NAME -... - ---- -Language: Cpp -# BasedOnStyle: Google -AccessModifierOffset: -1 -AlignAfterOpenBracket: Align -AlignArrayOfStructures: None -AlignConsecutiveMacros: None -AlignConsecutiveAssignments: None -AlignConsecutiveBitFields: None -AlignConsecutiveDeclarations: None -AlignEscapedNewlines: Left -AlignOperands: Align -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true -AllowShortBlocksOnASingleLine: Never -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All -AllowShortLambdasOnASingleLine: All -AllowShortIfStatementsOnASingleLine: WithoutElse -AllowShortLoopsOnASingleLine: true -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: Yes -AttributeMacros: - - __capability -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: Never - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - BeforeLambdaBody: false - BeforeWhile: false - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeConceptDeclarations: true -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -QualifierAlignment: Leave -CompactNamespaces: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DeriveLineEnding: true -DerivePointerAlignment: true -DisableFormat: false -EmptyLineAfterAccessModifier: Never -EmptyLineBeforeAccessModifier: LogicalBlock -ExperimentalAutoDetectBinPacking: false -PackConstructorInitializers: NextLine -BasedOnStyle: '' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -AllowAllConstructorInitializersOnNextLine: true -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IfMacros: - - KJ_IF_MAYBE -IncludeBlocks: Regroup -IncludeCategories: - - Regex: '^' - Priority: 2 - SortPriority: 0 - CaseSensitive: false - - Regex: '^<.*\.h>' - Priority: 1 - SortPriority: 0 - CaseSensitive: false - - Regex: '^<.*' - Priority: 2 - SortPriority: 0 - CaseSensitive: false - - Regex: '.*' - Priority: 3 - SortPriority: 0 - CaseSensitive: false -IncludeIsMainRegex: '([-_](test|unittest))?$' -IncludeIsMainSourceRegex: '' -IndentAccessModifiers: false -IndentCaseLabels: true -IndentCaseBlocks: false -IndentGotoLabels: true -IndentPPDirectives: None -IndentExternBlock: AfterExternBlock -IndentRequires: false -IndentWidth: 2 -IndentWrappedFunctionNames: false -InsertTrailingCommas: None -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: false -LambdaBodyIndentation: Signature -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBinPackProtocolList: Never -ObjCBlockIndentWidth: 2 -ObjCBreakBeforeNestedBlockParam: true -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 1 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 200 -PenaltyIndentedWhitespace: 0 -PointerAlignment: Left -PPIndentWidth: -1 -RawStringFormats: - - Language: Cpp - Delimiters: - - cc - - CC - - cpp - - Cpp - - CPP - - 'c++' - - 'C++' - CanonicalDelimiter: '' - BasedOnStyle: google - - Language: TextProto - Delimiters: - - pb - - PB - - proto - - PROTO - EnclosingFunctions: - - EqualsProto - - EquivToProto - - PARSE_PARTIAL_TEXT_PROTO - - PARSE_TEST_PROTO - - PARSE_TEXT_PROTO - - ParseTextOrDie - - ParseTextProtoOrDie - - ParseTestProto - - ParsePartialTestProto - CanonicalDelimiter: pb - BasedOnStyle: google -ReferenceAlignment: Pointer -ReflowComments: true -ShortNamespaceLines: 1 -SortIncludes: CaseSensitive -SortJavaStaticImport: Before -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeParensOptions: - AfterControlStatements: true - AfterForeachMacros: true - AfterFunctionDefinitionName: false - AfterFunctionDeclarationName: false - AfterIfMacros: true - BeforeNonEmptyParentheses: false -SpaceAroundPointerQualifiers: Default -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 2 -SpacesInAngles: Never -SpacesInConditionalStatement: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInLineCommentPrefix: - Minimum: 1 - Maximum: -1 -SpacesInParentheses: false -SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -BitFieldColonSpacing: Both -Standard: Auto -StatementAttributeLikeMacros: - - Q_EMIT -StatementMacros: - - Q_UNUSED - - QT_REQUIRE_VERSION -TabWidth: 8 -UseCRLF: false -UseTab: Never -WhitespaceSensitiveMacros: - - STRINGIZE - - PP_STRINGIZE - - BOOST_PP_STRINGIZE - - NS_SWIFT_NAME - - CF_SWIFT_NAME -... - diff --git a/docs/dotnet/Constraints_8cs_source.html b/docs/dotnet/Constraints_8cs_source.html index 11e054689b..bde2d6cda8 100644 --- a/docs/dotnet/Constraints_8cs_source.html +++ b/docs/dotnet/Constraints_8cs_source.html @@ -102,269 +102,270 @@ $(document).ready(function(){initNavTree('Constraints_8cs_source.html',''); init
16using System;
17using System.Collections.Generic;
18using System.Linq;
-
19public class Constraint
-
28{
- -
30 {
-
31 index_ = model.Constraints.Count;
-
32 constraint_ = new ConstraintProto();
-
33 model.Constraints.Add(constraint_);
-
34 }
-
35
-
37 public void OnlyEnforceIf(ILiteral lit)
-
38 {
-
39 constraint_.EnforcementLiteral.Add(lit.GetIndex());
-
40 }
-
41
-
43 public void OnlyEnforceIf(ILiteral[] lits)
-
44 {
-
45 foreach (ILiteral lit in lits)
-
46 {
-
47 constraint_.EnforcementLiteral.Add(lit.GetIndex());
-
48 }
-
49 }
-
50
-
52 public int Index
-
53 {
-
54 get {
-
55 return index_;
-
56 }
-
57 }
-
58
- -
61 {
-
62 get {
-
63 return constraint_;
-
64 }
-
65 set {
-
66 constraint_ = value;
-
67 }
-
68 }
-
69
-
70 private int index_;
-
71 private ConstraintProto constraint_;
-
72}
-
73
- -
84{
-
85 public CircuitConstraint(CpModelProto model) : base(model)
-
86 {
-
87 }
-
88
-
98 public CircuitConstraint AddArc(int tail, int head, ILiteral literal)
-
99 {
- -
101 circuit.Tails.Add(tail);
-
102 circuit.Heads.Add(head);
-
103 circuit.Literals.Add(literal.GetIndex());
-
104 return this;
-
105 }
-
106}
-
107
- -
118{
-
119 public MultipleCircuitConstraint(CpModelProto model) : base(model)
-
120 {
-
121 }
-
122
-
132 public MultipleCircuitConstraint AddArc(int tail, int head, ILiteral literal)
-
133 {
- -
135 routes.Tails.Add(tail);
-
136 routes.Heads.Add(head);
-
137 routes.Literals.Add(literal.GetIndex());
-
138 return this;
-
139 }
-
140}
-
141
- -
151{
-
152 public TableConstraint(CpModelProto model) : base(model)
-
153 {
-
154 }
-
155
-
165 public TableConstraint AddTuple(IEnumerable<int> tuple)
-
166 {
- -
168
-
169 int count = 0;
-
170 foreach (int value in tuple)
-
171 {
-
172 table.Values.Add(value);
-
173 count++;
-
174 }
-
175 if (count != table.Vars.Count)
-
176 {
-
177 throw new ArgumentException("addTuple", "tuple does not have the same length as the variables");
-
178 }
-
179 return this;
-
180 }
-
181
-
191 public TableConstraint AddTuple(IEnumerable<long> tuple)
-
192 {
- -
194
-
195 int count = 0;
-
196 foreach (long value in tuple)
-
197 {
-
198 table.Values.Add(value);
-
199 count++;
-
200 }
-
201 if (count != table.Vars.Count)
-
202 {
-
203 throw new ArgumentException("addTuple", "tuple does not have the same length as the variables");
-
204 }
-
205 return this;
-
206 }
-
207
-
217 public TableConstraint AddTuples(int[,] tuples)
-
218 {
- -
220
-
221 if (tuples.GetLength(1) != table.Vars.Count)
-
222 {
-
223 throw new ArgumentException("addTuples", "tuples does not have the same length as the variables");
-
224 }
-
225
-
226 for (int i = 0; i < tuples.GetLength(0); ++i)
-
227 {
-
228 for (int j = 0; j < tuples.GetLength(1); ++j)
-
229 {
-
230 table.Values.Add(tuples[i, j]);
-
231 }
-
232 }
-
233 return this;
-
234 }
-
235
-
245 public TableConstraint AddTuples(long[,] tuples)
-
246 {
- -
248
-
249 if (tuples.GetLength(1) != table.Vars.Count)
-
250 {
-
251 throw new ArgumentException("addTuples", "tuples does not have the same length as the variables");
-
252 }
-
253
-
254 for (int i = 0; i < tuples.GetLength(0); ++i)
-
255 {
-
256 for (int j = 0; j < tuples.GetLength(1); ++j)
-
257 {
-
258 table.Values.Add(tuples[i, j]);
-
259 }
-
260 }
-
261 return this;
-
262 }
-
263}
-
264
- -
275{
-
276 public AutomatonConstraint(CpModelProto model) : base(model)
-
277 {
-
278 }
-
279
-
280 /*
-
281 * <summary>
-
282 * Adds a transitions to the automaton.
-
283 * </summary>
-
284 */
-
285 public AutomatonConstraint AddTransition(int tail, int head, long label)
-
286 {
- -
288 aut.TransitionTail.Add(tail);
-
289 aut.TransitionLabel.Add(label);
-
290 aut.TransitionHead.Add(head);
-
291 return this;
-
292 }
-
293}
-
294
- -
306{
-
307 public ReservoirConstraint(CpModel cp_model, CpModelProto model) : base(model)
-
308 {
-
309 this.cp_model_ = cp_model;
-
310 }
-
311
-
322 public ReservoirConstraint AddEvent<T, L>(T time, L level_change)
-
323 {
- -
325 res.TimeExprs.Add(cp_model_.GetLinearExpressionProto(cp_model_.GetLinearExpr(time)));
-
326 res.LevelChanges.Add(Convert.ToInt64(level_change));
-
327 res.ActiveLiterals.Add(cp_model_.TrueLiteral().GetIndex());
-
328 return this;
-
329 }
-
330
-
341 public ReservoirConstraint AddOptionalEvent<T, L>(T time, L level_change, ILiteral literal)
-
342 {
- -
344 res.TimeExprs.Add(cp_model_.GetLinearExpressionProto(cp_model_.GetLinearExpr(time)));
-
345 res.LevelChanges.Add(Convert.ToInt64(level_change));
-
346 res.ActiveLiterals.Add(literal.GetIndex());
-
347 return this;
-
348 }
-
349
-
350 private CpModel cp_model_;
-
351}
-
352
- -
364{
-
365 public CumulativeConstraint(CpModel cp_model, CpModelProto model) : base(model)
-
366 {
-
367 this.cp_model_ = cp_model;
-
368 }
-
369
- -
372 {
- -
374 cumul.Intervals.Add(interval.GetIndex());
-
375 LinearExpr demandExpr = cp_model_.GetLinearExpr(demand);
-
376 cumul.Demands.Add(cp_model_.GetLinearExpressionProto(demandExpr));
-
377 return this;
-
378 }
-
379
-
381 public CumulativeConstraint AddDemands<D>(IEnumerable<IntervalVar> intervals, IEnumerable<D> demands)
-
382 {
- -
384 foreach (var p in intervals.Zip(demands, (i, d) => new { Interval = i, Demand = d }))
-
385 {
-
386 cumul.Intervals.Add(p.Interval.GetIndex());
-
387 LinearExpr demandExpr = cp_model_.GetLinearExpr(p.Demand);
-
388 cumul.Demands.Add(cp_model_.GetLinearExpressionProto(demandExpr));
-
389 }
-
390 return this;
-
391 }
-
392
-
393 private CpModel cp_model_;
-
394}
-
395
- -
406{
-
407 public NoOverlap2dConstraint(CpModelProto model) : base(model)
-
408 {
-
409 }
-
410
- -
413 {
-
414 Proto.NoOverlap2D.XIntervals.Add(xInterval.GetIndex());
-
415 Proto.NoOverlap2D.YIntervals.Add(yInterval.GetIndex());
-
416 return this;
-
417 }
-
418}
-
419
-
420} // namespace Google.OrTools.Sat
+
19
+
28public class Constraint
+
29{
+ +
31 {
+
32 index_ = model.Constraints.Count;
+
33 constraint_ = new ConstraintProto();
+
34 model.Constraints.Add(constraint_);
+
35 }
+
36
+
38 public void OnlyEnforceIf(ILiteral lit)
+
39 {
+
40 constraint_.EnforcementLiteral.Add(lit.GetIndex());
+
41 }
+
42
+
44 public void OnlyEnforceIf(ILiteral[] lits)
+
45 {
+
46 foreach (ILiteral lit in lits)
+
47 {
+
48 constraint_.EnforcementLiteral.Add(lit.GetIndex());
+
49 }
+
50 }
+
51
+
53 public int Index
+
54 {
+
55 get {
+
56 return index_;
+
57 }
+
58 }
+
59
+ +
62 {
+
63 get {
+
64 return constraint_;
+
65 }
+
66 set {
+
67 constraint_ = value;
+
68 }
+
69 }
+
70
+
71 private int index_;
+
72 private ConstraintProto constraint_;
+
73}
+
74
+ +
85{
+
86 public CircuitConstraint(CpModelProto model) : base(model)
+
87 {
+
88 }
+
89
+
99 public CircuitConstraint AddArc(int tail, int head, ILiteral literal)
+
100 {
+ +
102 circuit.Tails.Add(tail);
+
103 circuit.Heads.Add(head);
+
104 circuit.Literals.Add(literal.GetIndex());
+
105 return this;
+
106 }
+
107}
+
108
+ +
119{
+
120 public MultipleCircuitConstraint(CpModelProto model) : base(model)
+
121 {
+
122 }
+
123
+
133 public MultipleCircuitConstraint AddArc(int tail, int head, ILiteral literal)
+
134 {
+ +
136 routes.Tails.Add(tail);
+
137 routes.Heads.Add(head);
+
138 routes.Literals.Add(literal.GetIndex());
+
139 return this;
+
140 }
+
141}
+
142
+ +
152{
+
153 public TableConstraint(CpModelProto model) : base(model)
+
154 {
+
155 }
+
156
+
166 public TableConstraint AddTuple(IEnumerable<int> tuple)
+
167 {
+ +
169
+
170 int count = 0;
+
171 foreach (int value in tuple)
+
172 {
+
173 table.Values.Add(value);
+
174 count++;
+
175 }
+
176 if (count != table.Vars.Count)
+
177 {
+
178 throw new ArgumentException("addTuple", "tuple does not have the same length as the variables");
+
179 }
+
180 return this;
+
181 }
+
182
+
192 public TableConstraint AddTuple(IEnumerable<long> tuple)
+
193 {
+ +
195
+
196 int count = 0;
+
197 foreach (long value in tuple)
+
198 {
+
199 table.Values.Add(value);
+
200 count++;
+
201 }
+
202 if (count != table.Vars.Count)
+
203 {
+
204 throw new ArgumentException("addTuple", "tuple does not have the same length as the variables");
+
205 }
+
206 return this;
+
207 }
+
208
+
218 public TableConstraint AddTuples(int[,] tuples)
+
219 {
+ +
221
+
222 if (tuples.GetLength(1) != table.Vars.Count)
+
223 {
+
224 throw new ArgumentException("addTuples", "tuples does not have the same length as the variables");
+
225 }
+
226
+
227 for (int i = 0; i < tuples.GetLength(0); ++i)
+
228 {
+
229 for (int j = 0; j < tuples.GetLength(1); ++j)
+
230 {
+
231 table.Values.Add(tuples[i, j]);
+
232 }
+
233 }
+
234 return this;
+
235 }
+
236
+
246 public TableConstraint AddTuples(long[,] tuples)
+
247 {
+ +
249
+
250 if (tuples.GetLength(1) != table.Vars.Count)
+
251 {
+
252 throw new ArgumentException("addTuples", "tuples does not have the same length as the variables");
+
253 }
+
254
+
255 for (int i = 0; i < tuples.GetLength(0); ++i)
+
256 {
+
257 for (int j = 0; j < tuples.GetLength(1); ++j)
+
258 {
+
259 table.Values.Add(tuples[i, j]);
+
260 }
+
261 }
+
262 return this;
+
263 }
+
264}
+
265
+ +
276{
+
277 public AutomatonConstraint(CpModelProto model) : base(model)
+
278 {
+
279 }
+
280
+
281 /*
+
282 * <summary>
+
283 * Adds a transitions to the automaton.
+
284 * </summary>
+
285 */
+
286 public AutomatonConstraint AddTransition(int tail, int head, long label)
+
287 {
+ +
289 aut.TransitionTail.Add(tail);
+
290 aut.TransitionLabel.Add(label);
+
291 aut.TransitionHead.Add(head);
+
292 return this;
+
293 }
+
294}
+
295
+ +
307{
+
308 public ReservoirConstraint(CpModel cp_model, CpModelProto model) : base(model)
+
309 {
+
310 this.cp_model_ = cp_model;
+
311 }
+
312
+
323 public ReservoirConstraint AddEvent<T, L>(T time, L level_change)
+
324 {
+ +
326 res.TimeExprs.Add(cp_model_.GetLinearExpressionProto(cp_model_.GetLinearExpr(time)));
+
327 res.LevelChanges.Add(Convert.ToInt64(level_change));
+
328 res.ActiveLiterals.Add(cp_model_.TrueLiteral().GetIndex());
+
329 return this;
+
330 }
+
331
+
342 public ReservoirConstraint AddOptionalEvent<T, L>(T time, L level_change, ILiteral literal)
+
343 {
+ +
345 res.TimeExprs.Add(cp_model_.GetLinearExpressionProto(cp_model_.GetLinearExpr(time)));
+
346 res.LevelChanges.Add(Convert.ToInt64(level_change));
+
347 res.ActiveLiterals.Add(literal.GetIndex());
+
348 return this;
+
349 }
+
350
+
351 private CpModel cp_model_;
+
352}
+
353
+ +
365{
+
366 public CumulativeConstraint(CpModel cp_model, CpModelProto model) : base(model)
+
367 {
+
368 this.cp_model_ = cp_model;
+
369 }
+
370
+ +
373 {
+ +
375 cumul.Intervals.Add(interval.GetIndex());
+
376 LinearExpr demandExpr = cp_model_.GetLinearExpr(demand);
+
377 cumul.Demands.Add(cp_model_.GetLinearExpressionProto(demandExpr));
+
378 return this;
+
379 }
+
380
+
382 public CumulativeConstraint AddDemands<D>(IEnumerable<IntervalVar> intervals, IEnumerable<D> demands)
+
383 {
+ +
385 foreach (var p in intervals.Zip(demands, (i, d) => new { Interval = i, Demand = d }))
+
386 {
+
387 cumul.Intervals.Add(p.Interval.GetIndex());
+
388 LinearExpr demandExpr = cp_model_.GetLinearExpr(p.Demand);
+
389 cumul.Demands.Add(cp_model_.GetLinearExpressionProto(demandExpr));
+
390 }
+
391 return this;
+
392 }
+
393
+
394 private CpModel cp_model_;
+
395}
+
396
+ +
407{
+
408 public NoOverlap2dConstraint(CpModelProto model) : base(model)
+
409 {
+
410 }
+
411
+ +
414 {
+
415 Proto.NoOverlap2D.XIntervals.Add(xInterval.GetIndex());
+
416 Proto.NoOverlap2D.YIntervals.Add(yInterval.GetIndex());
+
417 return this;
+
418 }
+
419}
+
420
+
421} // namespace Google.OrTools.Sat
This constraint forces a sequence of variables to be accepted by an automaton.
Definition: CpModel.pb.cs:4243
pbc::RepeatedField< long > TransitionTail
List of transitions (all 3 vectors have the same size).
Definition: CpModel.pb.cs:4328
pbc::RepeatedField< long > TransitionLabel
Definition: CpModel.pb.cs:4350
pbc::RepeatedField< long > TransitionHead
Definition: CpModel.pb.cs:4339
-
Specialized automaton constraint.
Definition: Constraints.cs:275
-
AutomatonConstraint(CpModelProto model)
Definition: Constraints.cs:276
-
AutomatonConstraint AddTransition(int tail, int head, long label)
Definition: Constraints.cs:285
+
Specialized automaton constraint.
Definition: Constraints.cs:276
+
AutomatonConstraint(CpModelProto model)
Definition: Constraints.cs:277
+
AutomatonConstraint AddTransition(int tail, int head, long label)
Definition: Constraints.cs:286
The circuit constraint is defined on a graph where the arc presence are controlled by literals.
Definition: CpModel.pb.cs:3203
pbc::RepeatedField< int > Literals
Definition: CpModel.pb.cs:3274
-
Specialized circuit constraint.
Definition: Constraints.cs:84
-
CircuitConstraint AddArc(int tail, int head, ILiteral literal)
Add an arc to the graph of the circuit constraint.
Definition: Constraints.cs:98
-
CircuitConstraint(CpModelProto model)
Definition: Constraints.cs:85
+
Specialized circuit constraint.
Definition: Constraints.cs:85
+
CircuitConstraint AddArc(int tail, int head, ILiteral literal)
Add an arc to the graph of the circuit constraint.
Definition: Constraints.cs:99
+
CircuitConstraint(CpModelProto model)
Definition: Constraints.cs:86
pbc::RepeatedField< int > EnforcementLiteral
The constraint will be enforced iff all literals listed here are true.
Definition: CpModel.pb.cs:4923
global::Google.OrTools.Sat.NoOverlap2DConstraintProto NoOverlap2D
The no_overlap_2d constraint prevents a set of boxes from overlapping.
Definition: CpModel.pb.cs:5284
@@ -374,12 +375,12 @@ $(document).ready(function(){initNavTree('Constraints_8cs_source.html',''); init
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
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
global::Google.OrTools.Sat.RoutesConstraintProto Routes
The routes constraint implements the vehicle routing problem.
Definition: CpModel.pb.cs:5171
-
Wrapper around a ConstraintProto.
Definition: Constraints.cs:28
-
int Index
The index of the constraint in the model
Definition: Constraints.cs:53
-
void OnlyEnforceIf(ILiteral[] lits)
Adds a list of literals to the constraint
Definition: Constraints.cs:43
-
void OnlyEnforceIf(ILiteral lit)
Adds a literal to the constraint
Definition: Constraints.cs:37
-
ConstraintProto Proto
The underlying constraint proto
Definition: Constraints.cs:61
-
Constraint(CpModelProto model)
Definition: Constraints.cs:29
+
Wrapper around a ConstraintProto.
Definition: Constraints.cs:29
+
int Index
The index of the constraint in the model.
Definition: Constraints.cs:54
+
void OnlyEnforceIf(ILiteral[] lits)
Adds a list of literals to the constraint.
Definition: Constraints.cs:44
+
void OnlyEnforceIf(ILiteral lit)
Adds a literal to the constraint.
Definition: Constraints.cs:38
+
ConstraintProto Proto
The underlying constraint proto.
Definition: Constraints.cs:62
+
Constraint(CpModelProto model)
Definition: Constraints.cs:30
A constraint programming problem.
Definition: CpModel.pb.cs:8643
pbc::RepeatedField< global::Google.OrTools.Sat.ConstraintProto > Constraints
Definition: CpModel.pb.cs:8727
Wrapper class around the cp_model proto.
Definition: CpModel.cs:24
@@ -389,29 +390,29 @@ $(document).ready(function(){initNavTree('Constraints_8cs_source.html',''); init
The sum of the demands of the intervals at each interval point cannot exceed a capacity.
Definition: CpModel.pb.cs:2606
pbc::RepeatedField< global::Google.OrTools.Sat.LinearExpressionProto > Demands
Same size as intervals.
Definition: CpModel.pb.cs:2681
-
Specialized cumulative constraint.
Definition: Constraints.cs:364
-
CumulativeConstraint(CpModel cp_model, CpModelProto model)
Definition: Constraints.cs:365
-
CumulativeConstraint AddDemand< D >(IntervalVar interval, D demand)
Adds a pair (interval, demand) to the constraint.
Definition: Constraints.cs:371
-
CumulativeConstraint AddDemands< D >(IEnumerable< IntervalVar > intervals, IEnumerable< D > demands)
Adds all pairs (interval, demand) to the constraint.
Definition: Constraints.cs:381
+
Specialized cumulative constraint.
Definition: Constraints.cs:365
+
CumulativeConstraint(CpModel cp_model, CpModelProto model)
Definition: Constraints.cs:366
+
CumulativeConstraint AddDemand< D >(IntervalVar interval, D demand)
Adds a pair (interval, demand) to the constraint.
Definition: Constraints.cs:372
+
CumulativeConstraint AddDemands< D >(IEnumerable< IntervalVar > intervals, IEnumerable< D > demands)
Adds all pairs (interval, demand) to the constraint.
Definition: Constraints.cs:382
-
int GetIndex()
The Indexraint in the model proto
- -
Specialized multiple circuit constraint.
Definition: Constraints.cs:118
-
MultipleCircuitConstraint AddArc(int tail, int head, ILiteral literal)
Add an arc to the graph of the multiple circuit constraint.
Definition: Constraints.cs:132
- +
int GetIndex()
The Index of the interval in the model proto
+
Holds a linear expression: sum (ai * xi) + b.
+
Specialized multiple circuit constraint.
Definition: Constraints.cs:119
+
MultipleCircuitConstraint AddArc(int tail, int head, ILiteral literal)
Add an arc to the graph of the multiple circuit constraint.
Definition: Constraints.cs:133
+
pbc::RepeatedField< int > YIntervals
Same size as x_intervals.
Definition: CpModel.pb.cs:2412
-
Specialized NoOverlap2D constraint.
Definition: Constraints.cs:406
- -
NoOverlap2dConstraint AddRectangle(IntervalVar xInterval, IntervalVar yInterval)
Adds a rectangle (xInterval, yInterval) to the constraint.
Definition: Constraints.cs:412
+
Specialized NoOverlap2D constraint.
Definition: Constraints.cs:407
+ +
NoOverlap2dConstraint AddRectangle(IntervalVar xInterval, IntervalVar yInterval)
Adds a rectangle (xInterval, yInterval) to the constraint.
Definition: Constraints.cs:413
Maintain a reservoir level within bounds.
Definition: CpModel.pb.cs:2878
pbc::RepeatedField< long > LevelChanges
constants, can be negative.
Definition: CpModel.pb.cs:2970
pbc::RepeatedField< int > ActiveLiterals
Definition: CpModel.pb.cs:2981
pbc::RepeatedField< global::Google.OrTools.Sat.LinearExpressionProto > TimeExprs
affine expressions.
Definition: CpModel.pb.cs:2956
-
Specialized reservoir constraint.
Definition: Constraints.cs:306
-
ReservoirConstraint(CpModel cp_model, CpModelProto model)
Definition: Constraints.cs:307
-
ReservoirConstraint AddEvent< T, L >(T time, L level_change)
Adds a mandatory event
Definition: Constraints.cs:322
-
ReservoirConstraint AddOptionalEvent< T, L >(T time, L level_change, ILiteral literal)
Adds an optional event
Definition: Constraints.cs:341
+
Specialized reservoir constraint.
Definition: Constraints.cs:307
+
ReservoirConstraint(CpModel cp_model, CpModelProto model)
Definition: Constraints.cs:308
+
ReservoirConstraint AddEvent< T, L >(T time, L level_change)
Adds a mandatory event.
Definition: Constraints.cs:323
+
ReservoirConstraint AddOptionalEvent< T, L >(T time, L level_change, ILiteral literal)
Adds an optional event.
Definition: Constraints.cs:342
The "VRP" (Vehicle Routing Problem) constraint.
Definition: CpModel.pb.cs:3461
pbc::RepeatedField< int > Literals
Definition: CpModel.pb.cs:3534
pbc::RepeatedField< int > Tails
Definition: CpModel.pb.cs:3512
@@ -419,14 +420,14 @@ $(document).ready(function(){initNavTree('Constraints_8cs_source.html',''); init
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:3778
pbc::RepeatedField< long > Values
Definition: CpModel.pb.cs:3838
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:3827
-
Specialized assignment constraint.
Definition: Constraints.cs:151
-
TableConstraint AddTuples(int[,] tuples)
Adds a set of tuples of possible/forbidden values to the constraint.
Definition: Constraints.cs:217
-
TableConstraint AddTuple(IEnumerable< long > tuple)
Adds a tuple of possible/forbidden values to the constraint.
Definition: Constraints.cs:191
-
TableConstraint(CpModelProto model)
Definition: Constraints.cs:152
-
TableConstraint AddTuple(IEnumerable< int > tuple)
Adds a tuple of possible/forbidden values to the constraint.
Definition: Constraints.cs:165
-
TableConstraint AddTuples(long[,] tuples)
Adds a set of tuples of possible/forbidden values to the constraint.
Definition: Constraints.cs:245
- - +
Specialized assignment constraint.
Definition: Constraints.cs:152
+
TableConstraint AddTuples(int[,] tuples)
Adds a set of tuples of possible/forbidden values to the constraint.
Definition: Constraints.cs:218
+
TableConstraint AddTuple(IEnumerable< long > tuple)
Adds a tuple of possible/forbidden values to the constraint.
Definition: Constraints.cs:192
+
TableConstraint(CpModelProto model)
Definition: Constraints.cs:153
+
TableConstraint AddTuple(IEnumerable< int > tuple)
Adds a tuple of possible/forbidden values to the constraint.
Definition: Constraints.cs:166
+
TableConstraint AddTuples(long[,] tuples)
Adds a set of tuples of possible/forbidden values to the constraint.
Definition: Constraints.cs:246
+
Holds a Boolean variable or its negation.
+
int GetIndex()
Returns the logical index of the literal.
diff --git a/docs/dotnet/CpModel_8cs_source.html b/docs/dotnet/CpModel_8cs_source.html index 5f62a1754c..dec116b5b1 100644 --- a/docs/dotnet/CpModel_8cs_source.html +++ b/docs/dotnet/CpModel_8cs_source.html @@ -893,19 +893,19 @@ $(document).ready(function(){initNavTree('CpModel_8cs_source.html',''); initResi
pbc::RepeatedField< global::Google.OrTools.Sat.LinearExpressionProto > Exprs
Definition: CpModel.pb.cs:1218
This constraint forces a sequence of variables to be accepted by an automaton.
Definition: CpModel.pb.cs:4243
pbc::RepeatedField< int > Vars
The sequence of variables.
Definition: CpModel.pb.cs:4365
-
Specialized automaton constraint.
Definition: Constraints.cs:275
+
Specialized automaton constraint.
Definition: Constraints.cs:276
Argument of the constraints of the form OP(literals).
Definition: CpModel.pb.cs:514
pbc::RepeatedField< int > Literals
Definition: CpModel.pb.cs:561
- - - - - - - - +
Holds a Boolean variable.
+
Holds a linear constraint: expression ∈ domain
+ + + + + +
The circuit constraint is defined on a graph where the arc presence are controlled by literals.
Definition: CpModel.pb.cs:3203
-
Specialized circuit constraint.
Definition: Constraints.cs:84
+
Specialized circuit constraint.
Definition: Constraints.cs:85
pbc::RepeatedField< int > EnforcementLiteral
The constraint will be enforced iff all literals listed here are true.
Definition: CpModel.pb.cs:4923
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
@@ -929,9 +929,9 @@ $(document).ready(function(){initNavTree('CpModel_8cs_source.html',''); initResi
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
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
global::Google.OrTools.Sat.RoutesConstraintProto Routes
The routes constraint implements the vehicle routing problem.
Definition: CpModel.pb.cs:5171
-
Wrapper around a ConstraintProto.
Definition: Constraints.cs:28
-
void OnlyEnforceIf(ILiteral lit)
Adds a literal to the constraint
Definition: Constraints.cs:37
-
ConstraintProto Proto
The underlying constraint proto
Definition: Constraints.cs:61
+
Wrapper around a ConstraintProto.
Definition: Constraints.cs:29
+
void OnlyEnforceIf(ILiteral lit)
Adds a literal to the constraint.
Definition: Constraints.cs:38
+
ConstraintProto Proto
The underlying constraint proto.
Definition: Constraints.cs:62
A constraint programming problem.
Definition: CpModel.pb.cs:8643
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
global::Google.OrTools.Sat.PartialVariableAssignment SolutionHint
Solution hint.
Definition: CpModel.pb.cs:8813
@@ -1008,7 +1008,7 @@ $(document).ready(function(){initNavTree('CpModel_8cs_source.html',''); initResi
static string ModelStats(Google.OrTools.Sat.CpModelProto model_proto)
Definition: CpSatHelper.cs:49
The sum of the demands of the intervals at each interval point cannot exceed a capacity.
Definition: CpModel.pb.cs:2606
global::Google.OrTools.Sat.LinearExpressionProto Capacity
Definition: CpModel.pb.cs:2653
-
Specialized cumulative constraint.
Definition: Constraints.cs:364
+
Specialized cumulative constraint.
Definition: Constraints.cs:365
Container for nested types declared in the DecisionStrategyProto message type.
Definition: CpModel.pb.cs:7412
VariableSelectionStrategy
The order in which the variables above should be considered.
Definition: CpModel.pb.cs:7419
DomainReductionStrategy
Once a variable has been chosen, this enum describe what decision is taken on its domain.
Definition: CpModel.pb.cs:7433
@@ -1017,9 +1017,9 @@ $(document).ready(function(){initNavTree('CpModel_8cs_source.html',''); initResi
The constraint target = vars[index].
Definition: CpModel.pb.cs:1600
- - - +
Holds a integer variable with a discrete domain.
+
int GetIndex()
Returns the index of the variable in the underlying CpModelProto.
+
int Index
Returns the index of the variable in the underlying CpModelProto.
The two arrays of variable each represent a function, the second is the inverse of the first: f_direc...
Definition: CpModel.pb.cs:4031
pbc::RepeatedField< int > FDirect
Definition: CpModel.pb.cs:4079
@@ -1030,16 +1030,16 @@ $(document).ready(function(){initNavTree('CpModel_8cs_source.html',''); initResi
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:1406
pbc::RepeatedField< long > Coeffs
Same size as vars.
Definition: CpModel.pb.cs:1420
pbc::RepeatedField< long > Domain
Definition: CpModel.pb.cs:1431
- -
static LinearExpr Constant(long value)
-
static LinearExpr Sum(IEnumerable< LinearExpr > exprs)
-
static long GetVarValueMap(LinearExpr e, long initial_coeff, Dictionary< IntVar, long > dict)
+
Holds a linear expression: sum (ai * xi) + b.
+
static LinearExpr Constant(long value)
Creates a constant expression.
+
static LinearExpr Sum(IEnumerable< LinearExpr > exprs)
Creates Sum(exprs).
+
static long GetVarValueMap(LinearExpr e, long initial_coeff, Dictionary< IntVar, long > dict)
Some constraints supports linear expression instead of just using a reference to a variable.
Definition: CpModel.pb.cs:699
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:748
pbc::RepeatedField< long > Coeffs
Definition: CpModel.pb.cs:759
-
Specialized multiple circuit constraint.
Definition: Constraints.cs:118
+
Specialized multiple circuit constraint.
Definition: Constraints.cs:119
The boxes defined by [start_x, end_x) * [start_y, end_y) cannot overlap.
Definition: CpModel.pb.cs:2349
-
Specialized NoOverlap2D constraint.
Definition: Constraints.cs:406
+
Specialized NoOverlap2D constraint.
Definition: Constraints.cs:407
All the intervals (index of IntervalConstraintProto) must be disjoint.
Definition: CpModel.pb.cs:2164
This message encodes a partial (or full) assignment of the variables of a CpModelProto.
Definition: CpModel.pb.cs:7724
@@ -1048,17 +1048,17 @@ $(document).ready(function(){initNavTree('CpModel_8cs_source.html',''); initResi
Maintain a reservoir level within bounds.
Definition: CpModel.pb.cs:2878
-
Specialized reservoir constraint.
Definition: Constraints.cs:306
+
Specialized reservoir constraint.
Definition: Constraints.cs:307
The "VRP" (Vehicle Routing Problem) constraint.
Definition: CpModel.pb.cs:3461
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:3778
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:3827
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
-
Specialized assignment constraint.
Definition: Constraints.cs:151
+
Specialized assignment constraint.
Definition: Constraints.cs:152
- - - +
Holds a Boolean variable or its negation.
+
int GetIndex()
Returns the logical index of the literal.
+
ILiteral Not()
Returns the Boolean negation of the literal.
diff --git a/docs/dotnet/CpSolver_8cs.html b/docs/dotnet/CpSolver_8cs.html index 93e93a0ccd..051b2c4e50 100644 --- a/docs/dotnet/CpSolver_8cs.html +++ b/docs/dotnet/CpSolver_8cs.html @@ -93,7 +93,7 @@ $(document).ready(function(){initNavTree('CpSolver_8cs.html',''); initResizable(

Classes

class  CpSolver - Wrapper around the SAT solver More...
+ Wrapper around the SAT solver. More...
  class  LogCallbackDelegate   diff --git a/docs/dotnet/CpSolver_8cs_source.html b/docs/dotnet/CpSolver_8cs_source.html index c0141327d9..e6f3c879ac 100644 --- a/docs/dotnet/CpSolver_8cs_source.html +++ b/docs/dotnet/CpSolver_8cs_source.html @@ -134,200 +134,200 @@ $(document).ready(function(){initNavTree('CpSolver_8cs_source.html',''); initRes
58 return response_.Status;
59 }
60
-
61 [ObsoleteAttribute("This method is obsolete. Call Solve instead.", false)]
- -
63 {
-
64 return Solve(model, cb);
-
65 }
-
66
-
67 [ObsoleteAttribute("This method is obsolete. Call Solve instead with the enumerate_all_solutions parameter.", false)]
- -
69 {
-
70 string old_parameters = string_parameters_;
-
71 string_parameters_ += " enumerate_all_solutions:true";
-
72 Solve(model, cb);
-
73 string_parameters_ = old_parameters;
-
74 return response_.Status;
-
75 }
-
76
-
77 [MethodImpl(MethodImplOptions.Synchronized)]
-
79 public void StopSearch()
-
80 {
-
81 if (solve_wrapper_ is not null)
-
82 {
-
83 solve_wrapper_.StopSearch();
-
84 }
-
85 }
-
86
-
87 [MethodImpl(MethodImplOptions.Synchronized)]
-
88 private void CreateSolveWrapper()
-
89 {
-
90 solve_wrapper_ = new SolveWrapper();
-
91 }
-
92
-
93 [MethodImpl(MethodImplOptions.Synchronized)]
-
94 private void ReleaseSolveWrapper()
-
95 {
-
96 solve_wrapper_ = null;
-
97 }
-
98
-
100 public String ResponseStats()
-
101 {
-
102 return CpSatHelper.SolverResponseStats(response_);
-
103 }
-
104
-
106 public double ObjectiveValue
-
107 {
-
108 get {
-
109 return response_.ObjectiveValue;
-
110 }
-
111 }
-
112
-
118 public double BestObjectiveBound
-
119 {
-
120 get {
-
121 return response_.BestObjectiveBound;
-
122 }
-
123 }
-
124
-
126 public string StringParameters
-
127 {
-
128 get {
-
129 return string_parameters_;
-
130 }
-
131 set {
-
132 string_parameters_ = value;
-
133 }
-
134 }
-
135
- -
137 {
-
138 log_callback_ = new LogCallbackDelegate(del);
-
139 }
-
140
- -
142 {
-
143 get {
-
144 return response_;
-
145 }
-
146 }
-
147
-
153 public long Value(LinearExpr e)
-
154 {
-
155 List<Term> terms = new List<Term>();
-
156 terms.Add(new Term(e, 1));
-
157 long constant = 0;
-
158
-
159 while (terms.Count > 0)
-
160 {
-
161 Term term = terms[0];
-
162 terms.RemoveAt(0);
-
163 if (term.coefficient == 0)
-
164 {
-
165 continue;
-
166 }
-
167
-
168 if (term.expr is LinearExprBuilder a)
-
169 {
-
170 constant += term.coefficient * a.Offset;
-
171 foreach (Term sub in a.Terms)
-
172 {
-
173 if (term.coefficient == 1)
-
174 {
-
175 terms.Add(sub);
-
176 }
-
177 else
-
178 {
-
179 terms.Add(new Term(sub.expr, sub.coefficient * term.coefficient));
-
180 }
-
181 }
-
182 }
-
183 else if (term.expr is IntVar intVar)
-
184 {
-
185 int index = intVar.GetIndex();
-
186 long value = index >= 0 ? response_.Solution[index] : -response_.Solution[-index - 1];
-
187 constant += term.coefficient * value;
-
188 }
-
189 else if (term.expr is NotBoolVar)
-
190 {
-
191 throw new ArgumentException("Cannot evaluate a literal in an integer expression.");
-
192 }
-
193 else
-
194 {
-
195 throw new ArgumentException("Cannot evaluate '" + term.expr.ToString() + "' in an integer expression");
-
196 }
-
197 }
-
198 return constant;
-
199 }
-
200
-
206 public Boolean BooleanValue(ILiteral literal)
-
207 {
-
208 if (literal is BoolVar || literal is NotBoolVar)
-
209 {
-
210 int index = literal.GetIndex();
-
211 if (index >= 0)
-
212 {
-
213 return response_.Solution[index] != 0;
-
214 }
-
215 else
-
216 {
-
217 return response_.Solution[-index - 1] == 0;
-
218 }
-
219 }
-
220 else
-
221 {
-
222 throw new ArgumentException("Cannot evaluate '" + literal.ToString() + "' as a boolean literal");
-
223 }
-
224 }
-
225
-
227 public long NumBranches()
-
228 {
-
229 return response_.NumBranches;
-
230 }
-
231
-
233 public long NumConflicts()
-
234 {
-
235 return response_.NumConflicts;
-
236 }
-
237
-
239 public double WallTime()
-
240 {
-
241 return response_.WallTime;
-
242 }
-
243
- -
245 {
- -
247 }
-
248
-
253 public String SolutionInfo()
-
254 {
-
255 return response_.SolutionInfo;
-
256 }
-
257
-
258 private CpSolverResponse response_;
-
259 private LogCallback log_callback_;
-
260 private string string_parameters_;
-
261 private SolveWrapper solve_wrapper_;
-
262}
-
263
- -
265{
- -
267 {
-
268 this.delegate_ = del;
-
269 }
-
270
-
271 public override void NewMessage(string message)
-
272 {
-
273 delegate_(message);
-
274 }
-
275
-
276 private StringToVoidDelegate delegate_;
-
277}
-
278
-
279} // namespace Google.OrTools.Sat
- +
62 [ObsoleteAttribute("This method is obsolete. Call Solve instead.", false)]
+ +
64 {
+
65 return Solve(model, cb);
+
66 }
+
67
+
69 [ObsoleteAttribute("This method is obsolete. Call Solve instead with the enumerate_all_solutions parameter.", false)]
+ +
71 {
+
72 string old_parameters = string_parameters_;
+
73 string_parameters_ += " enumerate_all_solutions:true";
+
74 Solve(model, cb);
+
75 string_parameters_ = old_parameters;
+
76 return response_.Status;
+
77 }
+
78
+
80 [MethodImpl(MethodImplOptions.Synchronized)]
+
81 public void StopSearch()
+
82 {
+
83 if (solve_wrapper_ is not null)
+
84 {
+
85 solve_wrapper_.StopSearch();
+
86 }
+
87 }
+
88
+
89 [MethodImpl(MethodImplOptions.Synchronized)]
+
90 private void CreateSolveWrapper()
+
91 {
+
92 solve_wrapper_ = new SolveWrapper();
+
93 }
+
94
+
95 [MethodImpl(MethodImplOptions.Synchronized)]
+
96 private void ReleaseSolveWrapper()
+
97 {
+
98 solve_wrapper_ = null;
+
99 }
+
100
+
102 public String ResponseStats()
+
103 {
+
104 return CpSatHelper.SolverResponseStats(response_);
+
105 }
+
106
+
108 public double ObjectiveValue
+
109 {
+
110 get {
+
111 return response_.ObjectiveValue;
+
112 }
+
113 }
+
114
+
120 public double BestObjectiveBound
+
121 {
+
122 get {
+
123 return response_.BestObjectiveBound;
+
124 }
+
125 }
+
126
+
128 public string StringParameters
+
129 {
+
130 get {
+
131 return string_parameters_;
+
132 }
+
133 set {
+
134 string_parameters_ = value;
+
135 }
+
136 }
+
137
+ +
139 {
+
140 log_callback_ = new LogCallbackDelegate(del);
+
141 }
+
142
+ +
144 {
+
145 get {
+
146 return response_;
+
147 }
+
148 }
+
149
+
155 public long Value(LinearExpr e)
+
156 {
+
157 List<Term> terms = new List<Term>();
+
158 terms.Add(new Term(e, 1));
+
159 long constant = 0;
+
160
+
161 while (terms.Count > 0)
+
162 {
+
163 Term term = terms[0];
+
164 terms.RemoveAt(0);
+
165 if (term.coefficient == 0)
+
166 {
+
167 continue;
+
168 }
+
169
+
170 if (term.expr is LinearExprBuilder a)
+
171 {
+
172 constant += term.coefficient * a.Offset;
+
173 foreach (Term sub in a.Terms)
+
174 {
+
175 if (term.coefficient == 1)
+
176 {
+
177 terms.Add(sub);
+
178 }
+
179 else
+
180 {
+
181 terms.Add(new Term(sub.expr, sub.coefficient * term.coefficient));
+
182 }
+
183 }
+
184 }
+
185 else if (term.expr is IntVar intVar)
+
186 {
+
187 int index = intVar.GetIndex();
+
188 long value = index >= 0 ? response_.Solution[index] : -response_.Solution[-index - 1];
+
189 constant += term.coefficient * value;
+
190 }
+
191 else if (term.expr is NotBoolVar)
+
192 {
+
193 throw new ArgumentException("Cannot evaluate a literal in an integer expression.");
+
194 }
+
195 else
+
196 {
+
197 throw new ArgumentException("Cannot evaluate '" + term.expr.ToString() + "' in an integer expression");
+
198 }
+
199 }
+
200 return constant;
+
201 }
+
202
+
208 public Boolean BooleanValue(ILiteral literal)
+
209 {
+
210 if (literal is BoolVar || literal is NotBoolVar)
+
211 {
+
212 int index = literal.GetIndex();
+
213 if (index >= 0)
+
214 {
+
215 return response_.Solution[index] != 0;
+
216 }
+
217 else
+
218 {
+
219 return response_.Solution[-index - 1] == 0;
+
220 }
+
221 }
+
222 else
+
223 {
+
224 throw new ArgumentException("Cannot evaluate '" + literal.ToString() + "' as a boolean literal");
+
225 }
+
226 }
+
227
+
229 public long NumBranches()
+
230 {
+
231 return response_.NumBranches;
+
232 }
+
233
+
235 public long NumConflicts()
+
236 {
+
237 return response_.NumConflicts;
+
238 }
+
239
+
241 public double WallTime()
+
242 {
+
243 return response_.WallTime;
+
244 }
+
245
+ +
247 {
+ +
249 }
+
250
+
257 public String SolutionInfo()
+
258 {
+
259 return response_.SolutionInfo;
+
260 }
+
261
+
262 private CpSolverResponse response_;
+
263 private LogCallback log_callback_;
+
264 private string string_parameters_;
+
265 private SolveWrapper solve_wrapper_;
+
266}
+
267
+ +
269{
+ +
271 {
+
272 this.delegate_ = del;
+
273 }
+
274
+
275 public override void NewMessage(string message)
+
276 {
+
277 delegate_(message);
+
278 }
+
279
+
280 private StringToVoidDelegate delegate_;
+
281}
+
282
+
283} // namespace Google.OrTools.Sat
+
Holds a Boolean variable.
Wrapper class around the cp_model proto.
Definition: CpModel.cs:24
CpModelProto Model
The underlying CpModelProto.
Definition: CpModel.cs:39
@@ -342,32 +342,32 @@ $(document).ready(function(){initNavTree('CpSolver_8cs_source.html',''); initRes
double ObjectiveValue
Only make sense for an optimization problem.
Definition: CpModel.pb.cs:9487
global::Google.OrTools.Sat.CpSolverStatus Status
The status of the solve.
Definition: CpModel.pb.cs:9452
pbc::RepeatedField< long > Solution
A feasible solution to the given problem.
Definition: CpModel.pb.cs:9472
-
Wrapper around the SAT solver
Definition: CpSolver.cs:30
-
double WallTime()
Returns the wall time of the search.
Definition: CpSolver.cs:239
-
String ResponseStats()
Statistics on the solution found as a string
Definition: CpSolver.cs:100
-
CpSolverStatus SolveWithSolutionCallback(CpModel model, SolutionCallback cb)
Definition: CpSolver.cs:62
-
void StopSearch()
Stops the search asynchronously
Definition: CpSolver.cs:79
-
long Value(LinearExpr e)
Returns the value of a linear expression in the last solution found.
Definition: CpSolver.cs:153
-
void SetLogCallback(StringToVoidDelegate del)
Definition: CpSolver.cs:136
-
long NumConflicts()
Returns the number of conflicts created during search.
Definition: CpSolver.cs:233
-
IList< int > SufficientAssumptionsForInfeasibility()
Definition: CpSolver.cs:244
-
double BestObjectiveBound
The best lower bound found when minimizing, of the best upper bound found when maximizing
Definition: CpSolver.cs:119
-
CpSolverStatus SearchAllSolutions(CpModel model, SolutionCallback cb)
Definition: CpSolver.cs:68
-
double ObjectiveValue
The best objective value found during search
Definition: CpSolver.cs:107
-
CpSolverResponse Response
Definition: CpSolver.cs:142
-
long NumBranches()
Returns the number of branches explored during search.
Definition: CpSolver.cs:227
-
Boolean BooleanValue(ILiteral literal)
Returns the Boolean value of a linear expression in the last solution found.
Definition: CpSolver.cs:206
-
CpSolverStatus Solve(CpModel model, SolutionCallback cb=null)
Solves the given model, and returns the solve status
Definition: CpSolver.cs:32
-
String SolutionInfo()
Returns some information on how the solution was found, or the reason why the model or the parameters...
Definition: CpSolver.cs:253
-
string StringParameters
The parameters of the search, stored as a string.
Definition: CpSolver.cs:127
- - - - -
override void NewMessage(string message)
Definition: CpSolver.cs:271
-
LogCallbackDelegate(StringToVoidDelegate del)
Definition: CpSolver.cs:266
+
Wrapper around the SAT solver.
Definition: CpSolver.cs:30
+
double WallTime()
Returns the wall time of the search.
Definition: CpSolver.cs:241
+
String ResponseStats()
Statistics on the solution found as a string.
Definition: CpSolver.cs:102
+
CpSolverStatus SolveWithSolutionCallback(CpModel model, SolutionCallback cb)
Deprecated, use Solve() instead.
Definition: CpSolver.cs:63
+
void StopSearch()
Stops the search asynchronously.
Definition: CpSolver.cs:81
+
long Value(LinearExpr e)
Returns the value of a linear expression in the last solution found.
Definition: CpSolver.cs:155
+
void SetLogCallback(StringToVoidDelegate del)
Definition: CpSolver.cs:138
+
long NumConflicts()
Returns the number of conflicts created during search.
Definition: CpSolver.cs:235
+
IList< int > SufficientAssumptionsForInfeasibility()
Definition: CpSolver.cs:246
+
double BestObjectiveBound
The best lower bound found when minimizing, of the best upper bound found when maximizing
Definition: CpSolver.cs:121
+
CpSolverStatus SearchAllSolutions(CpModel model, SolutionCallback cb)
Deprecated, use Solve() instead.
Definition: CpSolver.cs:70
+
double ObjectiveValue
The best objective value found during search.
Definition: CpSolver.cs:109
+
CpSolverResponse Response
Definition: CpSolver.cs:144
+
long NumBranches()
Returns the number of branches explored during search.
Definition: CpSolver.cs:229
+
Boolean BooleanValue(ILiteral literal)
Returns the Boolean value of a literal in the last solution found.
Definition: CpSolver.cs:208
+
CpSolverStatus Solve(CpModel model, SolutionCallback cb=null)
Solves the given model, and returns the solve status.
Definition: CpSolver.cs:32
+
String SolutionInfo()
Returns some information on how the solution was found, or the reason why the model or the parameters...
Definition: CpSolver.cs:257
+
string StringParameters
The parameters of the search, stored as a string.
Definition: CpSolver.cs:129
+
Holds a integer variable with a discrete domain.
+
A builder class for linear expressions.
+
Holds a linear expression: sum (ai * xi) + b.
+ +
override void NewMessage(string message)
Definition: CpSolver.cs:275
+
LogCallbackDelegate(StringToVoidDelegate del)
Definition: CpSolver.cs:270
- +
void ClearSolutionCallback(SolutionCallback callback)
Definition: SolveWrapper.cs:60
@@ -376,14 +376,14 @@ $(document).ready(function(){initNavTree('CpSolver_8cs_source.html',''); initRes
void AddSolutionCallback(SolutionCallback callback)
Definition: SolveWrapper.cs:55
void SetStringParameters(string string_parameters)
Definition: SolveWrapper.cs:50
- - +
Holds a Boolean variable or its negation.
+
int GetIndex()
Returns the logical index of the literal.
CpSolverStatus
The status returned by a solver trying to solve a CpModelProto.
Definition: CpModel.pb.cs:210
delegate void StringToVoidDelegate(string message)
- - - + + + diff --git a/docs/dotnet/IntegerExpressions_8cs.html b/docs/dotnet/IntegerExpressions_8cs.html index bf2b9e330c..23e3f110d7 100644 --- a/docs/dotnet/IntegerExpressions_8cs.html +++ b/docs/dotnet/IntegerExpressions_8cs.html @@ -93,22 +93,28 @@ $(document).ready(function(){initNavTree('IntegerExpressions_8cs.html',''); init

Classes

interface  ILiteral + Holds a Boolean variable or its negation. More...
  class  HelperExtensions   struct  Term   class  LinearExpr + Holds a linear expression: sum (ai * xi) + b. More...
  class  LinearExprBuilder + A builder class for linear expressions. More...
  class  IntVar + Holds a integer variable with a discrete domain. More...
  class  BoolVar + Holds a Boolean variable. More...
  class  NotBoolVar   class  BoundedLinearExpression + Holds a linear constraint: expression ∈ domain More...
  + +

diff --git a/docs/dotnet/IntegerExpressions_8cs_source.html b/docs/dotnet/IntegerExpressions_8cs_source.html index af0e2542bc..f9f26aa326 100644 --- a/docs/dotnet/IntegerExpressions_8cs_source.html +++ b/docs/dotnet/IntegerExpressions_8cs_source.html @@ -107,1033 +107,1032 @@ $(document).ready(function(){initNavTree('IntegerExpressions_8cs_source.html',''
21using System.Runtime.CompilerServices;
22using Google.Protobuf.Collections;
23
-
24public interface ILiteral
-
25{
- -
27 int GetIndex();
- -
29}
-
30
-
31internal static class HelperExtensions
-
32{
-
33 [MethodImpl(MethodImplOptions.AggressiveInlining)]
-
34 public static void AddOrIncrement(this Dictionary<IntVar, long> dict, IntVar key, long increment)
-
35 {
-
36#if NET6_0_OR_GREATER
-
37 System.Runtime.InteropServices.CollectionsMarshal.GetValueRefOrAddDefault(dict, key, out _) += increment;
-
38#else
-
39 if (dict.TryGetValue(key, out var value))
-
40 {
-
41 dict[key] = value + increment;
-
42 }
-
43 else
+
25public interface ILiteral
+
26{
+ +
30 int GetIndex();
+ +
33}
+
34
+
35internal static class HelperExtensions
+
36{
+
37 [MethodImpl(MethodImplOptions.AggressiveInlining)]
+
38 public static void AddOrIncrement(this Dictionary<IntVar, long> dict, IntVar key, long increment)
+
39 {
+
40#if NET6_0_OR_GREATER
+
41 System.Runtime.InteropServices.CollectionsMarshal.GetValueRefOrAddDefault(dict, key, out _) += increment;
+
42#else
+
43 if (dict.TryGetValue(key, out var value))
44 {
-
45 dict.Add(key, increment);
+
45 dict[key] = value + increment;
46 }
-
47#endif
-
48 }
-
49
-
50 [MethodImpl(MethodImplOptions.AggressiveInlining)]
-
51 public static void TrySetCapacity<TField, TValues>(this RepeatedField<TField> field, IEnumerable<TValues> values)
-
52 {
-
53 if (values is ICollection<TValues> collection)
-
54 {
-
55 field.Capacity = collection.Count;
-
56 }
-
57 }
-
58
-
59 [MethodImpl(MethodImplOptions.AggressiveInlining)]
-
60 public static void TryEnsureCapacity<TValue, TValues>(this List<TValue> list, IEnumerable<TValues> values)
-
61 {
-
62 // Check for ICollection as the generic version is not covariant and TValues could be LinearExpr, IntVar, ...
-
63 if (values is ICollection collection)
-
64 {
-
65 list.Capacity = Math.Max(list.Count + collection.Count, list.Capacity);
-
66 }
-
67 }
-
68}
-
69
-
70// Holds a term (expression * coefficient)
-
71public struct Term
-
72{
- -
74 public long coefficient;
-
75
-
76 public Term(LinearExpr e, long c)
-
77 {
-
78 this.expr = e;
-
79 this.coefficient = c;
-
80 }
-
81}
-
82
-
83// Holds a linear expression.
-
84public class LinearExpr
-
85{
-
86 public static LinearExpr Sum(IEnumerable<LinearExpr> exprs)
-
87 {
-
88 return NewBuilder(0).AddSum(exprs);
-
89 }
-
90
-
91 public static LinearExpr Sum(IEnumerable<ILiteral> literals)
-
92 {
-
93 return NewBuilder(0).AddSum(literals);
-
94 }
-
95
-
96 public static LinearExpr Sum(IEnumerable<BoolVar> vars)
-
97 {
-
98 return NewBuilder(0).AddSum(vars);
-
99 }
-
100
-
101 public static LinearExpr WeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<int> coeffs)
+
47 else
+
48 {
+
49 dict.Add(key, increment);
+
50 }
+
51#endif
+
52 }
+
53
+
54 [MethodImpl(MethodImplOptions.AggressiveInlining)]
+
55 public static void TrySetCapacity<TField, TValues>(this RepeatedField<TField> field, IEnumerable<TValues> values)
+
56 {
+
57 if (values is ICollection<TValues> collection)
+
58 {
+
59 field.Capacity = collection.Count;
+
60 }
+
61 }
+
62
+
63 [MethodImpl(MethodImplOptions.AggressiveInlining)]
+
64 public static void TryEnsureCapacity<TValue, TValues>(this List<TValue> list, IEnumerable<TValues> values)
+
65 {
+
66 // Check for ICollection as the generic version is not covariant and TValues could be LinearExpr, IntVar, ...
+
67 if (values is ICollection collection)
+
68 {
+
69 list.Capacity = Math.Max(list.Count + collection.Count, list.Capacity);
+
70 }
+
71 }
+
72}
+
73
+
74// Holds a term (expression * coefficient)
+
75public struct Term
+
76{
+ +
78 public long coefficient;
+
79
+
80 public Term(LinearExpr e, long c)
+
81 {
+
82 this.expr = e;
+
83 this.coefficient = c;
+
84 }
+
85}
+
86
+
92public class LinearExpr
+
93{
+
95 public static LinearExpr Sum(IEnumerable<LinearExpr> exprs)
+
96 {
+
97 return NewBuilder(0).AddSum(exprs);
+
98 }
+
99
+
101 public static LinearExpr Sum(IEnumerable<ILiteral> literals)
102 {
-
103 return NewBuilder(0).AddWeightedSum(exprs, coeffs);
+
103 return NewBuilder(0).AddSum(literals);
104 }
105
-
106 public static LinearExpr WeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<long> coeffs)
-
107 {
-
108 return NewBuilder(0).AddWeightedSum(exprs, coeffs);
-
109 }
-
110
-
111 public static LinearExpr WeightedSum(IEnumerable<ILiteral> literals, IEnumerable<int> coeffs)
-
112 {
-
113 return NewBuilder(0).AddWeightedSum(literals, coeffs);
-
114 }
-
115
-
116 public static LinearExpr WeightedSum(IEnumerable<ILiteral> literals, IEnumerable<long> coeffs)
-
117 {
-
118 return NewBuilder(0).AddWeightedSum(literals, coeffs);
-
119 }
-
120
-
121 public static LinearExpr WeightedSum(IEnumerable<BoolVar> vars, IEnumerable<int> coeffs)
-
122 {
-
123 return NewBuilder(0).AddWeightedSum(vars, coeffs);
-
124 }
-
125
-
126 public static LinearExpr WeightedSum(IEnumerable<BoolVar> vars, IEnumerable<long> coeffs)
-
127 {
-
128 return NewBuilder(0).AddWeightedSum(vars, coeffs);
-
129 }
-
130
-
131 public static LinearExpr Term(LinearExpr expr, long coeff)
+
107 public static LinearExpr Sum(IEnumerable<BoolVar> vars)
+
108 {
+
109 return NewBuilder(0).AddSum(vars);
+
110 }
+
111
+
113 public static LinearExpr WeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<int> coeffs)
+
114 {
+
115 return NewBuilder(0).AddWeightedSum(exprs, coeffs);
+
116 }
+
117
+
119 public static LinearExpr WeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<long> coeffs)
+
120 {
+
121 return NewBuilder(0).AddWeightedSum(exprs, coeffs);
+
122 }
+
123
+
125 public static LinearExpr WeightedSum(IEnumerable<ILiteral> literals, IEnumerable<int> coeffs)
+
126 {
+
127 return NewBuilder(0).AddWeightedSum(literals, coeffs);
+
128 }
+
129
+
131 public static LinearExpr WeightedSum(IEnumerable<ILiteral> literals, IEnumerable<long> coeffs)
132 {
-
133 return Prod(expr, coeff);
+
133 return NewBuilder(0).AddWeightedSum(literals, coeffs);
134 }
135
-
136 public static LinearExpr Term(ILiteral literal, long coeff)
-
137 {
-
138 if (literal is BoolVar boolVar)
-
139 {
-
140 return Prod(boolVar, coeff);
-
141 }
-
142 else
-
143 {
-
144 return Affine(literal.NotAsExpr(), -coeff, coeff);
-
145 }
+
137 public static LinearExpr WeightedSum(IEnumerable<BoolVar> vars, IEnumerable<int> coeffs)
+
138 {
+
139 return NewBuilder(0).AddWeightedSum(vars, coeffs);
+
140 }
+
141
+
143 public static LinearExpr WeightedSum(IEnumerable<BoolVar> vars, IEnumerable<long> coeffs)
+
144 {
+
145 return NewBuilder(0).AddWeightedSum(vars, coeffs);
146 }
147
-
148 public static LinearExpr Term(BoolVar var, long coeff)
-
149 {
-
150 return Prod(var, coeff);
-
151 }
-
152
-
153 public static LinearExpr Affine(LinearExpr expr, long coeff, long offset)
-
154 {
-
155 if (offset == 0)
-
156 {
-
157 return Prod(expr, coeff);
-
158 }
-
159 return NewBuilder().AddTerm(expr, coeff).Add(offset);
-
160 }
-
161
-
162 public static LinearExpr Affine(ILiteral literal, long coeff, long offset)
-
163 {
-
164 return NewBuilder().AddTerm(literal, coeff).Add(offset);
+
149 public static LinearExpr Term(LinearExpr expr, long coeff)
+
150 {
+
151 return Prod(expr, coeff);
+
152 }
+
153
+
155 public static LinearExpr Term(ILiteral literal, long coeff)
+
156 {
+
157 if (literal is BoolVar boolVar)
+
158 {
+
159 return Prod(boolVar, coeff);
+
160 }
+
161 else
+
162 {
+
163 return Affine(literal.NotAsExpr(), -coeff, coeff);
+
164 }
165 }
166
-
167 public static LinearExpr Affine(BoolVar var, long coeff, long offset)
-
168 {
-
169 return NewBuilder().AddTerm(var, coeff).Add(offset);
-
170 }
-
171
-
172 public static LinearExpr Constant(long value)
-
173 {
-
174 return NewBuilder(0).Add(value);
-
175 }
-
176
-
177 public static LinearExprBuilder NewBuilder(int sizeHint = 2)
-
178 {
-
179 return new LinearExprBuilder(sizeHint);
-
180 }
-
181
- -
183 {
-
184 return NewBuilder().Add(a).Add(b);
-
185 }
-
186
-
187 public static LinearExpr operator +(LinearExpr a, long v)
-
188 {
-
189 return NewBuilder().Add(a).Add(v);
-
190 }
-
191
-
192 public static LinearExpr operator +(long v, LinearExpr a)
-
193 {
-
194 return NewBuilder().Add(a).Add(v);
-
195 }
-
196
- -
198 {
-
199 return NewBuilder().Add(a).AddTerm(b, -1);
-
200 }
-
201
-
202 public static LinearExpr operator -(LinearExpr a, long v)
+
168 public static LinearExpr Term(BoolVar var, long coeff)
+
169 {
+
170 return Prod(var, coeff);
+
171 }
+
172
+
174 public static LinearExpr Affine(LinearExpr expr, long coeff, long offset)
+
175 {
+
176 if (offset == 0)
+
177 {
+
178 return Prod(expr, coeff);
+
179 }
+
180 return NewBuilder().AddTerm(expr, coeff).Add(offset);
+
181 }
+
182
+
184 public static LinearExpr Affine(ILiteral literal, long coeff, long offset)
+
185 {
+
186 return NewBuilder().AddTerm(literal, coeff).Add(offset);
+
187 }
+
188
+
190 public static LinearExpr Affine(BoolVar var, long coeff, long offset)
+
191 {
+
192 return NewBuilder().AddTerm(var, coeff).Add(offset);
+
193 }
+
194
+
196 public static LinearExpr Constant(long value)
+
197 {
+
198 return NewBuilder(0).Add(value);
+
199 }
+
200
+
202 public static LinearExprBuilder NewBuilder(int sizeHint = 2)
203 {
-
204 return NewBuilder().Add(a).Add(-v);
+
204 return new LinearExprBuilder(sizeHint);
205 }
206
-
207 public static LinearExpr operator -(long v, LinearExpr a)
+
208 {
-
209 return NewBuilder().AddTerm(a, -1).Add(v);
+
209 return NewBuilder().Add(a).Add(b);
210 }
211
-
212 public static LinearExpr operator *(LinearExpr a, long v)
+
212 public static LinearExpr operator +(LinearExpr a, long v)
213 {
-
214 return Prod(a, v);
+
214 return NewBuilder().Add(a).Add(v);
215 }
216
-
217 public static LinearExpr operator *(long v, LinearExpr a)
+
217 public static LinearExpr operator +(long v, LinearExpr a)
218 {
-
219 return Prod(a, v);
+
219 return NewBuilder().Add(a).Add(v);
220 }
221
- +
223 {
-
224 return Prod(a, -1);
+
224 return NewBuilder().Add(a).AddTerm(b, -1);
225 }
226
- +
227 public static LinearExpr operator -(LinearExpr a, long v)
228 {
-
229 return new BoundedLinearExpression(a, b, true);
+
229 return NewBuilder().Add(a).Add(-v);
230 }
231
- +
232 public static LinearExpr operator -(long v, LinearExpr a)
233 {
-
234 return new BoundedLinearExpression(a, b, false);
+
234 return NewBuilder().AddTerm(a, -1).Add(v);
235 }
236
- +
237 public static LinearExpr operator *(LinearExpr a, long v)
238 {
-
239 return new BoundedLinearExpression(a, v, true);
+
239 return Prod(a, v);
240 }
241
- +
242 public static LinearExpr operator *(long v, LinearExpr a)
243 {
-
244 return new BoundedLinearExpression(a, v, false);
+
244 return Prod(a, v);
245 }
246
- +
248 {
-
249 return new BoundedLinearExpression(v, a, Int64.MaxValue);
+
249 return Prod(a, -1);
250 }
251
- +
253 {
-
254 return a <= v;
+
254 return new BoundedLinearExpression(a, b, true);
255 }
256
- +
258 {
-
259 return new BoundedLinearExpression(v + 1, a, Int64.MaxValue);
+
259 return new BoundedLinearExpression(a, b, false);
260 }
261
- +
263 {
-
264 return a < v;
+
264 return new BoundedLinearExpression(a, v, true);
265 }
266
- +
268 {
-
269 return new BoundedLinearExpression(Int64.MinValue, a, v);
+
269 return new BoundedLinearExpression(a, v, false);
270 }
271
- +
273 {
-
274 return a >= v;
+
274 return new BoundedLinearExpression(v, a, Int64.MaxValue);
275 }
276
- +
278 {
-
279 return new BoundedLinearExpression(Int64.MinValue, a, v - 1);
+
279 return a <= v;
280 }
281
- +
283 {
-
284 return a > v;
+
284 return new BoundedLinearExpression(v + 1, a, Int64.MaxValue);
285 }
286
- +
288 {
-
289 return new BoundedLinearExpression(0, a - b, Int64.MaxValue);
+
289 return a < v;
290 }
291
- +
293 {
-
294 return new BoundedLinearExpression(1, a - b, Int64.MaxValue);
+
294 return new BoundedLinearExpression(Int64.MinValue, a, v);
295 }
296
- +
298 {
-
299 return new BoundedLinearExpression(Int64.MinValue, a - b, 0);
+
299 return a >= v;
300 }
301
- +
303 {
-
304 return new BoundedLinearExpression(Int64.MinValue, a - b, -1);
+
304 return new BoundedLinearExpression(Int64.MinValue, a, v - 1);
305 }
306
-
307 public static LinearExpr Prod(LinearExpr e, long v)
+
308 {
-
309 if (v == 0)
-
310 {
-
311 return NewBuilder(0);
-
312 }
-
313 else if (v == 1)
-
314 {
-
315 return e;
-
316 }
-
317 else
-
318 {
-
319 return NewBuilder(1).AddTerm(e, v);
-
320 }
-
321 }
-
322
-
323 public static long GetVarValueMap(LinearExpr e, long initial_coeff, Dictionary<IntVar, long> dict)
-
324 {
-
325 List<Term> terms = new List<Term>();
-
326 if (e is not null)
-
327 {
-
328 terms.Add(new Term(e, initial_coeff));
-
329 }
-
330 long constant = 0;
+
309 return a > v;
+
310 }
+
311
+ +
313 {
+
314 return new BoundedLinearExpression(0, a - b, Int64.MaxValue);
+
315 }
+
316
+ +
318 {
+
319 return new BoundedLinearExpression(1, a - b, Int64.MaxValue);
+
320 }
+
321
+ +
323 {
+
324 return new BoundedLinearExpression(Int64.MinValue, a - b, 0);
+
325 }
+
326
+ +
328 {
+
329 return new BoundedLinearExpression(Int64.MinValue, a - b, -1);
+
330 }
331
-
332 while (terms.Count > 0)
-
333 {
-
334 Term term = terms[0];
-
335 terms.RemoveAt(0);
-
336 if (term.coefficient == 0 || term.expr is null)
-
337 {
-
338 continue;
-
339 }
-
340
-
341 if (term.expr is LinearExprBuilder b)
-
342 {
-
343 constant += term.coefficient * b.Offset;
-
344 foreach (Term sub in b.Terms)
-
345 {
-
346 if (sub.expr is IntVar i) // Quick unroll.
-
347 {
-
348 dict.AddOrIncrement(i, term.coefficient * sub.coefficient);
-
349 }
-
350 else
-
351 {
-
352 terms.Add(new Term(sub.expr, sub.coefficient * term.coefficient));
-
353 }
-
354 }
-
355 }
-
356 else if (term.expr is IntVar i)
-
357 {
-
358 dict.AddOrIncrement(i, term.coefficient);
-
359 }
-
360 else if (term.expr is NotBoolVar notBoolVar)
-
361 {
-
362 dict.AddOrIncrement((IntVar)notBoolVar.Not(), -term.coefficient);
-
363 constant += term.coefficient;
+
332 public static LinearExpr Prod(LinearExpr e, long v)
+
333 {
+
334 if (v == 0)
+
335 {
+
336 return NewBuilder(0);
+
337 }
+
338 else if (v == 1)
+
339 {
+
340 return e;
+
341 }
+
342 else
+
343 {
+
344 return NewBuilder(1).AddTerm(e, v);
+
345 }
+
346 }
+
347
+
348 public static long GetVarValueMap(LinearExpr e, long initial_coeff, Dictionary<IntVar, long> dict)
+
349 {
+
350 List<Term> terms = new List<Term>();
+
351 if (e is not null)
+
352 {
+
353 terms.Add(new Term(e, initial_coeff));
+
354 }
+
355 long constant = 0;
+
356
+
357 while (terms.Count > 0)
+
358 {
+
359 Term term = terms[0];
+
360 terms.RemoveAt(0);
+
361 if (term.coefficient == 0 || term.expr is null)
+
362 {
+
363 continue;
364 }
-
365 else
-
366 {
-
367 throw new ArgumentException("Cannot interpret '" + term.expr.ToString() + "' in an integer expression");
-
368 }
-
369 }
-
370 return constant;
-
371 }
-
372
- -
374 {
-
375 int numElements = proto.Vars.Count;
-
376 long offset = proto.Offset;
-
377 if (numElements == 0)
-
378 {
-
379 return LinearExpr.Constant(offset);
-
380 }
-
381 else if (numElements == 1)
-
382 {
-
383 IntVar var = new IntVar(model, proto.Vars[0]);
-
384 long coeff = proto.Coeffs[0];
-
385 return LinearExpr.Affine(var, coeff, offset);
-
386 }
-
387 else
-
388 {
-
389 LinearExprBuilder builder = LinearExpr.NewBuilder(numElements);
-
390 for (int i = 0; i < numElements; ++i)
+
365
+
366 if (term.expr is LinearExprBuilder b)
+
367 {
+
368 constant += term.coefficient * b.Offset;
+
369 foreach (Term sub in b.Terms)
+
370 {
+
371 if (sub.expr is IntVar i) // Quick unroll.
+
372 {
+
373 dict.AddOrIncrement(i, term.coefficient * sub.coefficient);
+
374 }
+
375 else
+
376 {
+
377 terms.Add(new Term(sub.expr, sub.coefficient * term.coefficient));
+
378 }
+
379 }
+
380 }
+
381 else if (term.expr is IntVar i)
+
382 {
+
383 dict.AddOrIncrement(i, term.coefficient);
+
384 }
+
385 else if (term.expr is NotBoolVar notBoolVar)
+
386 {
+
387 dict.AddOrIncrement((IntVar)notBoolVar.Not(), -term.coefficient);
+
388 constant += term.coefficient;
+
389 }
+
390 else
391 {
-
392 builder.AddTerm(new IntVar(model, proto.Vars[i]), proto.Coeffs[i]);
+
392 throw new ArgumentException("Cannot interpret '" + term.expr.ToString() + "' in an integer expression");
393 }
-
394 builder.Add(offset);
-
395 return builder;
-
396 }
-
397 }
-
398}
-
399
-
400public sealed class LinearExprBuilder : LinearExpr
-
401{
-
402 public LinearExprBuilder(int sizeHint = 2)
-
403 {
-
404 terms_ = new List<Term>(sizeHint);
-
405 offset_ = 0;
-
406 }
-
407
- -
409 {
-
410 return AddTerm(expr, 1);
-
411 }
-
412
- -
414 {
-
415 return AddTerm(literal, 1);
-
416 }
-
417
- -
419 {
-
420 return AddTerm(var, 1);
-
421 }
-
422
-
423 public LinearExprBuilder Add(long constant)
-
424 {
-
425 offset_ += constant;
-
426 return this;
-
427 }
-
428
-
429 public LinearExprBuilder AddTerm(LinearExpr expr, long coefficient)
-
430 {
-
431 terms_.Add(new Term(expr, coefficient));
-
432 return this;
-
433 }
-
434
-
435 public LinearExprBuilder AddTerm(ILiteral literal, long coefficient)
+
394 }
+
395 return constant;
+
396 }
+
397
+ +
399 {
+
400 int numElements = proto.Vars.Count;
+
401 long offset = proto.Offset;
+
402 if (numElements == 0)
+
403 {
+
404 return LinearExpr.Constant(offset);
+
405 }
+
406 else if (numElements == 1)
+
407 {
+
408 IntVar var = new IntVar(model, proto.Vars[0]);
+
409 long coeff = proto.Coeffs[0];
+
410 return LinearExpr.Affine(var, coeff, offset);
+
411 }
+
412 else
+
413 {
+
414 LinearExprBuilder builder = LinearExpr.NewBuilder(numElements);
+
415 for (int i = 0; i < numElements; ++i)
+
416 {
+
417 builder.AddTerm(new IntVar(model, proto.Vars[i]), proto.Coeffs[i]);
+
418 }
+
419 builder.Add(offset);
+
420 return builder;
+
421 }
+
422 }
+
423}
+
424
+
426public sealed class LinearExprBuilder : LinearExpr
+
427{
+
428 public LinearExprBuilder(int sizeHint = 2)
+
429 {
+
430 terms_ = new List<Term>(sizeHint);
+
431 offset_ = 0;
+
432 }
+
433
+
436 {
-
437 if (literal is BoolVar boolVar)
-
438 {
-
439 terms_.Add(new Term(boolVar, coefficient));
-
440 }
-
441 else
-
442 {
-
443 offset_ += coefficient;
-
444 terms_.Add(new Term(literal.NotAsExpr(), -coefficient));
-
445 }
-
446 return this;
-
447 }
-
448
-
449 public LinearExprBuilder AddTerm(BoolVar var, long coefficient)
-
450 {
-
451 terms_.Add(new Term(var, coefficient));
-
452 return this;
-
453 }
-
454
-
455 public LinearExprBuilder AddSum(IEnumerable<LinearExpr> exprs)
-
456 {
-
457 terms_.TryEnsureCapacity(exprs);
-
458 foreach (LinearExpr expr in exprs)
-
459 {
-
460 AddTerm(expr, 1);
-
461 }
-
462 return this;
-
463 }
-
464
-
465 public LinearExprBuilder AddSum(IEnumerable<ILiteral> literals)
-
466 {
-
467 terms_.TryEnsureCapacity(literals);
-
468 foreach (ILiteral literal in literals)
-
469 {
-
470 AddTerm(literal, 1);
-
471 }
-
472 return this;
-
473 }
-
474
-
475 public LinearExprBuilder AddSum(IEnumerable<BoolVar> vars)
-
476 {
-
477 terms_.TryEnsureCapacity(vars);
-
478 foreach (BoolVar var in vars)
-
479 {
-
480 AddTerm(var, 1);
-
481 }
-
482 return this;
-
483 }
-
484
-
485 public LinearExprBuilder AddWeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<long> coefficients)
-
486 {
-
487 terms_.TryEnsureCapacity(exprs);
-
488 foreach (var p in exprs.Zip(coefficients, (e, c) => new { Expr = e, Coeff = c }))
-
489 {
-
490 AddTerm(p.Expr, p.Coeff);
-
491 }
-
492 return this;
-
493 }
-
494
-
495 public LinearExprBuilder AddWeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<int> coefficients)
-
496 {
-
497 terms_.TryEnsureCapacity(exprs);
-
498 foreach (var p in exprs.Zip(coefficients, (e, c) => new { Expr = e, Coeff = c }))
-
499 {
-
500 AddTerm(p.Expr, p.Coeff);
-
501 }
-
502 return this;
-
503 }
-
504
-
505 public LinearExprBuilder AddWeightedSum(IEnumerable<ILiteral> literals, IEnumerable<int> coefficients)
-
506 {
-
507 terms_.TryEnsureCapacity(literals);
-
508 foreach (var p in literals.Zip(coefficients, (l, c) => new { Literal = l, Coeff = c }))
-
509 {
-
510 AddTerm(p.Literal, p.Coeff);
-
511 }
-
512 return this;
-
513 }
-
514
-
515 public LinearExprBuilder AddWeightedSum(IEnumerable<ILiteral> literals, IEnumerable<long> coefficients)
-
516 {
-
517 terms_.TryEnsureCapacity(literals);
-
518 foreach (var p in literals.Zip(coefficients, (l, c) => new { Literal = l, Coeff = c }))
-
519 {
-
520 AddTerm(p.Literal, p.Coeff);
-
521 }
-
522 return this;
-
523 }
-
524
-
525 public LinearExprBuilder AddWeightedSum(IEnumerable<BoolVar> vars, IEnumerable<long> coefficients)
-
526 {
-
527 terms_.TryEnsureCapacity(vars);
-
528 foreach (var p in vars.Zip(coefficients, (v, c) => new { Var = v, Coeff = c }))
-
529 {
-
530 AddTerm(p.Var, p.Coeff);
-
531 }
-
532 return this;
-
533 }
-
534
-
535 public LinearExprBuilder AddWeightedSum(IEnumerable<BoolVar> vars, IEnumerable<int> coefficients)
-
536 {
-
537 terms_.TryEnsureCapacity(vars);
-
538 foreach (var p in vars.Zip(coefficients, (v, c) => new { Var = v, Coeff = c }))
-
539 {
-
540 AddTerm(p.Var, p.Coeff);
-
541 }
-
542 return this;
-
543 }
-
544
-
545 public override string ToString()
-
546 {
-
547 string result = "";
-
548 foreach (Term term in terms_)
-
549 {
-
550 bool first = String.IsNullOrEmpty(result);
-
551 if (term.expr is null || term.coefficient == 0)
-
552 {
-
553 continue;
-
554 }
-
555 if (term.coefficient == 1)
-
556 {
-
557 if (!first)
-
558 {
-
559 result += " + ";
-
560 }
-
561
-
562 result += term.expr.ToString();
-
563 }
-
564 else if (term.coefficient > 0)
-
565 {
-
566 if (!first)
-
567 {
-
568 result += " + ";
-
569 }
-
570
-
571 result += String.Format("{0} * {1}", term.coefficient, term.expr.ToString());
-
572 }
-
573 else if (term.coefficient == -1)
-
574 {
-
575 if (!first)
-
576 {
-
577 result += String.Format(" - {0}", term.expr.ToString());
-
578 }
-
579 else
-
580 {
-
581 result += String.Format("-{0}", term.expr.ToString());
-
582 }
-
583 }
-
584 else
-
585 {
-
586 if (!first)
-
587 {
-
588 result += String.Format(" - {0} * {1}", -term.coefficient, term.expr.ToString());
-
589 }
-
590 else
-
591 {
-
592 result += String.Format("{0} * {1}", term.coefficient, term.expr.ToString());
-
593 }
-
594 }
-
595 }
-
596 if (offset_ > 0)
-
597 {
-
598 if (!String.IsNullOrEmpty(result))
-
599 {
-
600 result += String.Format(" + {0}", offset_);
-
601 }
-
602 else
-
603 {
-
604 result += String.Format("{0}", offset_);
+
437 return AddTerm(expr, 1);
+
438 }
+
439
+ +
442 {
+
443 return AddTerm(literal, 1);
+
444 }
+
445
+ +
448 {
+
449 return AddTerm(var, 1);
+
450 }
+
451
+
453 public LinearExprBuilder Add(long constant)
+
454 {
+
455 offset_ += constant;
+
456 return this;
+
457 }
+
458
+
460 public LinearExprBuilder AddTerm(LinearExpr expr, long coefficient)
+
461 {
+
462 terms_.Add(new Term(expr, coefficient));
+
463 return this;
+
464 }
+
465
+
467 public LinearExprBuilder AddTerm(ILiteral literal, long coefficient)
+
468 {
+
469 if (literal is BoolVar boolVar)
+
470 {
+
471 terms_.Add(new Term(boolVar, coefficient));
+
472 }
+
473 else
+
474 {
+
475 offset_ += coefficient;
+
476 terms_.Add(new Term(literal.NotAsExpr(), -coefficient));
+
477 }
+
478 return this;
+
479 }
+
480
+
482 public LinearExprBuilder AddTerm(BoolVar var, long coefficient)
+
483 {
+
484 terms_.Add(new Term(var, coefficient));
+
485 return this;
+
486 }
+
487
+
489 public LinearExprBuilder AddSum(IEnumerable<LinearExpr> exprs)
+
490 {
+
491 terms_.TryEnsureCapacity(exprs);
+
492 foreach (LinearExpr expr in exprs)
+
493 {
+
494 AddTerm(expr, 1);
+
495 }
+
496 return this;
+
497 }
+
498
+
500 public LinearExprBuilder AddSum(IEnumerable<ILiteral> literals)
+
501 {
+
502 terms_.TryEnsureCapacity(literals);
+
503 foreach (ILiteral literal in literals)
+
504 {
+
505 AddTerm(literal, 1);
+
506 }
+
507 return this;
+
508 }
+
509
+
511 public LinearExprBuilder AddSum(IEnumerable<BoolVar> vars)
+
512 {
+
513 terms_.TryEnsureCapacity(vars);
+
514 foreach (BoolVar var in vars)
+
515 {
+
516 AddTerm(var, 1);
+
517 }
+
518 return this;
+
519 }
+
520
+
522 public LinearExprBuilder AddWeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<long> coefficients)
+
523 {
+
524 terms_.TryEnsureCapacity(exprs);
+
525 foreach (var p in exprs.Zip(coefficients, (e, c) => new { Expr = e, Coeff = c }))
+
526 {
+
527 AddTerm(p.Expr, p.Coeff);
+
528 }
+
529 return this;
+
530 }
+
531
+
533 public LinearExprBuilder AddWeightedSum(IEnumerable<LinearExpr> exprs, IEnumerable<int> coefficients)
+
534 {
+
535 terms_.TryEnsureCapacity(exprs);
+
536 foreach (var p in exprs.Zip(coefficients, (e, c) => new { Expr = e, Coeff = c }))
+
537 {
+
538 AddTerm(p.Expr, p.Coeff);
+
539 }
+
540 return this;
+
541 }
+
542
+
544 public LinearExprBuilder AddWeightedSum(IEnumerable<ILiteral> literals, IEnumerable<int> coefficients)
+
545 {
+
546 terms_.TryEnsureCapacity(literals);
+
547 foreach (var p in literals.Zip(coefficients, (l, c) => new { Literal = l, Coeff = c }))
+
548 {
+
549 AddTerm(p.Literal, p.Coeff);
+
550 }
+
551 return this;
+
552 }
+
553
+
555 public LinearExprBuilder AddWeightedSum(IEnumerable<ILiteral> literals, IEnumerable<long> coefficients)
+
556 {
+
557 terms_.TryEnsureCapacity(literals);
+
558 foreach (var p in literals.Zip(coefficients, (l, c) => new { Literal = l, Coeff = c }))
+
559 {
+
560 AddTerm(p.Literal, p.Coeff);
+
561 }
+
562 return this;
+
563 }
+
564
+
566 public LinearExprBuilder AddWeightedSum(IEnumerable<BoolVar> vars, IEnumerable<long> coefficients)
+
567 {
+
568 terms_.TryEnsureCapacity(vars);
+
569 foreach (var p in vars.Zip(coefficients, (v, c) => new { Var = v, Coeff = c }))
+
570 {
+
571 AddTerm(p.Var, p.Coeff);
+
572 }
+
573 return this;
+
574 }
+
575
+
577 public LinearExprBuilder AddWeightedSum(IEnumerable<BoolVar> vars, IEnumerable<int> coefficients)
+
578 {
+
579 terms_.TryEnsureCapacity(vars);
+
580 foreach (var p in vars.Zip(coefficients, (v, c) => new { Var = v, Coeff = c }))
+
581 {
+
582 AddTerm(p.Var, p.Coeff);
+
583 }
+
584 return this;
+
585 }
+
586
+
587 public override string ToString()
+
588 {
+
589 string result = "";
+
590 foreach (Term term in terms_)
+
591 {
+
592 bool first = String.IsNullOrEmpty(result);
+
593 if (term.expr is null || term.coefficient == 0)
+
594 {
+
595 continue;
+
596 }
+
597 if (term.coefficient == 1)
+
598 {
+
599 if (!first)
+
600 {
+
601 result += " + ";
+
602 }
+
603
+
604 result += term.expr.ToString();
605 }
-
606 }
-
607 else if (offset_ < 0)
-
608 {
-
609 if (!String.IsNullOrEmpty(result))
-
610 {
-
611 result += String.Format(" - {0}", -offset_);
-
612 }
-
613 else
-
614 {
-
615 result += String.Format("{0}", offset_);
-
616 }
-
617 }
-
618 return result;
-
619 }
-
620
-
621 public long Offset
-
622 {
-
623 get {
-
624 return offset_;
-
625 }
-
626 }
-
627
-
628 public List<Term> Terms
-
629 {
-
630 get {
-
631 return terms_;
-
632 }
-
633 }
-
634
-
635 private long offset_;
-
636 private List<Term> terms_;
-
637}
-
638
-
639public class IntVar : LinearExpr
-
640{
-
641 public IntVar(CpModelProto model, Domain domain, string name)
-
642 {
-
643 index_ = model.Variables.Count;
- -
645 var_.Name = name;
-
646 var_.Domain.Add(domain.FlattenedIntervals());
-
647 model.Variables.Add(var_);
-
648 }
-
649
-
650 public IntVar(CpModelProto model, long lb, long ub, string name)
-
651 {
-
652 index_ = model.Variables.Count;
- -
654 var_.Name = name;
-
655 var_.Domain.Capacity = 2;
-
656 var_.Domain.Add(lb);
-
657 var_.Domain.Add(ub);
-
658 model.Variables.Add(var_);
-
659 }
-
660
-
661 public IntVar(CpModelProto model, int index)
-
662 {
-
663 index_ = index;
-
664 var_ = model.Variables[index];
-
665 }
-
666
-
667 public int GetIndex()
-
668 {
-
669 return index_;
-
670 }
-
671
-
672 public int Index
-
673 {
-
674 get {
-
675 return GetIndex();
-
676 }
-
677 }
-
678
- -
680 {
-
681 get {
-
682 return var_;
-
683 }
-
684 set {
-
685 var_ = value;
-
686 }
-
687 }
-
688
- -
690 {
-
691 get {
- -
693 }
-
694 }
-
695
-
696 public override string ToString()
-
697 {
-
698 return var_.Name ?? var_.ToString();
-
699 }
-
700
-
701 public string Name()
-
702 {
-
703 return var_.Name;
-
704 }
-
705
-
706 protected readonly int index_;
- -
708}
-
709
-
710public sealed class BoolVar : IntVar, ILiteral
-
711{
-
712
-
713 public BoolVar(CpModelProto model, String name) : base(model, 0, 1, name)
-
714 {
+
606 else if (term.coefficient > 0)
+
607 {
+
608 if (!first)
+
609 {
+
610 result += " + ";
+
611 }
+
612
+
613 result += String.Format("{0} * {1}", term.coefficient, term.expr.ToString());
+
614 }
+
615 else if (term.coefficient == -1)
+
616 {
+
617 if (!first)
+
618 {
+
619 result += String.Format(" - {0}", term.expr.ToString());
+
620 }
+
621 else
+
622 {
+
623 result += String.Format("-{0}", term.expr.ToString());
+
624 }
+
625 }
+
626 else
+
627 {
+
628 if (!first)
+
629 {
+
630 result += String.Format(" - {0} * {1}", -term.coefficient, term.expr.ToString());
+
631 }
+
632 else
+
633 {
+
634 result += String.Format("{0} * {1}", term.coefficient, term.expr.ToString());
+
635 }
+
636 }
+
637 }
+
638 if (offset_ > 0)
+
639 {
+
640 if (!String.IsNullOrEmpty(result))
+
641 {
+
642 result += String.Format(" + {0}", offset_);
+
643 }
+
644 else
+
645 {
+
646 result += String.Format("{0}", offset_);
+
647 }
+
648 }
+
649 else if (offset_ < 0)
+
650 {
+
651 if (!String.IsNullOrEmpty(result))
+
652 {
+
653 result += String.Format(" - {0}", -offset_);
+
654 }
+
655 else
+
656 {
+
657 result += String.Format("{0}", offset_);
+
658 }
+
659 }
+
660 return result;
+
661 }
+
662
+
663 public long Offset
+
664 {
+
665 get {
+
666 return offset_;
+
667 }
+
668 }
+
669
+
670 public List<Term> Terms
+
671 {
+
672 get {
+
673 return terms_;
+
674 }
+
675 }
+
676
+
677 private long offset_;
+
678 private List<Term> terms_;
+
679}
+
680
+
689public class IntVar : LinearExpr
+
690{
+
691 public IntVar(CpModelProto model, Domain domain, string name)
+
692 {
+
693 index_ = model.Variables.Count;
+ +
695 var_.Name = name;
+
696 var_.Domain.Add(domain.FlattenedIntervals());
+
697 model.Variables.Add(var_);
+
698 }
+
699
+
700 public IntVar(CpModelProto model, long lb, long ub, string name)
+
701 {
+
702 index_ = model.Variables.Count;
+ +
704 var_.Name = name;
+
705 var_.Domain.Capacity = 2;
+
706 var_.Domain.Add(lb);
+
707 var_.Domain.Add(ub);
+
708 model.Variables.Add(var_);
+
709 }
+
710
+
711 public IntVar(CpModelProto model, int index)
+
712 {
+
713 index_ = index;
+
714 var_ = model.Variables[index];
715 }
716
-
717 public BoolVar(CpModelProto model, int index) : base(model, index)
-
718 {
-
719 }
-
720
-
721 public ILiteral Not()
-
722 {
-
723 return negation_ ??= new NotBoolVar(this);
-
724 }
-
725
- -
727 {
-
728 return (LinearExpr)Not();
+
718 public int GetIndex()
+
719 {
+
720 return index_;
+
721 }
+
722
+
724 public int Index
+
725 {
+
726 get {
+
727 return GetIndex();
+
728 }
729 }
730
-
731 private NotBoolVar negation_;
-
732}
-
733
-
734public sealed class NotBoolVar : LinearExpr, ILiteral
-
735{
-
736 public NotBoolVar(BoolVar boolvar)
-
737 {
-
738 boolvar_ = boolvar;
-
739 }
-
740
-
741 public int GetIndex()
-
742 {
-
743 return -boolvar_.GetIndex() - 1;
-
744 }
-
745
-
746 public int Index
-
747 {
-
748 get {
-
749 return GetIndex();
-
750 }
-
751 }
-
752
-
753 public ILiteral Not()
-
754 {
-
755 return boolvar_;
-
756 }
-
757
- -
759 {
-
760 return (LinearExpr)Not();
-
761 }
-
762
-
763 public override string ToString()
-
764 {
-
765 return String.Format("Not({0})", boolvar_.ToString());
-
766 }
-
767
-
768 private readonly BoolVar boolvar_;
-
769}
-
770
-
771public sealed class BoundedLinearExpression
-
772{
-
773 public enum Type
-
774 {
-
775 BoundExpression,
-
776 VarEqVar,
-
777 VarDiffVar,
-
778 VarEqCst,
-
779 VarDiffCst,
-
780 }
-
781
-
782 public BoundedLinearExpression(long lb, LinearExpr expr, long ub)
-
783 {
-
784 left_ = expr;
-
785 right_ = null;
-
786 lb_ = lb;
-
787 ub_ = ub;
-
788 type_ = Type.BoundExpression;
-
789 }
-
790
-
791 public BoundedLinearExpression(LinearExpr left, LinearExpr right, bool equality)
+ +
733 {
+
734 get {
+
735 return var_;
+
736 }
+
737 set {
+
738 var_ = value;
+
739 }
+
740 }
+
741
+ +
744 {
+
745 get {
+ +
747 }
+
748 }
+
749
+
750 public override string ToString()
+
751 {
+
752 return var_.Name ?? var_.ToString();
+
753 }
+
754
+
756 public string Name()
+
757 {
+
758 return var_.Name;
+
759 }
+
760
+
761 protected readonly int index_;
+ +
763}
+
764
+
773public sealed class BoolVar : IntVar, ILiteral
+
774{
+
775
+
776 public BoolVar(CpModelProto model, String name) : base(model, 0, 1, name)
+
777 {
+
778 }
+
779
+
780 public BoolVar(CpModelProto model, int index) : base(model, index)
+
781 {
+
782 }
+
783
+
785 public ILiteral Not()
+
786 {
+
787 return negation_ ??= new NotBoolVar(this);
+
788 }
+
789
+
792 {
-
793 left_ = left;
-
794 right_ = right;
-
795 lb_ = 0;
-
796 ub_ = 0;
-
797 type_ = equality ? Type.VarEqVar : Type.VarDiffVar;
-
798 }
-
799
-
800 public BoundedLinearExpression(LinearExpr left, long v, bool equality)
-
801 {
-
802 left_ = left;
-
803 right_ = null;
-
804 lb_ = v;
-
805 ub_ = 0;
-
806 type_ = equality ? Type.VarEqCst : Type.VarDiffCst;
-
807 }
-
808
-
809 bool IsTrue()
-
810 {
-
811 if (type_ == Type.VarEqVar)
-
812 {
-
813 return (object)left_ == (object)right_;
-
814 }
-
815 else if (type_ == Type.VarDiffVar)
-
816 {
-
817 return (object)left_ != (object)right_;
-
818 }
-
819 return false;
-
820 }
-
821
-
822 public static bool operator true(BoundedLinearExpression bie)
-
823 {
-
824 return bie.IsTrue();
-
825 }
-
826
-
827 public static bool operator false(BoundedLinearExpression bie)
-
828 {
-
829 return !bie.IsTrue();
-
830 }
-
831
-
832 public override string ToString()
-
833 {
-
834 switch (type_)
-
835 {
-
836 case Type.BoundExpression:
-
837 return String.Format("{0} <= {1} <= {2}", lb_, left_, ub_);
-
838 case Type.VarEqVar:
-
839 return String.Format("{0} == {1}", left_, right_);
-
840 case Type.VarDiffVar:
-
841 return String.Format("{0} != {1}", left_, right_);
-
842 case Type.VarEqCst:
-
843 return String.Format("{0} == {1}", left_, lb_);
-
844 case Type.VarDiffCst:
-
845 return String.Format("{0} != {1}", left_, lb_);
-
846 default:
-
847 throw new ArgumentException("Wrong mode in BoundedLinearExpression.");
-
848 }
-
849 }
-
850
- -
852 {
-
853 if (a.CtType != Type.BoundExpression || a.Ub != Int64.MaxValue)
-
854 {
-
855 throw new ArgumentException("Operator <= not supported for this BoundedLinearExpression");
-
856 }
-
857 return new BoundedLinearExpression(a.Lb, a.Left, v);
-
858 }
-
859
- -
861 {
-
862 if (a.CtType != Type.BoundExpression || a.Ub != Int64.MaxValue)
-
863 {
-
864 throw new ArgumentException("Operator < not supported for this BoundedLinearExpression");
-
865 }
-
866 return new BoundedLinearExpression(a.Lb, a.Left, v - 1);
-
867 }
-
868
- -
870 {
-
871 if (a.CtType != Type.BoundExpression || a.Lb != Int64.MinValue)
-
872 {
-
873 throw new ArgumentException("Operator >= not supported for this BoundedLinearExpression");
-
874 }
-
875 return new BoundedLinearExpression(v, a.Left, a.Ub);
-
876 }
-
877
- -
879 {
-
880 if (a.CtType != Type.BoundExpression || a.Lb != Int64.MinValue)
-
881 {
-
882 throw new ArgumentException("Operator < not supported for this BoundedLinearExpression");
-
883 }
-
884 return new BoundedLinearExpression(v + 1, a.Left, a.Ub);
-
885 }
-
886
- -
888 {
-
889 get {
-
890 return left_;
+
793 return (LinearExpr)Not();
+
794 }
+
795
+
796 private NotBoolVar negation_;
+
797}
+
798
+
799public sealed class NotBoolVar : LinearExpr, ILiteral
+
800{
+
801 public NotBoolVar(BoolVar boolvar)
+
802 {
+
803 boolvar_ = boolvar;
+
804 }
+
805
+
806 public int GetIndex()
+
807 {
+
808 return -boolvar_.GetIndex() - 1;
+
809 }
+
810
+
811 public int Index
+
812 {
+
813 get {
+
814 return GetIndex();
+
815 }
+
816 }
+
817
+
818 public ILiteral Not()
+
819 {
+
820 return boolvar_;
+
821 }
+
822
+ +
824 {
+
825 return (LinearExpr)Not();
+
826 }
+
827
+
828 public override string ToString()
+
829 {
+
830 return String.Format("Not({0})", boolvar_.ToString());
+
831 }
+
832
+
833 private readonly BoolVar boolvar_;
+
834}
+
835
+
844public sealed class BoundedLinearExpression
+
845{
+
846 public enum Type
+
847 {
+
848 BoundExpression,
+
849 VarEqVar,
+
850 VarDiffVar,
+
851 VarEqCst,
+
852 VarDiffCst,
+
853 }
+
854
+
855 public BoundedLinearExpression(long lb, LinearExpr expr, long ub)
+
856 {
+
857 left_ = expr;
+
858 right_ = null;
+
859 lb_ = lb;
+
860 ub_ = ub;
+
861 type_ = Type.BoundExpression;
+
862 }
+
863
+
864 public BoundedLinearExpression(LinearExpr left, LinearExpr right, bool equality)
+
865 {
+
866 left_ = left;
+
867 right_ = right;
+
868 lb_ = 0;
+
869 ub_ = 0;
+
870 type_ = equality ? Type.VarEqVar : Type.VarDiffVar;
+
871 }
+
872
+
873 public BoundedLinearExpression(LinearExpr left, long v, bool equality)
+
874 {
+
875 left_ = left;
+
876 right_ = null;
+
877 lb_ = v;
+
878 ub_ = 0;
+
879 type_ = equality ? Type.VarEqCst : Type.VarDiffCst;
+
880 }
+
881
+
882 bool IsTrue()
+
883 {
+
884 if (type_ == Type.VarEqVar)
+
885 {
+
886 return (object)left_ == (object)right_;
+
887 }
+
888 else if (type_ == Type.VarDiffVar)
+
889 {
+
890 return (object)left_ != (object)right_;
891 }
-
892 }
-
893
- -
895 {
-
896 get {
-
897 return right_;
-
898 }
-
899 }
-
900
-
901 public long Lb
-
902 {
-
903 get {
-
904 return lb_;
-
905 }
-
906 }
-
907
-
908 public long Ub
-
909 {
-
910 get {
-
911 return ub_;
-
912 }
-
913 }
-
914
- -
916 {
-
917 get {
-
918 return type_;
-
919 }
-
920 }
-
921
-
922 private LinearExpr left_;
-
923 private LinearExpr right_;
-
924 private long lb_;
-
925 private long ub_;
-
926 private Type type_;
-
927}
-
928
-
929} // namespace Google.OrTools.Sat
- -
BoolVar(CpModelProto model, String name)
-
BoolVar(CpModelProto model, int index)
- - - -
static BoundedLinearExpression operator<=(BoundedLinearExpression a, long v)
- - - -
BoundedLinearExpression(long lb, LinearExpr expr, long ub)
- -
BoundedLinearExpression(LinearExpr left, LinearExpr right, bool equality)
- - -
BoundedLinearExpression(LinearExpr left, long v, bool equality)
-
static BoundedLinearExpression operator<(BoundedLinearExpression a, long v)
-
static BoundedLinearExpression operator>(BoundedLinearExpression a, long v)
- -
static BoundedLinearExpression operator>=(BoundedLinearExpression a, long v)
+
892 return false;
+
893 }
+
894
+
895 public static bool operator true(BoundedLinearExpression bie)
+
896 {
+
897 return bie.IsTrue();
+
898 }
+
899
+
900 public static bool operator false(BoundedLinearExpression bie)
+
901 {
+
902 return !bie.IsTrue();
+
903 }
+
904
+
905 public override string ToString()
+
906 {
+
907 switch (type_)
+
908 {
+
909 case Type.BoundExpression:
+
910 return String.Format("{0} <= {1} <= {2}", lb_, left_, ub_);
+
911 case Type.VarEqVar:
+
912 return String.Format("{0} == {1}", left_, right_);
+
913 case Type.VarDiffVar:
+
914 return String.Format("{0} != {1}", left_, right_);
+
915 case Type.VarEqCst:
+
916 return String.Format("{0} == {1}", left_, lb_);
+
917 case Type.VarDiffCst:
+
918 return String.Format("{0} != {1}", left_, lb_);
+
919 default:
+
920 throw new ArgumentException("Wrong mode in BoundedLinearExpression.");
+
921 }
+
922 }
+
923
+ +
925 {
+
926 if (a.CtType != Type.BoundExpression || a.Ub != Int64.MaxValue)
+
927 {
+
928 throw new ArgumentException("Operator <= not supported for this BoundedLinearExpression");
+
929 }
+
930 return new BoundedLinearExpression(a.Lb, a.Left, v);
+
931 }
+
932
+ +
934 {
+
935 if (a.CtType != Type.BoundExpression || a.Ub != Int64.MaxValue)
+
936 {
+
937 throw new ArgumentException("Operator < not supported for this BoundedLinearExpression");
+
938 }
+
939 return new BoundedLinearExpression(a.Lb, a.Left, v - 1);
+
940 }
+
941
+ +
943 {
+
944 if (a.CtType != Type.BoundExpression || a.Lb != Int64.MinValue)
+
945 {
+
946 throw new ArgumentException("Operator >= not supported for this BoundedLinearExpression");
+
947 }
+
948 return new BoundedLinearExpression(v, a.Left, a.Ub);
+
949 }
+
950
+ +
952 {
+
953 if (a.CtType != Type.BoundExpression || a.Lb != Int64.MinValue)
+
954 {
+
955 throw new ArgumentException("Operator < not supported for this BoundedLinearExpression");
+
956 }
+
957 return new BoundedLinearExpression(v + 1, a.Left, a.Ub);
+
958 }
+
959
+ +
961 {
+
962 get {
+
963 return left_;
+
964 }
+
965 }
+
966
+ +
968 {
+
969 get {
+
970 return right_;
+
971 }
+
972 }
+
973
+
974 public long Lb
+
975 {
+
976 get {
+
977 return lb_;
+
978 }
+
979 }
+
980
+
981 public long Ub
+
982 {
+
983 get {
+
984 return ub_;
+
985 }
+
986 }
+
987
+ +
989 {
+
990 get {
+
991 return type_;
+
992 }
+
993 }
+
994
+
995 private LinearExpr left_;
+
996 private LinearExpr right_;
+
997 private long lb_;
+
998 private long ub_;
+
999 private Type type_;
+
1000}
+
1001
+
1002} // namespace Google.OrTools.Sat
+
Holds a Boolean variable.
+
BoolVar(CpModelProto model, String name)
+
BoolVar(CpModelProto model, int index)
+
ILiteral Not()
Returns the Boolean negation of that variable.
+
LinearExpr NotAsExpr()
Returns the Boolean negation of that variable as a linear expression.
+
Holds a linear constraint: expression ∈ domain
+
static BoundedLinearExpression operator<=(BoundedLinearExpression a, long v)
+ + + +
BoundedLinearExpression(long lb, LinearExpr expr, long ub)
+ +
BoundedLinearExpression(LinearExpr left, LinearExpr right, bool equality)
+ + +
BoundedLinearExpression(LinearExpr left, long v, bool equality)
+
static BoundedLinearExpression operator<(BoundedLinearExpression a, long v)
+
static BoundedLinearExpression operator>(BoundedLinearExpression a, long v)
+ +
static BoundedLinearExpression operator>=(BoundedLinearExpression a, long v)
A constraint programming problem.
Definition: CpModel.pb.cs:8643
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
static Domain VariableDomain(Google.OrTools.Sat.IntegerVariableProto variable_proto)
Definition: CpSatHelper.cs:64
- - - - -
IntVar(CpModelProto model, int index)
-
IntVar(CpModelProto model, Domain domain, string name)
- -
IntVar(CpModelProto model, long lb, long ub, string name)
-
IntegerVariableProto Proto
- -
IntegerVariableProto var_
+
Holds a integer variable with a discrete domain.
+
int GetIndex()
Returns the index of the variable in the underlying CpModelProto.
+
int Index
Returns the index of the variable in the underlying CpModelProto.
+
string Name()
Returns the name of the variable given upon creation.
+
IntVar(CpModelProto model, int index)
+
IntVar(CpModelProto model, Domain domain, string name)
+ +
IntVar(CpModelProto model, long lb, long ub, string name)
+
IntegerVariableProto Proto
The underlying IntegerVariableProto.
+ +
IntegerVariableProto var_
pbc::RepeatedField< long > Domain
The variable domain given as a sorted list of n disjoint intervals [min, max] and encoded as [min_0,...
Definition: CpModel.pb.cs:354
string Name
For debug/logging only.
Definition: CpModel.pb.cs:321
- -
LinearExprBuilder Add(LinearExpr expr)
-
LinearExprBuilder AddSum(IEnumerable< BoolVar > vars)
-
LinearExprBuilder AddSum(IEnumerable< ILiteral > literals)
-
LinearExprBuilder AddTerm(ILiteral literal, long coefficient)
-
LinearExprBuilder AddSum(IEnumerable< LinearExpr > exprs)
-
LinearExprBuilder AddWeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< int > coefficients)
- -
LinearExprBuilder AddWeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< long > coefficients)
- -
LinearExprBuilder Add(ILiteral literal)
-
LinearExprBuilder AddWeightedSum(IEnumerable< BoolVar > vars, IEnumerable< int > coefficients)
-
LinearExprBuilder AddTerm(LinearExpr expr, long coefficient)
-
LinearExprBuilder AddWeightedSum(IEnumerable< ILiteral > literals, IEnumerable< long > coefficients)
- - -
LinearExprBuilder AddWeightedSum(IEnumerable< BoolVar > vars, IEnumerable< long > coefficients)
-
LinearExprBuilder AddTerm(BoolVar var, long coefficient)
-
LinearExprBuilder Add(long constant)
-
LinearExprBuilder Add(BoolVar var)
-
LinearExprBuilder AddWeightedSum(IEnumerable< ILiteral > literals, IEnumerable< int > coefficients)
- -
static LinearExpr Affine(LinearExpr expr, long coeff, long offset)
-
static LinearExpr operator*(LinearExpr a, long v)
-
static LinearExpr Constant(long value)
-
static LinearExpr Sum(IEnumerable< LinearExpr > exprs)
-
static BoundedLinearExpression operator<(LinearExpr a, long v)
-
static LinearExpr Affine(BoolVar var, long coeff, long offset)
-
static BoundedLinearExpression operator==(LinearExpr a, LinearExpr b)
-
static LinearExpr Term(BoolVar var, long coeff)
-
static BoundedLinearExpression operator>(LinearExpr a, long v)
-
static BoundedLinearExpression operator>=(LinearExpr a, long v)
-
static BoundedLinearExpression operator<=(LinearExpr a, long v)
-
static LinearExpr WeightedSum(IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
-
static LinearExpr Prod(LinearExpr e, long v)
-
static LinearExpr WeightedSum(IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
-
static LinearExpr Term(ILiteral literal, long coeff)
-
static LinearExpr WeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
-
static LinearExpr Sum(IEnumerable< BoolVar > vars)
-
static LinearExpr WeightedSum(IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
-
static LinearExpr operator+(LinearExpr a, LinearExpr b)
-
static LinearExpr WeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
-
static BoundedLinearExpression operator<(LinearExpr a, LinearExpr b)
-
static BoundedLinearExpression operator>(LinearExpr a, LinearExpr b)
-
static BoundedLinearExpression operator<(long v, LinearExpr a)
-
static LinearExpr Affine(ILiteral literal, long coeff, long offset)
-
static long GetVarValueMap(LinearExpr e, long initial_coeff, Dictionary< IntVar, long > dict)
-
static BoundedLinearExpression operator>(long v, LinearExpr a)
-
static LinearExpr Term(LinearExpr expr, long coeff)
-
static LinearExpr RebuildLinearExprFromLinearExpressionProto(LinearExpressionProto proto, CpModelProto model)
-
static BoundedLinearExpression operator!=(LinearExpr a, LinearExpr b)
-
static LinearExpr Sum(IEnumerable< ILiteral > literals)
-
static LinearExpr operator-(LinearExpr a, LinearExpr b)
-
static LinearExpr WeightedSum(IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
-
static LinearExprBuilder NewBuilder(int sizeHint=2)
+
A builder class for linear expressions.
+
LinearExprBuilder Add(LinearExpr expr)
Adds expr to the builder.
+
LinearExprBuilder AddSum(IEnumerable< BoolVar > vars)
Adds sum(vars) to the builder.
+
LinearExprBuilder AddSum(IEnumerable< ILiteral > literals)
Adds sum(literals) to the builder.
+
LinearExprBuilder AddTerm(ILiteral literal, long coefficient)
Adds literal * coefficient to the builder.
+
LinearExprBuilder AddSum(IEnumerable< LinearExpr > exprs)
Adds sum(exprs) to the builder.
+
LinearExprBuilder AddWeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< int > coefficients)
Adds sum(exprs[i] * coeffs[i]) to the builder.
+ +
LinearExprBuilder AddWeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< long > coefficients)
Adds sum(exprs[i] * coeffs[i]) to the builder.
+ +
LinearExprBuilder Add(ILiteral literal)
Adds literal to the builder.
+
LinearExprBuilder AddWeightedSum(IEnumerable< BoolVar > vars, IEnumerable< int > coefficients)
Adds sum(vars[i] * coeffs[i]) to the builder.
+
LinearExprBuilder AddTerm(LinearExpr expr, long coefficient)
Adds expr * coefficient to the builder.
+
LinearExprBuilder AddWeightedSum(IEnumerable< ILiteral > literals, IEnumerable< long > coefficients)
Adds sum(literals[i] * coeffs[i]) to the builder.
+ + +
LinearExprBuilder AddWeightedSum(IEnumerable< BoolVar > vars, IEnumerable< long > coefficients)
Adds sum(vars[i] * coeffs[i]) to the builder.
+
LinearExprBuilder AddTerm(BoolVar var, long coefficient)
Adds var * coefficient to the builder.
+
LinearExprBuilder Add(long constant)
Adds constant to the builder.
+
LinearExprBuilder Add(BoolVar var)
Adds var to the builder.
+
LinearExprBuilder AddWeightedSum(IEnumerable< ILiteral > literals, IEnumerable< int > coefficients)
Adds sum(literals[i] * coeffs[i]) to the builder.
+
Holds a linear expression: sum (ai * xi) + b.
+
static LinearExpr Affine(LinearExpr expr, long coeff, long offset)
Creates expr * coeff + offset.
+
static LinearExpr operator*(LinearExpr a, long v)
+
static LinearExpr Constant(long value)
Creates a constant expression.
+
static LinearExpr Sum(IEnumerable< LinearExpr > exprs)
Creates Sum(exprs).
+
static BoundedLinearExpression operator<(LinearExpr a, long v)
+
static LinearExpr Affine(BoolVar var, long coeff, long offset)
Creates var * coeff + offset.
+
static BoundedLinearExpression operator==(LinearExpr a, LinearExpr b)
+
static LinearExpr Term(BoolVar var, long coeff)
Creates var * coeff.
+
static BoundedLinearExpression operator>(LinearExpr a, long v)
+
static BoundedLinearExpression operator>=(LinearExpr a, long v)
+
static BoundedLinearExpression operator<=(LinearExpr a, long v)
+
static LinearExpr WeightedSum(IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
Creates Sum(vars[i] * coeffs[i]).
+
static LinearExpr Prod(LinearExpr e, long v)
+
static LinearExpr WeightedSum(IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
Creates Sum(literals[i] * coeffs[i]).
+
static LinearExpr Term(ILiteral literal, long coeff)
Creates literal * coeff.
+
static LinearExpr WeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
Creates Sum(exprs[i] * coeffs[i]).
+
static LinearExpr Sum(IEnumerable< BoolVar > vars)
Creates Sum(vars).
+
static LinearExpr WeightedSum(IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
Creates Sum(vars[i] * coeffs[i]).
+
static LinearExpr operator+(LinearExpr a, LinearExpr b)
+
static LinearExpr WeightedSum(IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
Creates Sum(exprs[i] * coeffs[i]).
+
static BoundedLinearExpression operator<(LinearExpr a, LinearExpr b)
+
static BoundedLinearExpression operator>(LinearExpr a, LinearExpr b)
+
static BoundedLinearExpression operator<(long v, LinearExpr a)
+
static LinearExpr Affine(ILiteral literal, long coeff, long offset)
Creates literal * coeff + offset.
+
static long GetVarValueMap(LinearExpr e, long initial_coeff, Dictionary< IntVar, long > dict)
+
static BoundedLinearExpression operator>(long v, LinearExpr a)
+
static LinearExpr Term(LinearExpr expr, long coeff)
Creates expr * coeff.
+
static LinearExpr RebuildLinearExprFromLinearExpressionProto(LinearExpressionProto proto, CpModelProto model)
+
static BoundedLinearExpression operator!=(LinearExpr a, LinearExpr b)
+
static LinearExpr Sum(IEnumerable< ILiteral > literals)
Creates Sum(literals).
+
static LinearExpr operator-(LinearExpr a, LinearExpr b)
+
static LinearExpr WeightedSum(IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
Creates Sum(literals[i] * coeffs[i]).
+
static LinearExprBuilder NewBuilder(int sizeHint=2)
Creates a builder class for linear expression.
Some constraints supports linear expression instead of just using a reference to a variable.
Definition: CpModel.pb.cs:699
pbc::RepeatedField< int > Vars
Definition: CpModel.pb.cs:748
pbc::RepeatedField< long > Coeffs
Definition: CpModel.pb.cs:759
- - - - - - - + +
int GetIndex()
Returns the logical index of the literal.
+ +
ILiteral Not()
Returns the Boolean negation of the literal.
+ +
LinearExpr NotAsExpr()
Returns the Boolean negation of the literal as a linear expression.
+ - - - - +
Holds a Boolean variable or its negation.
+
int GetIndex()
Returns the logical index of the literal.
+
ILiteral Not()
Returns the Boolean negation of the literal.
+
LinearExpr NotAsExpr()
Returns the Boolean negation of the literal as a linear expression.
- - - -
Term(LinearExpr e, long c)
+ + + +
Term(LinearExpr e, long c)
diff --git a/docs/dotnet/IntervalVariables_8cs_source.html b/docs/dotnet/IntervalVariables_8cs_source.html index 146dc8906a..81a992351f 100644 --- a/docs/dotnet/IntervalVariables_8cs_source.html +++ b/docs/dotnet/IntervalVariables_8cs_source.html @@ -192,7 +192,7 @@ $(document).ready(function(){initNavTree('IntervalVariables_8cs_source.html','')
global::Google.OrTools.Sat.LinearExpressionProto End
Definition: CpModel.pb.cs:1926
global::Google.OrTools.Sat.LinearExpressionProto Start
Definition: CpModel.pb.cs:1914
-
int GetIndex()
The Indexraint in the model proto
+
int GetIndex()
The Index of the interval in the model proto
LinearExpr SizeExpr()
The size expression of the interval
IntervalConstraintProto Proto
The underlying interval proto
@@ -201,8 +201,8 @@ $(document).ready(function(){initNavTree('IntervalVariables_8cs_source.html','')
IntervalVar(CpModelProto model, LinearExpressionProto start, LinearExpressionProto size, LinearExpressionProto end, int is_present_index, string name)
IntervalVar(CpModelProto model, LinearExpressionProto start, LinearExpressionProto size, LinearExpressionProto end, string name)
- -
static LinearExpr RebuildLinearExprFromLinearExpressionProto(LinearExpressionProto proto, CpModelProto model)
+
Holds a linear expression: sum (ai * xi) + b.
+
static LinearExpr RebuildLinearExprFromLinearExpressionProto(LinearExpressionProto proto, CpModelProto model)
Some constraints supports linear expression instead of just using a reference to a variable.
Definition: CpModel.pb.cs:699
diff --git a/docs/dotnet/SearchHelpers_8cs.html b/docs/dotnet/SearchHelpers_8cs.html index a8739ae531..cc8f162c53 100644 --- a/docs/dotnet/SearchHelpers_8cs.html +++ b/docs/dotnet/SearchHelpers_8cs.html @@ -93,8 +93,10 @@ $(document).ready(function(){initNavTree('SearchHelpers_8cs.html',''); initResiz

Classes

class  CpSolverSolutionCallback
 Parent class to create a callback called at each solution. More...
 
class  ObjectiveSolutionPrinter
 A specialized solution printer. More...
 
- - + + @@ -313,7 +313,7 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable(); - + @@ -322,16 +322,16 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable(); - + - + - - + + @@ -341,7 +341,7 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable(); - + diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1AutomatonConstraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1AutomatonConstraint.html index 86b0c3c36b..df696d4a6f 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1AutomatonConstraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1AutomatonConstraint.html @@ -92,7 +92,7 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Autom

Specialized automaton constraint.

This constraint allows adding transitions to the automaton constraint incrementally.

-

Definition at line 274 of file Constraints.cs.

+

Definition at line 275 of file Constraints.cs.

diff --git a/docs/dotnet/SearchHelpers_8cs_source.html b/docs/dotnet/SearchHelpers_8cs_source.html index 86ada4e8f1..fb3ef07293 100644 --- a/docs/dotnet/SearchHelpers_8cs_source.html +++ b/docs/dotnet/SearchHelpers_8cs_source.html @@ -103,120 +103,120 @@ $(document).ready(function(){initNavTree('SearchHelpers_8cs_source.html',''); in
17namespace Google.OrTools.Sat
18{
19
- -
21{
-
22 public long Value(LinearExpr e)
-
23 {
-
24 List<Term> terms = new List<Term>();
-
25 terms.Add(new Term(e, 1));
-
26 long constant = 0;
-
27
-
28 while (terms.Count > 0)
-
29 {
-
30 Term term = terms[0];
-
31 terms.RemoveAt(0);
-
32 if (term.coefficient == 0)
-
33 continue;
-
34
-
35 if (term.expr is LinearExprBuilder a)
-
36 {
-
37 constant += term.coefficient * a.Offset;
-
38 foreach (Term sub in a.Terms)
-
39 {
-
40 if (term.coefficient == 1)
-
41 {
-
42 terms.Add(sub);
-
43 }
-
44 else
-
45 {
-
46 terms.Add(new Term(sub.expr, sub.coefficient * term.coefficient));
-
47 }
-
48 }
-
49 }
-
50 else if (term.expr is IntVar intVar)
-
51 {
-
52 int index = intVar.GetIndex();
-
53 long value = SolutionIntegerValue(index);
-
54 constant += term.coefficient * value;
-
55 }
-
56 else if (term.expr is NotBoolVar)
-
57 {
-
58 throw new ArgumentException("Cannot evaluate a literal in an integer expression.");
+ +
26{
+
32 public long Value(LinearExpr e)
+
33 {
+
34 List<Term> terms = new List<Term>();
+
35 terms.Add(new Term(e, 1));
+
36 long constant = 0;
+
37
+
38 while (terms.Count > 0)
+
39 {
+
40 Term term = terms[0];
+
41 terms.RemoveAt(0);
+
42 if (term.coefficient == 0)
+
43 continue;
+
44
+
45 if (term.expr is LinearExprBuilder a)
+
46 {
+
47 constant += term.coefficient * a.Offset;
+
48 foreach (Term sub in a.Terms)
+
49 {
+
50 if (term.coefficient == 1)
+
51 {
+
52 terms.Add(sub);
+
53 }
+
54 else
+
55 {
+
56 terms.Add(new Term(sub.expr, sub.coefficient * term.coefficient));
+
57 }
+
58 }
59 }
-
60 else
+
60 else if (term.expr is IntVar intVar)
61 {
-
62 throw new ArgumentException("Cannot evaluate '" + term.expr.ToString() + "' in an integer expression");
-
63 }
-
64 }
-
65 return constant;
-
66 }
-
67
-
68 public Boolean BooleanValue(ILiteral literal)
-
69 {
-
70 if (literal is BoolVar || literal is NotBoolVar)
-
71 {
-
72 int index = literal.GetIndex();
-
73 return SolutionBooleanValue(index);
+
62 int index = intVar.GetIndex();
+
63 long value = SolutionIntegerValue(index);
+
64 constant += term.coefficient * value;
+
65 }
+
66 else if (term.expr is NotBoolVar)
+
67 {
+
68 throw new ArgumentException("Cannot evaluate a literal in an integer expression.");
+
69 }
+
70 else
+
71 {
+
72 throw new ArgumentException("Cannot evaluate '" + term.expr.ToString() + "' in an integer expression");
+
73 }
74 }
-
75 else
-
76 {
-
77 throw new ArgumentException("Cannot evaluate '" + literal.ToString() + "' as a boolean literal");
-
78 }
-
79 }
-
80}
-
81
- -
83{
-
84 private DateTime _startTime;
-
85 private int _solutionCount;
-
86
- -
88 {
-
89 _startTime = DateTime.Now;
-
90 }
-
91
-
92 public override void OnSolutionCallback()
-
93 {
-
94 var currentTime = DateTime.Now;
-
95 var objective = ObjectiveValue();
-
96 var objectiveBound = BestObjectiveBound();
-
97 var objLb = Math.Min(objective, objectiveBound);
-
98 var objUb = Math.Max(objective, objectiveBound);
-
99 var time = currentTime - _startTime;
-
100
-
101 Console.WriteLine(
-
102 value: $"Solution {_solutionCount}, time = {time.TotalSeconds} s, objective = [{objLb}, {objUb}]");
-
103
-
104 _solutionCount++;
-
105 }
+
75 return constant;
+
76 }
+
77
+
83 public Boolean BooleanValue(ILiteral literal)
+
84 {
+
85 if (literal is BoolVar || literal is NotBoolVar)
+
86 {
+
87 int index = literal.GetIndex();
+
88 return SolutionBooleanValue(index);
+
89 }
+
90 else
+
91 {
+
92 throw new ArgumentException("Cannot evaluate '" + literal.ToString() + "' as a boolean literal");
+
93 }
+
94 }
+
95}
+
96
+ +
103{
+
104 private DateTime _startTime;
+
105 private int _solutionCount;
106
-
107 public int solutionCount() => _solutionCount;
-
108}
-
109
-
110} // namespace Google.OrTools.Sat
- - - -
Boolean BooleanValue(ILiteral literal)
- - - - - - + +
108 {
+
109 _startTime = DateTime.Now;
+
110 }
+
111
+
112 public override void OnSolutionCallback()
+
113 {
+
114 var currentTime = DateTime.Now;
+
115 var objective = ObjectiveValue();
+
116 var objectiveBound = BestObjectiveBound();
+
117 var objLb = Math.Min(objective, objectiveBound);
+
118 var objUb = Math.Max(objective, objectiveBound);
+
119 var time = currentTime - _startTime;
+
120
+
121 Console.WriteLine(
+
122 value: $"Solution {_solutionCount}, time = {time.TotalSeconds} s, objective = [{objLb}, {objUb}]");
+
123
+
124 _solutionCount++;
+
125 }
+
126
+
127 public int solutionCount() => _solutionCount;
+
128}
+
129
+
130} // namespace Google.OrTools.Sat
+
Holds a Boolean variable.
+
Parent class to create a callback called at each solution.
+
long Value(LinearExpr e)
Returns the value of a linear expression in the current solution.
+
Boolean BooleanValue(ILiteral literal)
Returns the Boolean value of a literal in the current solution.
+
Holds a integer variable with a discrete domain.
+
A builder class for linear expressions.
+
Holds a linear expression: sum (ai * xi) + b.
+ +
A specialized solution printer.
+ - + - - +
Holds a Boolean variable or its negation.
+
int GetIndex()
Returns the logical index of the literal.
- - - + + + diff --git a/docs/dotnet/annotated.html b/docs/dotnet/annotated.html index ddb5fb56f4..197655023a 100644 --- a/docs/dotnet/annotated.html +++ b/docs/dotnet/annotated.html @@ -299,8 +299,8 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();

@@ -101,19 +101,19 @@ Public Member Functions - + - +

Public Member Functions

AutomatonConstraint AddTransition (int tail, int head, long label)
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -141,7 +141,7 @@ Properties
-

Definition at line 276 of file Constraints.cs.

+

Definition at line 277 of file Constraints.cs.

@@ -186,7 +186,7 @@ Properties
-

Definition at line 285 of file Constraints.cs.

+

Definition at line 286 of file Constraints.cs.

@@ -214,9 +214,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -244,9 +244,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -271,9 +271,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -297,9 +297,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoolVar.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoolVar.html index bd02a82153..0f82af8f2d 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoolVar.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoolVar.html @@ -91,8 +91,10 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1BoolV

Detailed Description

-
-

Definition at line 710 of file IntegerExpressions.cs.

+

Holds a Boolean variable.

+

This class must be constructed from the CpModel class.

+ +

Definition at line 773 of file IntegerExpressions.cs.

@@ -101,53 +103,75 @@ Public Member Functions + + + + +

Public Member Functions

 BoolVar (CpModelProto model, int index)
 
ILiteral Not ()
 Returns the Boolean negation of that variable. More...
 
LinearExpr NotAsExpr ()
 Returns the Boolean negation of that variable as a linear expression. More...
 
int GetIndex ()
 Returns the index of the variable in the underlying CpModelProto. More...
 
override string ToString ()
 
string Name ()
 Returns the name of the variable given upon creation. More...
 
int GetIndex ()
 Returns the logical index of the literal. More...
 
+ + + + + + + + + + + + + + + + + @@ -216,10 +240,13 @@ Protected Attributes + + +

Static Public Member Functions

static LinearExpr Sum (IEnumerable< LinearExpr > exprs)
 Creates Sum(exprs). More...
 
static LinearExpr Sum (IEnumerable< ILiteral > literals)
 Creates Sum(literals). More...
 
static LinearExpr Sum (IEnumerable< BoolVar > vars)
 Creates Sum(vars). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr Term (LinearExpr expr, long coeff)
 Creates expr * coeff. More...
 
static LinearExpr Term (ILiteral literal, long coeff)
 Creates literal * coeff. More...
 
static LinearExpr Term (BoolVar var, long coeff)
 Creates var * coeff. More...
 
static LinearExpr Affine (LinearExpr expr, long coeff, long offset)
 Creates expr * coeff + offset. More...
 
static LinearExpr Affine (ILiteral literal, long coeff, long offset)
 Creates literal * coeff + offset. More...
 
static LinearExpr Affine (BoolVar var, long coeff, long offset)
 Creates var * coeff + offset. More...
 
static LinearExpr Constant (long value)
 Creates a constant expression. More...
 
static LinearExprBuilder NewBuilder (int sizeHint=2)
 Creates a builder class for linear expression. More...
 
static LinearExpr operator+ (LinearExpr a, LinearExpr b)
 

Properties

int Index [get]
 Returns the index of the variable in the underlying CpModelProto. More...
 
IntegerVariableProto Proto [get, set]
 The underlying IntegerVariableProto. More...
 
Domain Domain [get]
 Returns the domain of the variable. More...
 

Constructor & Destructor Documentation

@@ -257,7 +284,7 @@ Properties
-

Definition at line 713 of file IntegerExpressions.cs.

+

Definition at line 776 of file IntegerExpressions.cs.

@@ -295,7 +322,7 @@ Properties
-

Definition at line 717 of file IntegerExpressions.cs.

+

Definition at line 780 of file IntegerExpressions.cs.

@@ -340,7 +367,9 @@ Properties
-

Definition at line 167 of file IntegerExpressions.cs.

+

Creates var * coeff + offset.

+ +

Definition at line 190 of file IntegerExpressions.cs.

@@ -384,7 +413,9 @@ Properties
-

Definition at line 162 of file IntegerExpressions.cs.

+

Creates literal * coeff + offset.

+ +

Definition at line 184 of file IntegerExpressions.cs.

@@ -428,7 +459,9 @@ Properties
-

Definition at line 153 of file IntegerExpressions.cs.

+

Creates expr * coeff + offset.

+ +

Definition at line 174 of file IntegerExpressions.cs.

@@ -456,7 +489,9 @@ Properties
-

Definition at line 172 of file IntegerExpressions.cs.

+

Creates a constant expression.

+ +

Definition at line 196 of file IntegerExpressions.cs.

@@ -483,6 +518,8 @@ Properties
+

Returns the logical index of the literal.

+

Implemented in NotBoolVar.

@@ -510,7 +547,9 @@ Properties
-

Definition at line 667 of file IntegerExpressions.cs.

+

Returns the index of the variable in the underlying CpModelProto.

+ +

Definition at line 718 of file IntegerExpressions.cs.

@@ -554,7 +593,7 @@ Properties
-

Definition at line 323 of file IntegerExpressions.cs.

+

Definition at line 348 of file IntegerExpressions.cs.

@@ -581,7 +620,9 @@ Properties
-

Definition at line 701 of file IntegerExpressions.cs.

+

Returns the name of the variable given upon creation.

+ +

Definition at line 756 of file IntegerExpressions.cs.

@@ -609,7 +650,9 @@ Properties
-

Definition at line 177 of file IntegerExpressions.cs.

+

Creates a builder class for linear expression.

+ +

Definition at line 202 of file IntegerExpressions.cs.

@@ -636,9 +679,11 @@ Properties
+

Returns the Boolean negation of that variable.

+

Implements ILiteral.

-

Definition at line 721 of file IntegerExpressions.cs.

+

Definition at line 785 of file IntegerExpressions.cs.

@@ -665,9 +710,11 @@ Properties
+

Returns the Boolean negation of that variable as a linear expression.

+

Implements ILiteral.

-

Definition at line 726 of file IntegerExpressions.cs.

+

Definition at line 791 of file IntegerExpressions.cs.

@@ -705,7 +752,7 @@ Properties
-

Definition at line 232 of file IntegerExpressions.cs.

+

Definition at line 257 of file IntegerExpressions.cs.

@@ -743,7 +790,7 @@ Properties
-

Definition at line 242 of file IntegerExpressions.cs.

+

Definition at line 267 of file IntegerExpressions.cs.

@@ -781,7 +828,7 @@ Properties
-

Definition at line 212 of file IntegerExpressions.cs.

+

Definition at line 237 of file IntegerExpressions.cs.

@@ -819,7 +866,7 @@ Properties
-

Definition at line 217 of file IntegerExpressions.cs.

+

Definition at line 242 of file IntegerExpressions.cs.

@@ -857,7 +904,7 @@ Properties
-

Definition at line 182 of file IntegerExpressions.cs.

+

Definition at line 207 of file IntegerExpressions.cs.

@@ -895,7 +942,7 @@ Properties
-

Definition at line 187 of file IntegerExpressions.cs.

+

Definition at line 212 of file IntegerExpressions.cs.

@@ -933,7 +980,7 @@ Properties
-

Definition at line 192 of file IntegerExpressions.cs.

+

Definition at line 217 of file IntegerExpressions.cs.

@@ -961,7 +1008,7 @@ Properties
-

Definition at line 222 of file IntegerExpressions.cs.

+

Definition at line 247 of file IntegerExpressions.cs.

@@ -999,7 +1046,7 @@ Properties
-

Definition at line 197 of file IntegerExpressions.cs.

+

Definition at line 222 of file IntegerExpressions.cs.

@@ -1037,7 +1084,7 @@ Properties
-

Definition at line 202 of file IntegerExpressions.cs.

+

Definition at line 227 of file IntegerExpressions.cs.

@@ -1075,7 +1122,7 @@ Properties
-

Definition at line 207 of file IntegerExpressions.cs.

+

Definition at line 232 of file IntegerExpressions.cs.

@@ -1113,7 +1160,7 @@ Properties
-

Definition at line 302 of file IntegerExpressions.cs.

+

Definition at line 327 of file IntegerExpressions.cs.

@@ -1151,7 +1198,7 @@ Properties
-

Definition at line 277 of file IntegerExpressions.cs.

+

Definition at line 302 of file IntegerExpressions.cs.

@@ -1189,7 +1236,7 @@ Properties
-

Definition at line 282 of file IntegerExpressions.cs.

+

Definition at line 307 of file IntegerExpressions.cs.

@@ -1227,7 +1274,7 @@ Properties
-

Definition at line 297 of file IntegerExpressions.cs.

+

Definition at line 322 of file IntegerExpressions.cs.

@@ -1265,7 +1312,7 @@ Properties
-

Definition at line 267 of file IntegerExpressions.cs.

+

Definition at line 292 of file IntegerExpressions.cs.

@@ -1303,7 +1350,7 @@ Properties
-

Definition at line 272 of file IntegerExpressions.cs.

+

Definition at line 297 of file IntegerExpressions.cs.

@@ -1341,7 +1388,7 @@ Properties
-

Definition at line 227 of file IntegerExpressions.cs.

+

Definition at line 252 of file IntegerExpressions.cs.

@@ -1379,7 +1426,7 @@ Properties
-

Definition at line 237 of file IntegerExpressions.cs.

+

Definition at line 262 of file IntegerExpressions.cs.

@@ -1417,7 +1464,7 @@ Properties
-

Definition at line 292 of file IntegerExpressions.cs.

+

Definition at line 317 of file IntegerExpressions.cs.

@@ -1455,7 +1502,7 @@ Properties
-

Definition at line 257 of file IntegerExpressions.cs.

+

Definition at line 282 of file IntegerExpressions.cs.

@@ -1493,7 +1540,7 @@ Properties
-

Definition at line 262 of file IntegerExpressions.cs.

+

Definition at line 287 of file IntegerExpressions.cs.

@@ -1531,7 +1578,7 @@ Properties
-

Definition at line 287 of file IntegerExpressions.cs.

+

Definition at line 312 of file IntegerExpressions.cs.

@@ -1569,7 +1616,7 @@ Properties
-

Definition at line 247 of file IntegerExpressions.cs.

+

Definition at line 272 of file IntegerExpressions.cs.

@@ -1607,7 +1654,7 @@ Properties
-

Definition at line 252 of file IntegerExpressions.cs.

+

Definition at line 277 of file IntegerExpressions.cs.

@@ -1645,7 +1692,7 @@ Properties
-

Definition at line 307 of file IntegerExpressions.cs.

+

Definition at line 332 of file IntegerExpressions.cs.

@@ -1683,7 +1730,7 @@ Properties
-

Definition at line 373 of file IntegerExpressions.cs.

+

Definition at line 398 of file IntegerExpressions.cs.

@@ -1711,7 +1758,9 @@ Properties
-

Definition at line 96 of file IntegerExpressions.cs.

+

Creates Sum(vars).

+ +

Definition at line 107 of file IntegerExpressions.cs.

@@ -1739,7 +1788,9 @@ Properties
-

Definition at line 91 of file IntegerExpressions.cs.

+

Creates Sum(literals).

+ +

Definition at line 101 of file IntegerExpressions.cs.

@@ -1767,7 +1818,9 @@ Properties
-

Definition at line 86 of file IntegerExpressions.cs.

+

Creates Sum(exprs).

+ +

Definition at line 95 of file IntegerExpressions.cs.

@@ -1805,7 +1858,9 @@ Properties
-

Definition at line 148 of file IntegerExpressions.cs.

+

Creates var * coeff.

+ +

Definition at line 168 of file IntegerExpressions.cs.

@@ -1843,7 +1898,9 @@ Properties
-

Definition at line 136 of file IntegerExpressions.cs.

+

Creates literal * coeff.

+ +

Definition at line 155 of file IntegerExpressions.cs.

@@ -1881,7 +1938,9 @@ Properties
-

Definition at line 131 of file IntegerExpressions.cs.

+

Creates expr * coeff.

+ +

Definition at line 149 of file IntegerExpressions.cs.

@@ -1908,7 +1967,7 @@ Properties
-

Definition at line 696 of file IntegerExpressions.cs.

+

Definition at line 750 of file IntegerExpressions.cs.

@@ -1946,7 +2005,9 @@ Properties
-

Definition at line 121 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 137 of file IntegerExpressions.cs.

@@ -1984,7 +2045,9 @@ Properties
-

Definition at line 126 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 143 of file IntegerExpressions.cs.

@@ -2022,7 +2085,9 @@ Properties
-

Definition at line 111 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 125 of file IntegerExpressions.cs.

@@ -2060,7 +2125,9 @@ Properties
-

Definition at line 116 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 131 of file IntegerExpressions.cs.

@@ -2098,7 +2165,9 @@ Properties
-

Definition at line 101 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 113 of file IntegerExpressions.cs.

@@ -2136,7 +2205,9 @@ Properties
-

Definition at line 106 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 119 of file IntegerExpressions.cs.

@@ -2161,7 +2232,7 @@ Properties
-

Definition at line 706 of file IntegerExpressions.cs.

+

Definition at line 761 of file IntegerExpressions.cs.

@@ -2185,7 +2256,7 @@ Properties
-

Definition at line 707 of file IntegerExpressions.cs.

+

Definition at line 762 of file IntegerExpressions.cs.

@@ -2210,7 +2281,9 @@ Properties
-

Definition at line 689 of file IntegerExpressions.cs.

+

Returns the domain of the variable.

+ +

Definition at line 743 of file IntegerExpressions.cs.

@@ -2234,7 +2307,9 @@ Properties
-

Definition at line 672 of file IntegerExpressions.cs.

+

Returns the index of the variable in the underlying CpModelProto.

+ +

Definition at line 724 of file IntegerExpressions.cs.

@@ -2258,7 +2333,9 @@ Properties
-

Definition at line 679 of file IntegerExpressions.cs.

+

The underlying IntegerVariableProto.

+ +

Definition at line 732 of file IntegerExpressions.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoundedLinearExpression.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoundedLinearExpression.html index 8f6dc97541..e60d33c15c 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoundedLinearExpression.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1BoundedLinearExpression.html @@ -91,8 +91,10 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Bound

Detailed Description

-
-

Definition at line 771 of file IntegerExpressions.cs.

+

Holds a linear constraint: expression ∈ domain

+

This class must be constructed from the CpModel class or from the comparison operators.

+ +

Definition at line 844 of file IntegerExpressions.cs.

@@ -166,7 +168,7 @@ Properties

Public Types

VarDiffCst 
-

Definition at line 773 of file IntegerExpressions.cs.

+

Definition at line 846 of file IntegerExpressions.cs.

@@ -211,7 +213,7 @@ Properties
-

Definition at line 782 of file IntegerExpressions.cs.

+

Definition at line 855 of file IntegerExpressions.cs.

@@ -255,7 +257,7 @@ Properties
-

Definition at line 791 of file IntegerExpressions.cs.

+

Definition at line 864 of file IntegerExpressions.cs.

@@ -299,7 +301,7 @@ Properties
-

Definition at line 800 of file IntegerExpressions.cs.

+

Definition at line 873 of file IntegerExpressions.cs.

@@ -328,7 +330,7 @@ Properties
-

Definition at line 827 of file IntegerExpressions.cs.

+

Definition at line 900 of file IntegerExpressions.cs.

@@ -356,7 +358,7 @@ Properties
-

Definition at line 822 of file IntegerExpressions.cs.

+

Definition at line 895 of file IntegerExpressions.cs.

@@ -394,7 +396,7 @@ Properties
-

Definition at line 860 of file IntegerExpressions.cs.

+

Definition at line 933 of file IntegerExpressions.cs.

@@ -432,7 +434,7 @@ Properties
-

Definition at line 851 of file IntegerExpressions.cs.

+

Definition at line 924 of file IntegerExpressions.cs.

@@ -470,7 +472,7 @@ Properties
-

Definition at line 878 of file IntegerExpressions.cs.

+

Definition at line 951 of file IntegerExpressions.cs.

@@ -508,7 +510,7 @@ Properties
-

Definition at line 869 of file IntegerExpressions.cs.

+

Definition at line 942 of file IntegerExpressions.cs.

@@ -535,7 +537,7 @@ Properties
-

Definition at line 832 of file IntegerExpressions.cs.

+

Definition at line 905 of file IntegerExpressions.cs.

@@ -560,7 +562,7 @@ Properties
-

Definition at line 915 of file IntegerExpressions.cs.

+

Definition at line 988 of file IntegerExpressions.cs.

@@ -584,7 +586,7 @@ Properties
-

Definition at line 901 of file IntegerExpressions.cs.

+

Definition at line 974 of file IntegerExpressions.cs.

@@ -608,7 +610,7 @@ Properties
-

Definition at line 887 of file IntegerExpressions.cs.

+

Definition at line 960 of file IntegerExpressions.cs.

@@ -632,7 +634,7 @@ Properties
-

Definition at line 894 of file IntegerExpressions.cs.

+

Definition at line 967 of file IntegerExpressions.cs.

@@ -656,7 +658,7 @@ Properties
-

Definition at line 908 of file IntegerExpressions.cs.

+

Definition at line 981 of file IntegerExpressions.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CircuitConstraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CircuitConstraint.html index c28401475a..3ec9953521 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CircuitConstraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CircuitConstraint.html @@ -92,7 +92,7 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Circu

Specialized circuit constraint.

This constraint allows adding arcs to the circuit constraint incrementally.

-

Definition at line 83 of file Constraints.cs.

+

Definition at line 84 of file Constraints.cs.

@@ -102,19 +102,19 @@ Public Member Functions - + - +

Public Member Functions

 Add an arc to the graph of the circuit constraint. More...
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -142,7 +142,7 @@ Properties
-

Definition at line 85 of file Constraints.cs.

+

Definition at line 86 of file Constraints.cs.

@@ -197,7 +197,7 @@ Properties -

Definition at line 98 of file Constraints.cs.

+

Definition at line 99 of file Constraints.cs.

@@ -225,9 +225,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -255,9 +255,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -282,9 +282,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -308,9 +308,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1Constraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1Constraint.html index ed5f2c9b23..03e6ef0152 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1Constraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1Constraint.html @@ -92,26 +92,26 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Const

Wrapper around a ConstraintProto.

Constraints created by the CpModel class are automatically added to the model. One needs this class to add an enforcement literal to a constraint.

-

Definition at line 27 of file Constraints.cs.

+

Definition at line 28 of file Constraints.cs.

- + - +

Public Member Functions

 Constraint (CpModelProto model)
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -139,7 +139,7 @@ Properties
-

Definition at line 29 of file Constraints.cs.

+

Definition at line 30 of file Constraints.cs.

@@ -168,9 +168,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -198,9 +198,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -225,9 +225,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -251,9 +251,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolver.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolver.html index 26ecd39c7d..41fdf1a0bc 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolver.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolver.html @@ -89,25 +89,29 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1CpSol

Detailed Description

-

Wrapper around the SAT solver

-

This class proposes different solve() methods, as well as accessors to get the values of variables in the best solution, as well as general statistics of the search.

+

Wrapper around the SAT solver.

+

This class proposes a

+
CpSolverStatus Solve(CpModel model, SolutionCallback cb=null)
Solves the given model, and returns the solve status.
Definition: CpSolver.cs:32
+

method, as well as accessors to get the values of variables in the best solution, as well as general statistics of the search.

Definition at line 29 of file CpSolver.cs.

- + + + - + - + @@ -115,7 +119,7 @@ Public Member Functions - + @@ -135,7 +139,7 @@ Public Member Functions - + @@ -171,9 +175,9 @@ Properties

Public Member Functions

CpSolverStatus Solve (CpModel model, SolutionCallback cb=null)
 Solves the given model, and returns the solve status More...
 Solves the given model, and returns the solve status. More...
 
CpSolverStatus SolveWithSolutionCallback (CpModel model, SolutionCallback cb)
 Deprecated, use Solve() instead. More...
 
CpSolverStatus SearchAllSolutions (CpModel model, SolutionCallback cb)
 Deprecated, use Solve() instead. More...
 
void StopSearch ()
 Stops the search asynchronously More...
 Stops the search asynchronously. More...
 
String ResponseStats ()
 Statistics on the solution found as a string More...
 Statistics on the solution found as a string. More...
 
void SetLogCallback (StringToVoidDelegate del)
 
 Returns the value of a linear expression in the last solution found. More...
 
Boolean BooleanValue (ILiteral literal)
 Returns the Boolean value of a linear expression in the last solution found. More...
 Returns the Boolean value of a literal in the last solution found. More...
 
long NumBranches ()
 Returns the number of branches explored during search. More...

Properties

double ObjectiveValue [get]
 The best objective value found during search More...
 The best objective value found during search. More...
 
double BestObjectiveBound [get]
 The best lower bound found when minimizing, of the best upper bound found when maximizing More...
-

Returns the Boolean value of a linear expression in the last solution found.

+

Returns the Boolean value of a literal in the last solution found.

-

Definition at line 206 of file CpSolver.cs.

+

Definition at line 208 of file CpSolver.cs.

@@ -202,7 +206,7 @@ Properties

Returns the number of branches explored during search.

-

Definition at line 227 of file CpSolver.cs.

+

Definition at line 229 of file CpSolver.cs.

@@ -231,7 +235,7 @@ Properties

Returns the number of conflicts created during search.

-

Definition at line 233 of file CpSolver.cs.

+

Definition at line 235 of file CpSolver.cs.

@@ -258,9 +262,9 @@ Properties
-

Statistics on the solution found as a string

+

Statistics on the solution found as a string.

-

Definition at line 100 of file CpSolver.cs.

+

Definition at line 102 of file CpSolver.cs.

@@ -298,7 +302,9 @@ Properties
-

Definition at line 68 of file CpSolver.cs.

+

Deprecated, use Solve() instead.

+ +

Definition at line 70 of file CpSolver.cs.

@@ -326,7 +332,7 @@ Properties
-

Definition at line 136 of file CpSolver.cs.

+

Definition at line 138 of file CpSolver.cs.

@@ -355,7 +361,7 @@ Properties

Returns some information on how the solution was found, or the reason why the model or the parameters are invalid.

-

Definition at line 253 of file CpSolver.cs.

+

Definition at line 257 of file CpSolver.cs.

@@ -393,7 +399,7 @@ Properties
-

Solves the given model, and returns the solve status

+

Solves the given model, and returns the solve status.

Definition at line 32 of file CpSolver.cs.

@@ -433,7 +439,9 @@ Properties
-

Definition at line 62 of file CpSolver.cs.

+

Deprecated, use Solve() instead.

+ +

Definition at line 63 of file CpSolver.cs.

@@ -460,9 +468,9 @@ Properties
-

Stops the search asynchronously

+

Stops the search asynchronously.

-

Definition at line 79 of file CpSolver.cs.

+

Definition at line 81 of file CpSolver.cs.

@@ -489,7 +497,7 @@ Properties
-

Definition at line 244 of file CpSolver.cs.

+

Definition at line 246 of file CpSolver.cs.

@@ -519,7 +527,7 @@ Properties

Returns the value of a linear expression in the last solution found.

-

Definition at line 153 of file CpSolver.cs.

+

Definition at line 155 of file CpSolver.cs.

@@ -548,7 +556,7 @@ Properties

Returns the wall time of the search.

-

Definition at line 239 of file CpSolver.cs.

+

Definition at line 241 of file CpSolver.cs.

@@ -575,7 +583,7 @@ Properties

The best lower bound found when minimizing, of the best upper bound found when maximizing

-

Definition at line 118 of file CpSolver.cs.

+

Definition at line 120 of file CpSolver.cs.

@@ -599,9 +607,9 @@ Properties
-

The best objective value found during search

+

The best objective value found during search.

-

Definition at line 106 of file CpSolver.cs.

+

Definition at line 108 of file CpSolver.cs.

@@ -625,7 +633,7 @@ Properties
-

Definition at line 141 of file CpSolver.cs.

+

Definition at line 143 of file CpSolver.cs.

@@ -651,7 +659,7 @@ Properties

The parameters of the search, stored as a string.

-

Definition at line 126 of file CpSolver.cs.

+

Definition at line 128 of file CpSolver.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolverSolutionCallback.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolverSolutionCallback.html index d18efb5dc2..2cf42452eb 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolverSolutionCallback.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CpSolverSolutionCallback.html @@ -90,14 +90,17 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1CpSol

Detailed Description

-
-

Definition at line 20 of file SearchHelpers.cs.

+

Parent class to create a callback called at each solution.

+ +

Definition at line 25 of file SearchHelpers.cs.

+ + @@ -194,7 +197,9 @@ Protected Attributes

Public Member Functions

long Value (LinearExpr e)
 Returns the value of a linear expression in the current solution. More...
 
Boolean BooleanValue (ILiteral literal)
 Returns the Boolean value of a literal in the current solution. More...
 
void Dispose ()
 
-

Definition at line 68 of file SearchHelpers.cs.

+

Returns the Boolean value of a literal in the current solution.

+ +

Definition at line 83 of file SearchHelpers.cs.

@@ -630,7 +635,9 @@ Protected Attributes
-

Definition at line 22 of file SearchHelpers.cs.

+

Returns the value of a linear expression in the current solution.

+ +

Definition at line 32 of file SearchHelpers.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CumulativeConstraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CumulativeConstraint.html index fe3bc922bd..9b7285b49a 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CumulativeConstraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1CumulativeConstraint.html @@ -92,7 +92,7 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Cumul

Specialized cumulative constraint.

This constraint allows adding (interval, demand) pairs to the cumulative constraint incrementally.

-

Definition at line 363 of file Constraints.cs.

+

Definition at line 364 of file Constraints.cs.

@@ -105,19 +105,19 @@ Public Member Functions - + - +

Public Member Functions

 Adds all pairs (interval, demand) to the constraint. More...
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -155,7 +155,7 @@ Properties
-

Definition at line 365 of file Constraints.cs.

+

Definition at line 366 of file Constraints.cs.

@@ -196,7 +196,7 @@ Properties

Adds a pair (interval, demand) to the constraint.

-

Definition at line 371 of file Constraints.cs.

+

Definition at line 372 of file Constraints.cs.

@@ -236,7 +236,7 @@ Properties

Adds all pairs (interval, demand) to the constraint.

-

Definition at line 381 of file Constraints.cs.

+

Definition at line 382 of file Constraints.cs.

@@ -264,9 +264,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -294,9 +294,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -321,9 +321,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -347,9 +347,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntVar.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntVar.html index e5a9d1530c..3947e29004 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntVar.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntVar.html @@ -91,8 +91,10 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1IntVa

Detailed Description

-
-

Definition at line 639 of file IntegerExpressions.cs.

+

Holds a integer variable with a discrete domain.

+

This class must be constructed from the CpModel class.

+ +

Definition at line 689 of file IntegerExpressions.cs.

@@ -103,47 +105,66 @@ Public Member Functions + +

Public Member Functions

 IntVar (CpModelProto model, int index)
 
int GetIndex ()
 Returns the index of the variable in the underlying CpModelProto. More...
 
override string ToString ()
 
string Name ()
 Returns the name of the variable given upon creation. More...
 
+ + + + + + + + + + + + + + + + + @@ -212,10 +233,13 @@ Protected Attributes + + +

Static Public Member Functions

static LinearExpr Sum (IEnumerable< LinearExpr > exprs)
 Creates Sum(exprs). More...
 
static LinearExpr Sum (IEnumerable< ILiteral > literals)
 Creates Sum(literals). More...
 
static LinearExpr Sum (IEnumerable< BoolVar > vars)
 Creates Sum(vars). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr Term (LinearExpr expr, long coeff)
 Creates expr * coeff. More...
 
static LinearExpr Term (ILiteral literal, long coeff)
 Creates literal * coeff. More...
 
static LinearExpr Term (BoolVar var, long coeff)
 Creates var * coeff. More...
 
static LinearExpr Affine (LinearExpr expr, long coeff, long offset)
 Creates expr * coeff + offset. More...
 
static LinearExpr Affine (ILiteral literal, long coeff, long offset)
 Creates literal * coeff + offset. More...
 
static LinearExpr Affine (BoolVar var, long coeff, long offset)
 Creates var * coeff + offset. More...
 
static LinearExpr Constant (long value)
 Creates a constant expression. More...
 
static LinearExprBuilder NewBuilder (int sizeHint=2)
 Creates a builder class for linear expression. More...
 
static LinearExpr operator+ (LinearExpr a, LinearExpr b)
 

Properties

int Index [get]
 Returns the index of the variable in the underlying CpModelProto. More...
 
IntegerVariableProto Proto [get, set]
 The underlying IntegerVariableProto. More...
 
Domain Domain [get]
 Returns the domain of the variable. More...
 

Constructor & Destructor Documentation

@@ -259,7 +283,7 @@ Properties
-

Definition at line 641 of file IntegerExpressions.cs.

+

Definition at line 691 of file IntegerExpressions.cs.

@@ -309,7 +333,7 @@ Properties
-

Definition at line 650 of file IntegerExpressions.cs.

+

Definition at line 700 of file IntegerExpressions.cs.

@@ -347,7 +371,7 @@ Properties
-

Definition at line 661 of file IntegerExpressions.cs.

+

Definition at line 711 of file IntegerExpressions.cs.

@@ -392,7 +416,9 @@ Properties
-

Definition at line 167 of file IntegerExpressions.cs.

+

Creates var * coeff + offset.

+ +

Definition at line 190 of file IntegerExpressions.cs.

@@ -436,7 +462,9 @@ Properties
-

Definition at line 162 of file IntegerExpressions.cs.

+

Creates literal * coeff + offset.

+ +

Definition at line 184 of file IntegerExpressions.cs.

@@ -480,7 +508,9 @@ Properties
-

Definition at line 153 of file IntegerExpressions.cs.

+

Creates expr * coeff + offset.

+ +

Definition at line 174 of file IntegerExpressions.cs.

@@ -508,7 +538,9 @@ Properties
-

Definition at line 172 of file IntegerExpressions.cs.

+

Creates a constant expression.

+ +

Definition at line 196 of file IntegerExpressions.cs.

@@ -535,7 +567,9 @@ Properties
-

Definition at line 667 of file IntegerExpressions.cs.

+

Returns the index of the variable in the underlying CpModelProto.

+ +

Definition at line 718 of file IntegerExpressions.cs.

@@ -579,7 +613,7 @@ Properties
-

Definition at line 323 of file IntegerExpressions.cs.

+

Definition at line 348 of file IntegerExpressions.cs.

@@ -606,7 +640,9 @@ Properties
-

Definition at line 701 of file IntegerExpressions.cs.

+

Returns the name of the variable given upon creation.

+ +

Definition at line 756 of file IntegerExpressions.cs.

@@ -634,7 +670,9 @@ Properties
-

Definition at line 177 of file IntegerExpressions.cs.

+

Creates a builder class for linear expression.

+ +

Definition at line 202 of file IntegerExpressions.cs.

@@ -672,7 +710,7 @@ Properties
-

Definition at line 232 of file IntegerExpressions.cs.

+

Definition at line 257 of file IntegerExpressions.cs.

@@ -710,7 +748,7 @@ Properties
-

Definition at line 242 of file IntegerExpressions.cs.

+

Definition at line 267 of file IntegerExpressions.cs.

@@ -748,7 +786,7 @@ Properties
-

Definition at line 212 of file IntegerExpressions.cs.

+

Definition at line 237 of file IntegerExpressions.cs.

@@ -786,7 +824,7 @@ Properties
-

Definition at line 217 of file IntegerExpressions.cs.

+

Definition at line 242 of file IntegerExpressions.cs.

@@ -824,7 +862,7 @@ Properties
-

Definition at line 182 of file IntegerExpressions.cs.

+

Definition at line 207 of file IntegerExpressions.cs.

@@ -862,7 +900,7 @@ Properties
-

Definition at line 187 of file IntegerExpressions.cs.

+

Definition at line 212 of file IntegerExpressions.cs.

@@ -900,7 +938,7 @@ Properties
-

Definition at line 192 of file IntegerExpressions.cs.

+

Definition at line 217 of file IntegerExpressions.cs.

@@ -928,7 +966,7 @@ Properties
-

Definition at line 222 of file IntegerExpressions.cs.

+

Definition at line 247 of file IntegerExpressions.cs.

@@ -966,7 +1004,7 @@ Properties
-

Definition at line 197 of file IntegerExpressions.cs.

+

Definition at line 222 of file IntegerExpressions.cs.

@@ -1004,7 +1042,7 @@ Properties
-

Definition at line 202 of file IntegerExpressions.cs.

+

Definition at line 227 of file IntegerExpressions.cs.

@@ -1042,7 +1080,7 @@ Properties
-

Definition at line 207 of file IntegerExpressions.cs.

+

Definition at line 232 of file IntegerExpressions.cs.

@@ -1080,7 +1118,7 @@ Properties
-

Definition at line 302 of file IntegerExpressions.cs.

+

Definition at line 327 of file IntegerExpressions.cs.

@@ -1118,7 +1156,7 @@ Properties
-

Definition at line 277 of file IntegerExpressions.cs.

+

Definition at line 302 of file IntegerExpressions.cs.

@@ -1156,7 +1194,7 @@ Properties
-

Definition at line 282 of file IntegerExpressions.cs.

+

Definition at line 307 of file IntegerExpressions.cs.

@@ -1194,7 +1232,7 @@ Properties
-

Definition at line 297 of file IntegerExpressions.cs.

+

Definition at line 322 of file IntegerExpressions.cs.

@@ -1232,7 +1270,7 @@ Properties
-

Definition at line 267 of file IntegerExpressions.cs.

+

Definition at line 292 of file IntegerExpressions.cs.

@@ -1270,7 +1308,7 @@ Properties
-

Definition at line 272 of file IntegerExpressions.cs.

+

Definition at line 297 of file IntegerExpressions.cs.

@@ -1308,7 +1346,7 @@ Properties
-

Definition at line 227 of file IntegerExpressions.cs.

+

Definition at line 252 of file IntegerExpressions.cs.

@@ -1346,7 +1384,7 @@ Properties
-

Definition at line 237 of file IntegerExpressions.cs.

+

Definition at line 262 of file IntegerExpressions.cs.

@@ -1384,7 +1422,7 @@ Properties
-

Definition at line 292 of file IntegerExpressions.cs.

+

Definition at line 317 of file IntegerExpressions.cs.

@@ -1422,7 +1460,7 @@ Properties
-

Definition at line 257 of file IntegerExpressions.cs.

+

Definition at line 282 of file IntegerExpressions.cs.

@@ -1460,7 +1498,7 @@ Properties
-

Definition at line 262 of file IntegerExpressions.cs.

+

Definition at line 287 of file IntegerExpressions.cs.

@@ -1498,7 +1536,7 @@ Properties
-

Definition at line 287 of file IntegerExpressions.cs.

+

Definition at line 312 of file IntegerExpressions.cs.

@@ -1536,7 +1574,7 @@ Properties
-

Definition at line 247 of file IntegerExpressions.cs.

+

Definition at line 272 of file IntegerExpressions.cs.

@@ -1574,7 +1612,7 @@ Properties
-

Definition at line 252 of file IntegerExpressions.cs.

+

Definition at line 277 of file IntegerExpressions.cs.

@@ -1612,7 +1650,7 @@ Properties
-

Definition at line 307 of file IntegerExpressions.cs.

+

Definition at line 332 of file IntegerExpressions.cs.

@@ -1650,7 +1688,7 @@ Properties
-

Definition at line 373 of file IntegerExpressions.cs.

+

Definition at line 398 of file IntegerExpressions.cs.

@@ -1678,7 +1716,9 @@ Properties
-

Definition at line 96 of file IntegerExpressions.cs.

+

Creates Sum(vars).

+ +

Definition at line 107 of file IntegerExpressions.cs.

@@ -1706,7 +1746,9 @@ Properties
-

Definition at line 91 of file IntegerExpressions.cs.

+

Creates Sum(literals).

+ +

Definition at line 101 of file IntegerExpressions.cs.

@@ -1734,7 +1776,9 @@ Properties
-

Definition at line 86 of file IntegerExpressions.cs.

+

Creates Sum(exprs).

+ +

Definition at line 95 of file IntegerExpressions.cs.

@@ -1772,7 +1816,9 @@ Properties
-

Definition at line 148 of file IntegerExpressions.cs.

+

Creates var * coeff.

+ +

Definition at line 168 of file IntegerExpressions.cs.

@@ -1810,7 +1856,9 @@ Properties
-

Definition at line 136 of file IntegerExpressions.cs.

+

Creates literal * coeff.

+ +

Definition at line 155 of file IntegerExpressions.cs.

@@ -1848,7 +1896,9 @@ Properties
-

Definition at line 131 of file IntegerExpressions.cs.

+

Creates expr * coeff.

+ +

Definition at line 149 of file IntegerExpressions.cs.

@@ -1875,7 +1925,7 @@ Properties
-

Definition at line 696 of file IntegerExpressions.cs.

+

Definition at line 750 of file IntegerExpressions.cs.

@@ -1913,7 +1963,9 @@ Properties
-

Definition at line 121 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 137 of file IntegerExpressions.cs.

@@ -1951,7 +2003,9 @@ Properties
-

Definition at line 126 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 143 of file IntegerExpressions.cs.

@@ -1989,7 +2043,9 @@ Properties
-

Definition at line 111 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 125 of file IntegerExpressions.cs.

@@ -2027,7 +2083,9 @@ Properties
-

Definition at line 116 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 131 of file IntegerExpressions.cs.

@@ -2065,7 +2123,9 @@ Properties
-

Definition at line 101 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 113 of file IntegerExpressions.cs.

@@ -2103,7 +2163,9 @@ Properties
-

Definition at line 106 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 119 of file IntegerExpressions.cs.

@@ -2128,7 +2190,7 @@ Properties
-

Definition at line 706 of file IntegerExpressions.cs.

+

Definition at line 761 of file IntegerExpressions.cs.

@@ -2152,7 +2214,7 @@ Properties
-

Definition at line 707 of file IntegerExpressions.cs.

+

Definition at line 762 of file IntegerExpressions.cs.

@@ -2177,7 +2239,9 @@ Properties
-

Definition at line 689 of file IntegerExpressions.cs.

+

Returns the domain of the variable.

+ +

Definition at line 743 of file IntegerExpressions.cs.

@@ -2201,7 +2265,9 @@ Properties
-

Definition at line 672 of file IntegerExpressions.cs.

+

Returns the index of the variable in the underlying CpModelProto.

+ +

Definition at line 724 of file IntegerExpressions.cs.

@@ -2225,7 +2291,9 @@ Properties
-

Definition at line 679 of file IntegerExpressions.cs.

+

The underlying IntegerVariableProto.

+ +

Definition at line 732 of file IntegerExpressions.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntervalVar.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntervalVar.html index a80c281040..a0f85dc30e 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntervalVar.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1IntervalVar.html @@ -101,7 +101,7 @@ Public Member Functions  IntervalVar (CpModelProto model, LinearExpressionProto start, LinearExpressionProto size, LinearExpressionProto end, string name)   int GetIndex () - The Indexraint in the model proto More...
+ The Index of the interval in the model proto More...
  LinearExpr StartExpr ()  The start expression of the interval More...
@@ -295,7 +295,7 @@ Properties
-

The Indexraint in the model proto

+

The Index of the interval in the model proto

Definition at line 60 of file IntervalVariables.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExpr.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExpr.html index d6745787d7..4c61ce387b 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExpr.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExpr.html @@ -88,44 +88,62 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Linea

Detailed Description

-
-

Definition at line 84 of file IntegerExpressions.cs.

+

Holds a linear expression: sum (ai * xi) + b.

+ +

Definition at line 92 of file IntegerExpressions.cs.

+ + + + + + + + + + + + + + + + + @@ -225,7 +243,9 @@ Static Public Member Functions

Static Public Member Functions

static LinearExpr Sum (IEnumerable< LinearExpr > exprs)
 Creates Sum(exprs). More...
 
static LinearExpr Sum (IEnumerable< ILiteral > literals)
 Creates Sum(literals). More...
 
static LinearExpr Sum (IEnumerable< BoolVar > vars)
 Creates Sum(vars). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr Term (LinearExpr expr, long coeff)
 Creates expr * coeff. More...
 
static LinearExpr Term (ILiteral literal, long coeff)
 Creates literal * coeff. More...
 
static LinearExpr Term (BoolVar var, long coeff)
 Creates var * coeff. More...
 
static LinearExpr Affine (LinearExpr expr, long coeff, long offset)
 Creates expr * coeff + offset. More...
 
static LinearExpr Affine (ILiteral literal, long coeff, long offset)
 Creates literal * coeff + offset. More...
 
static LinearExpr Affine (BoolVar var, long coeff, long offset)
 Creates var * coeff + offset. More...
 
static LinearExpr Constant (long value)
 Creates a constant expression. More...
 
static LinearExprBuilder NewBuilder (int sizeHint=2)
 Creates a builder class for linear expression. More...
 
static LinearExpr operator+ (LinearExpr a, LinearExpr b)
 
-

Definition at line 167 of file IntegerExpressions.cs.

+

Creates var * coeff + offset.

+ +

Definition at line 190 of file IntegerExpressions.cs.

@@ -269,7 +289,9 @@ Static Public Member Functions
-

Definition at line 162 of file IntegerExpressions.cs.

+

Creates literal * coeff + offset.

+ +

Definition at line 184 of file IntegerExpressions.cs.

@@ -313,7 +335,9 @@ Static Public Member Functions
-

Definition at line 153 of file IntegerExpressions.cs.

+

Creates expr * coeff + offset.

+ +

Definition at line 174 of file IntegerExpressions.cs.

@@ -341,7 +365,9 @@ Static Public Member Functions
-

Definition at line 172 of file IntegerExpressions.cs.

+

Creates a constant expression.

+ +

Definition at line 196 of file IntegerExpressions.cs.

@@ -385,7 +411,7 @@ Static Public Member Functions
-

Definition at line 323 of file IntegerExpressions.cs.

+

Definition at line 348 of file IntegerExpressions.cs.

@@ -413,7 +439,9 @@ Static Public Member Functions
-

Definition at line 177 of file IntegerExpressions.cs.

+

Creates a builder class for linear expression.

+ +

Definition at line 202 of file IntegerExpressions.cs.

@@ -451,7 +479,7 @@ Static Public Member Functions
-

Definition at line 232 of file IntegerExpressions.cs.

+

Definition at line 257 of file IntegerExpressions.cs.

@@ -489,7 +517,7 @@ Static Public Member Functions
-

Definition at line 242 of file IntegerExpressions.cs.

+

Definition at line 267 of file IntegerExpressions.cs.

@@ -527,7 +555,7 @@ Static Public Member Functions
-

Definition at line 212 of file IntegerExpressions.cs.

+

Definition at line 237 of file IntegerExpressions.cs.

@@ -565,7 +593,7 @@ Static Public Member Functions
-

Definition at line 217 of file IntegerExpressions.cs.

+

Definition at line 242 of file IntegerExpressions.cs.

@@ -603,7 +631,7 @@ Static Public Member Functions
-

Definition at line 182 of file IntegerExpressions.cs.

+

Definition at line 207 of file IntegerExpressions.cs.

@@ -641,7 +669,7 @@ Static Public Member Functions
-

Definition at line 187 of file IntegerExpressions.cs.

+

Definition at line 212 of file IntegerExpressions.cs.

@@ -679,7 +707,7 @@ Static Public Member Functions
-

Definition at line 192 of file IntegerExpressions.cs.

+

Definition at line 217 of file IntegerExpressions.cs.

@@ -707,7 +735,7 @@ Static Public Member Functions
-

Definition at line 222 of file IntegerExpressions.cs.

+

Definition at line 247 of file IntegerExpressions.cs.

@@ -745,7 +773,7 @@ Static Public Member Functions
-

Definition at line 197 of file IntegerExpressions.cs.

+

Definition at line 222 of file IntegerExpressions.cs.

@@ -783,7 +811,7 @@ Static Public Member Functions
-

Definition at line 202 of file IntegerExpressions.cs.

+

Definition at line 227 of file IntegerExpressions.cs.

@@ -821,7 +849,7 @@ Static Public Member Functions
-

Definition at line 207 of file IntegerExpressions.cs.

+

Definition at line 232 of file IntegerExpressions.cs.

@@ -859,7 +887,7 @@ Static Public Member Functions
-

Definition at line 302 of file IntegerExpressions.cs.

+

Definition at line 327 of file IntegerExpressions.cs.

@@ -897,7 +925,7 @@ Static Public Member Functions
-

Definition at line 277 of file IntegerExpressions.cs.

+

Definition at line 302 of file IntegerExpressions.cs.

@@ -935,7 +963,7 @@ Static Public Member Functions
-

Definition at line 282 of file IntegerExpressions.cs.

+

Definition at line 307 of file IntegerExpressions.cs.

@@ -973,7 +1001,7 @@ Static Public Member Functions
-

Definition at line 297 of file IntegerExpressions.cs.

+

Definition at line 322 of file IntegerExpressions.cs.

@@ -1011,7 +1039,7 @@ Static Public Member Functions
-

Definition at line 267 of file IntegerExpressions.cs.

+

Definition at line 292 of file IntegerExpressions.cs.

@@ -1049,7 +1077,7 @@ Static Public Member Functions
-

Definition at line 272 of file IntegerExpressions.cs.

+

Definition at line 297 of file IntegerExpressions.cs.

@@ -1087,7 +1115,7 @@ Static Public Member Functions
-

Definition at line 227 of file IntegerExpressions.cs.

+

Definition at line 252 of file IntegerExpressions.cs.

@@ -1125,7 +1153,7 @@ Static Public Member Functions
-

Definition at line 237 of file IntegerExpressions.cs.

+

Definition at line 262 of file IntegerExpressions.cs.

@@ -1163,7 +1191,7 @@ Static Public Member Functions
-

Definition at line 292 of file IntegerExpressions.cs.

+

Definition at line 317 of file IntegerExpressions.cs.

@@ -1201,7 +1229,7 @@ Static Public Member Functions
-

Definition at line 257 of file IntegerExpressions.cs.

+

Definition at line 282 of file IntegerExpressions.cs.

@@ -1239,7 +1267,7 @@ Static Public Member Functions
-

Definition at line 262 of file IntegerExpressions.cs.

+

Definition at line 287 of file IntegerExpressions.cs.

@@ -1277,7 +1305,7 @@ Static Public Member Functions
-

Definition at line 287 of file IntegerExpressions.cs.

+

Definition at line 312 of file IntegerExpressions.cs.

@@ -1315,7 +1343,7 @@ Static Public Member Functions
-

Definition at line 247 of file IntegerExpressions.cs.

+

Definition at line 272 of file IntegerExpressions.cs.

@@ -1353,7 +1381,7 @@ Static Public Member Functions
-

Definition at line 252 of file IntegerExpressions.cs.

+

Definition at line 277 of file IntegerExpressions.cs.

@@ -1391,7 +1419,7 @@ Static Public Member Functions
-

Definition at line 307 of file IntegerExpressions.cs.

+

Definition at line 332 of file IntegerExpressions.cs.

@@ -1429,7 +1457,7 @@ Static Public Member Functions
-

Definition at line 373 of file IntegerExpressions.cs.

+

Definition at line 398 of file IntegerExpressions.cs.

@@ -1457,7 +1485,9 @@ Static Public Member Functions
-

Definition at line 96 of file IntegerExpressions.cs.

+

Creates Sum(vars).

+ +

Definition at line 107 of file IntegerExpressions.cs.

@@ -1485,7 +1515,9 @@ Static Public Member Functions
-

Definition at line 91 of file IntegerExpressions.cs.

+

Creates Sum(literals).

+ +

Definition at line 101 of file IntegerExpressions.cs.

@@ -1513,7 +1545,9 @@ Static Public Member Functions
-

Definition at line 86 of file IntegerExpressions.cs.

+

Creates Sum(exprs).

+ +

Definition at line 95 of file IntegerExpressions.cs.

@@ -1551,7 +1585,9 @@ Static Public Member Functions
-

Definition at line 148 of file IntegerExpressions.cs.

+

Creates var * coeff.

+ +

Definition at line 168 of file IntegerExpressions.cs.

@@ -1589,7 +1625,9 @@ Static Public Member Functions
-

Definition at line 136 of file IntegerExpressions.cs.

+

Creates literal * coeff.

+ +

Definition at line 155 of file IntegerExpressions.cs.

@@ -1627,7 +1665,9 @@ Static Public Member Functions
-

Definition at line 131 of file IntegerExpressions.cs.

+

Creates expr * coeff.

+ +

Definition at line 149 of file IntegerExpressions.cs.

@@ -1665,7 +1705,9 @@ Static Public Member Functions
-

Definition at line 121 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 137 of file IntegerExpressions.cs.

@@ -1703,7 +1745,9 @@ Static Public Member Functions
-

Definition at line 126 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 143 of file IntegerExpressions.cs.

@@ -1741,7 +1785,9 @@ Static Public Member Functions
-

Definition at line 111 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 125 of file IntegerExpressions.cs.

@@ -1779,7 +1825,9 @@ Static Public Member Functions
-

Definition at line 116 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 131 of file IntegerExpressions.cs.

@@ -1817,7 +1865,9 @@ Static Public Member Functions
-

Definition at line 101 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 113 of file IntegerExpressions.cs.

@@ -1855,7 +1905,9 @@ Static Public Member Functions
-

Definition at line 106 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 119 of file IntegerExpressions.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExprBuilder.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExprBuilder.html index 0efb69c36a..253d400140 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExprBuilder.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LinearExprBuilder.html @@ -90,44 +90,61 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Linea

Detailed Description

-
-

Definition at line 400 of file IntegerExpressions.cs.

+

A builder class for linear expressions.

+ +

Definition at line 426 of file IntegerExpressions.cs.

+ + + + + + + + + + + + + + + + @@ -135,38 +152,55 @@ Public Member Functions + + + + + + + + + + + + + + + + + @@ -257,7 +291,7 @@ Properties

Public Member Functions

 LinearExprBuilder (int sizeHint=2)
 
LinearExprBuilder Add (LinearExpr expr)
 Adds expr to the builder. More...
 
LinearExprBuilder Add (ILiteral literal)
 Adds literal to the builder. More...
 
LinearExprBuilder Add (BoolVar var)
 Adds var to the builder. More...
 
LinearExprBuilder Add (long constant)
 Adds constant to the builder. More...
 
LinearExprBuilder AddTerm (LinearExpr expr, long coefficient)
 Adds expr * coefficient to the builder. More...
 
LinearExprBuilder AddTerm (ILiteral literal, long coefficient)
 Adds literal * coefficient to the builder. More...
 
LinearExprBuilder AddTerm (BoolVar var, long coefficient)
 Adds var * coefficient to the builder. More...
 
LinearExprBuilder AddSum (IEnumerable< LinearExpr > exprs)
 Adds sum(exprs) to the builder. More...
 
LinearExprBuilder AddSum (IEnumerable< ILiteral > literals)
 Adds sum(literals) to the builder. More...
 
LinearExprBuilder AddSum (IEnumerable< BoolVar > vars)
 Adds sum(vars) to the builder. More...
 
LinearExprBuilder AddWeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< long > coefficients)
 Adds sum(exprs[i] * coeffs[i]) to the builder. More...
 
LinearExprBuilder AddWeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< int > coefficients)
 Adds sum(exprs[i] * coeffs[i]) to the builder. More...
 
LinearExprBuilder AddWeightedSum (IEnumerable< ILiteral > literals, IEnumerable< int > coefficients)
 Adds sum(literals[i] * coeffs[i]) to the builder. More...
 
LinearExprBuilder AddWeightedSum (IEnumerable< ILiteral > literals, IEnumerable< long > coefficients)
 Adds sum(literals[i] * coeffs[i]) to the builder. More...
 
LinearExprBuilder AddWeightedSum (IEnumerable< BoolVar > vars, IEnumerable< long > coefficients)
 Adds sum(vars[i] * coeffs[i]) to the builder. More...
 
LinearExprBuilder AddWeightedSum (IEnumerable< BoolVar > vars, IEnumerable< int > coefficients)
 Adds sum(vars[i] * coeffs[i]) to the builder. More...
 
override string ToString ()
 

Static Public Member Functions

static LinearExpr Sum (IEnumerable< LinearExpr > exprs)
 Creates Sum(exprs). More...
 
static LinearExpr Sum (IEnumerable< ILiteral > literals)
 Creates Sum(literals). More...
 
static LinearExpr Sum (IEnumerable< BoolVar > vars)
 Creates Sum(vars). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr Term (LinearExpr expr, long coeff)
 Creates expr * coeff. More...
 
static LinearExpr Term (ILiteral literal, long coeff)
 Creates literal * coeff. More...
 
static LinearExpr Term (BoolVar var, long coeff)
 Creates var * coeff. More...
 
static LinearExpr Affine (LinearExpr expr, long coeff, long offset)
 Creates expr * coeff + offset. More...
 
static LinearExpr Affine (ILiteral literal, long coeff, long offset)
 Creates literal * coeff + offset. More...
 
static LinearExpr Affine (BoolVar var, long coeff, long offset)
 Creates var * coeff + offset. More...
 
static LinearExpr Constant (long value)
 Creates a constant expression. More...
 
static LinearExprBuilder NewBuilder (int sizeHint=2)
 Creates a builder class for linear expression. More...
 
static LinearExpr operator+ (LinearExpr a, LinearExpr b)
 
-

Definition at line 402 of file IntegerExpressions.cs.

+

Definition at line 428 of file IntegerExpressions.cs.

@@ -286,7 +320,9 @@ Properties
-

Definition at line 418 of file IntegerExpressions.cs.

+

Adds var to the builder.

+ +

Definition at line 447 of file IntegerExpressions.cs.

@@ -314,7 +350,9 @@ Properties
-

Definition at line 413 of file IntegerExpressions.cs.

+

Adds literal to the builder.

+ +

Definition at line 441 of file IntegerExpressions.cs.

@@ -342,7 +380,9 @@ Properties
-

Definition at line 408 of file IntegerExpressions.cs.

+

Adds expr to the builder.

+ +

Definition at line 435 of file IntegerExpressions.cs.

@@ -370,7 +410,9 @@ Properties
-

Definition at line 423 of file IntegerExpressions.cs.

+

Adds constant to the builder.

+ +

Definition at line 453 of file IntegerExpressions.cs.

@@ -398,7 +440,9 @@ Properties
-

Definition at line 475 of file IntegerExpressions.cs.

+

Adds sum(vars) to the builder.

+ +

Definition at line 511 of file IntegerExpressions.cs.

@@ -426,7 +470,9 @@ Properties
-

Definition at line 465 of file IntegerExpressions.cs.

+

Adds sum(literals) to the builder.

+ +

Definition at line 500 of file IntegerExpressions.cs.

@@ -454,7 +500,9 @@ Properties
-

Definition at line 455 of file IntegerExpressions.cs.

+

Adds sum(exprs) to the builder.

+ +

Definition at line 489 of file IntegerExpressions.cs.

@@ -492,7 +540,9 @@ Properties
-

Definition at line 449 of file IntegerExpressions.cs.

+

Adds var * coefficient to the builder.

+ +

Definition at line 482 of file IntegerExpressions.cs.

@@ -530,7 +580,9 @@ Properties
-

Definition at line 435 of file IntegerExpressions.cs.

+

Adds literal * coefficient to the builder.

+ +

Definition at line 467 of file IntegerExpressions.cs.

@@ -568,7 +620,9 @@ Properties
-

Definition at line 429 of file IntegerExpressions.cs.

+

Adds expr * coefficient to the builder.

+ +

Definition at line 460 of file IntegerExpressions.cs.

@@ -606,7 +660,9 @@ Properties
-

Definition at line 535 of file IntegerExpressions.cs.

+

Adds sum(vars[i] * coeffs[i]) to the builder.

+ +

Definition at line 577 of file IntegerExpressions.cs.

@@ -644,7 +700,9 @@ Properties
-

Definition at line 525 of file IntegerExpressions.cs.

+

Adds sum(vars[i] * coeffs[i]) to the builder.

+ +

Definition at line 566 of file IntegerExpressions.cs.

@@ -682,7 +740,9 @@ Properties
-

Definition at line 505 of file IntegerExpressions.cs.

+

Adds sum(literals[i] * coeffs[i]) to the builder.

+ +

Definition at line 544 of file IntegerExpressions.cs.

@@ -720,7 +780,9 @@ Properties
-

Definition at line 515 of file IntegerExpressions.cs.

+

Adds sum(literals[i] * coeffs[i]) to the builder.

+ +

Definition at line 555 of file IntegerExpressions.cs.

@@ -758,7 +820,9 @@ Properties
-

Definition at line 495 of file IntegerExpressions.cs.

+

Adds sum(exprs[i] * coeffs[i]) to the builder.

+ +

Definition at line 533 of file IntegerExpressions.cs.

@@ -796,7 +860,9 @@ Properties
-

Definition at line 485 of file IntegerExpressions.cs.

+

Adds sum(exprs[i] * coeffs[i]) to the builder.

+ +

Definition at line 522 of file IntegerExpressions.cs.

@@ -840,7 +906,9 @@ Properties
-

Definition at line 167 of file IntegerExpressions.cs.

+

Creates var * coeff + offset.

+ +

Definition at line 190 of file IntegerExpressions.cs.

@@ -884,7 +952,9 @@ Properties
-

Definition at line 162 of file IntegerExpressions.cs.

+

Creates literal * coeff + offset.

+ +

Definition at line 184 of file IntegerExpressions.cs.

@@ -928,7 +998,9 @@ Properties
-

Definition at line 153 of file IntegerExpressions.cs.

+

Creates expr * coeff + offset.

+ +

Definition at line 174 of file IntegerExpressions.cs.

@@ -956,7 +1028,9 @@ Properties
-

Definition at line 172 of file IntegerExpressions.cs.

+

Creates a constant expression.

+ +

Definition at line 196 of file IntegerExpressions.cs.

@@ -1000,7 +1074,7 @@ Properties
-

Definition at line 323 of file IntegerExpressions.cs.

+

Definition at line 348 of file IntegerExpressions.cs.

@@ -1028,7 +1102,9 @@ Properties
-

Definition at line 177 of file IntegerExpressions.cs.

+

Creates a builder class for linear expression.

+ +

Definition at line 202 of file IntegerExpressions.cs.

@@ -1066,7 +1142,7 @@ Properties
-

Definition at line 232 of file IntegerExpressions.cs.

+

Definition at line 257 of file IntegerExpressions.cs.

@@ -1104,7 +1180,7 @@ Properties
-

Definition at line 242 of file IntegerExpressions.cs.

+

Definition at line 267 of file IntegerExpressions.cs.

@@ -1142,7 +1218,7 @@ Properties
-

Definition at line 212 of file IntegerExpressions.cs.

+

Definition at line 237 of file IntegerExpressions.cs.

@@ -1180,7 +1256,7 @@ Properties
-

Definition at line 217 of file IntegerExpressions.cs.

+

Definition at line 242 of file IntegerExpressions.cs.

@@ -1218,7 +1294,7 @@ Properties
-

Definition at line 182 of file IntegerExpressions.cs.

+

Definition at line 207 of file IntegerExpressions.cs.

@@ -1256,7 +1332,7 @@ Properties
-

Definition at line 187 of file IntegerExpressions.cs.

+

Definition at line 212 of file IntegerExpressions.cs.

@@ -1294,7 +1370,7 @@ Properties
-

Definition at line 192 of file IntegerExpressions.cs.

+

Definition at line 217 of file IntegerExpressions.cs.

@@ -1322,7 +1398,7 @@ Properties
-

Definition at line 222 of file IntegerExpressions.cs.

+

Definition at line 247 of file IntegerExpressions.cs.

@@ -1360,7 +1436,7 @@ Properties
-

Definition at line 197 of file IntegerExpressions.cs.

+

Definition at line 222 of file IntegerExpressions.cs.

@@ -1398,7 +1474,7 @@ Properties
-

Definition at line 202 of file IntegerExpressions.cs.

+

Definition at line 227 of file IntegerExpressions.cs.

@@ -1436,7 +1512,7 @@ Properties
-

Definition at line 207 of file IntegerExpressions.cs.

+

Definition at line 232 of file IntegerExpressions.cs.

@@ -1474,7 +1550,7 @@ Properties
-

Definition at line 302 of file IntegerExpressions.cs.

+

Definition at line 327 of file IntegerExpressions.cs.

@@ -1512,7 +1588,7 @@ Properties
-

Definition at line 277 of file IntegerExpressions.cs.

+

Definition at line 302 of file IntegerExpressions.cs.

@@ -1550,7 +1626,7 @@ Properties
-

Definition at line 282 of file IntegerExpressions.cs.

+

Definition at line 307 of file IntegerExpressions.cs.

@@ -1588,7 +1664,7 @@ Properties
-

Definition at line 297 of file IntegerExpressions.cs.

+

Definition at line 322 of file IntegerExpressions.cs.

@@ -1626,7 +1702,7 @@ Properties
-

Definition at line 267 of file IntegerExpressions.cs.

+

Definition at line 292 of file IntegerExpressions.cs.

@@ -1664,7 +1740,7 @@ Properties
-

Definition at line 272 of file IntegerExpressions.cs.

+

Definition at line 297 of file IntegerExpressions.cs.

@@ -1702,7 +1778,7 @@ Properties
-

Definition at line 227 of file IntegerExpressions.cs.

+

Definition at line 252 of file IntegerExpressions.cs.

@@ -1740,7 +1816,7 @@ Properties
-

Definition at line 237 of file IntegerExpressions.cs.

+

Definition at line 262 of file IntegerExpressions.cs.

@@ -1778,7 +1854,7 @@ Properties
-

Definition at line 292 of file IntegerExpressions.cs.

+

Definition at line 317 of file IntegerExpressions.cs.

@@ -1816,7 +1892,7 @@ Properties
-

Definition at line 257 of file IntegerExpressions.cs.

+

Definition at line 282 of file IntegerExpressions.cs.

@@ -1854,7 +1930,7 @@ Properties
-

Definition at line 262 of file IntegerExpressions.cs.

+

Definition at line 287 of file IntegerExpressions.cs.

@@ -1892,7 +1968,7 @@ Properties
-

Definition at line 287 of file IntegerExpressions.cs.

+

Definition at line 312 of file IntegerExpressions.cs.

@@ -1930,7 +2006,7 @@ Properties
-

Definition at line 247 of file IntegerExpressions.cs.

+

Definition at line 272 of file IntegerExpressions.cs.

@@ -1968,7 +2044,7 @@ Properties
-

Definition at line 252 of file IntegerExpressions.cs.

+

Definition at line 277 of file IntegerExpressions.cs.

@@ -2006,7 +2082,7 @@ Properties
-

Definition at line 307 of file IntegerExpressions.cs.

+

Definition at line 332 of file IntegerExpressions.cs.

@@ -2044,7 +2120,7 @@ Properties
-

Definition at line 373 of file IntegerExpressions.cs.

+

Definition at line 398 of file IntegerExpressions.cs.

@@ -2072,7 +2148,9 @@ Properties
-

Definition at line 96 of file IntegerExpressions.cs.

+

Creates Sum(vars).

+ +

Definition at line 107 of file IntegerExpressions.cs.

@@ -2100,7 +2178,9 @@ Properties
-

Definition at line 91 of file IntegerExpressions.cs.

+

Creates Sum(literals).

+ +

Definition at line 101 of file IntegerExpressions.cs.

@@ -2128,7 +2208,9 @@ Properties
-

Definition at line 86 of file IntegerExpressions.cs.

+

Creates Sum(exprs).

+ +

Definition at line 95 of file IntegerExpressions.cs.

@@ -2166,7 +2248,9 @@ Properties
-

Definition at line 148 of file IntegerExpressions.cs.

+

Creates var * coeff.

+ +

Definition at line 168 of file IntegerExpressions.cs.

@@ -2204,7 +2288,9 @@ Properties
-

Definition at line 136 of file IntegerExpressions.cs.

+

Creates literal * coeff.

+ +

Definition at line 155 of file IntegerExpressions.cs.

@@ -2242,7 +2328,9 @@ Properties
-

Definition at line 131 of file IntegerExpressions.cs.

+

Creates expr * coeff.

+ +

Definition at line 149 of file IntegerExpressions.cs.

@@ -2269,7 +2357,7 @@ Properties
-

Definition at line 545 of file IntegerExpressions.cs.

+

Definition at line 587 of file IntegerExpressions.cs.

@@ -2307,7 +2395,9 @@ Properties
-

Definition at line 121 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 137 of file IntegerExpressions.cs.

@@ -2345,7 +2435,9 @@ Properties
-

Definition at line 126 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 143 of file IntegerExpressions.cs.

@@ -2383,7 +2475,9 @@ Properties
-

Definition at line 111 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 125 of file IntegerExpressions.cs.

@@ -2421,7 +2515,9 @@ Properties
-

Definition at line 116 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 131 of file IntegerExpressions.cs.

@@ -2459,7 +2555,9 @@ Properties
-

Definition at line 101 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 113 of file IntegerExpressions.cs.

@@ -2497,7 +2595,9 @@ Properties
-

Definition at line 106 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 119 of file IntegerExpressions.cs.

@@ -2522,7 +2622,7 @@ Properties
-

Definition at line 621 of file IntegerExpressions.cs.

+

Definition at line 663 of file IntegerExpressions.cs.

@@ -2546,7 +2646,7 @@ Properties
-

Definition at line 628 of file IntegerExpressions.cs.

+

Definition at line 670 of file IntegerExpressions.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LogCallbackDelegate.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LogCallbackDelegate.html index 6ced22c594..f272252d1c 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LogCallbackDelegate.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1LogCallbackDelegate.html @@ -91,7 +91,7 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1LogCa

Detailed Description

-

Definition at line 264 of file CpSolver.cs.

+

Definition at line 268 of file CpSolver.cs.

@@ -139,7 +139,7 @@ Protected Attributes

Public Member Functions

-

Definition at line 266 of file CpSolver.cs.

+

Definition at line 270 of file CpSolver.cs.

@@ -225,7 +225,7 @@ Protected Attributes

Reimplemented from LogCallback.

-

Definition at line 271 of file CpSolver.cs.

+

Definition at line 275 of file CpSolver.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1MultipleCircuitConstraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1MultipleCircuitConstraint.html index 4590f21373..d476cdc444 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1MultipleCircuitConstraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1MultipleCircuitConstraint.html @@ -92,7 +92,7 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Multi

Specialized multiple circuit constraint.

This constraint allows adding arcs to the multiple circuit constraint incrementally.

-

Definition at line 117 of file Constraints.cs.

+

Definition at line 118 of file Constraints.cs.

@@ -102,19 +102,19 @@ Public Member Functions - + - +

Public Member Functions

 Add an arc to the graph of the multiple circuit constraint. More...
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -142,7 +142,7 @@ Properties
-

Definition at line 119 of file Constraints.cs.

+

Definition at line 120 of file Constraints.cs.

@@ -197,7 +197,7 @@ Properties -

Definition at line 132 of file Constraints.cs.

+

Definition at line 133 of file Constraints.cs.

@@ -225,9 +225,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -255,9 +255,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -282,9 +282,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -308,9 +308,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NoOverlap2dConstraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NoOverlap2dConstraint.html index 0a77ecb251..01c580bea5 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NoOverlap2dConstraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NoOverlap2dConstraint.html @@ -92,7 +92,7 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1NoOve

Specialized NoOverlap2D constraint.

This constraint allows adding rectanles to the NoOverlap2D constraint incrementally.

-

Definition at line 405 of file Constraints.cs.

+

Definition at line 406 of file Constraints.cs.

@@ -102,19 +102,19 @@ Public Member Functions - + - +

Public Member Functions

 Adds a rectangle (xInterval, yInterval) to the constraint. More...
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -142,7 +142,7 @@ Properties
-

Definition at line 407 of file Constraints.cs.

+

Definition at line 408 of file Constraints.cs.

@@ -183,7 +183,7 @@ Properties

Adds a rectangle (xInterval, yInterval) to the constraint.

-

Definition at line 412 of file Constraints.cs.

+

Definition at line 413 of file Constraints.cs.

@@ -211,9 +211,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -241,9 +241,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -268,9 +268,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -294,9 +294,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NotBoolVar.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NotBoolVar.html index 5abef4dee7..0d6d6e4de6 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NotBoolVar.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1NotBoolVar.html @@ -91,17 +91,20 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1NotBo

Detailed Description

-

Definition at line 734 of file IntegerExpressions.cs.

+

Definition at line 799 of file IntegerExpressions.cs.

+ + + @@ -109,38 +112,55 @@ Public Member Functions + + + + + + + + + + + + + + + + + @@ -229,7 +249,7 @@ Properties

Public Member Functions

 NotBoolVar (BoolVar boolvar)
 
int GetIndex ()
 Returns the logical index of the literal. More...
 
ILiteral Not ()
 Returns the Boolean negation of the literal. More...
 
LinearExpr NotAsExpr ()
 Returns the Boolean negation of the literal as a linear expression. More...
 
override string ToString ()
 

Static Public Member Functions

static LinearExpr Sum (IEnumerable< LinearExpr > exprs)
 Creates Sum(exprs). More...
 
static LinearExpr Sum (IEnumerable< ILiteral > literals)
 Creates Sum(literals). More...
 
static LinearExpr Sum (IEnumerable< BoolVar > vars)
 Creates Sum(vars). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< int > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< LinearExpr > exprs, IEnumerable< long > coeffs)
 Creates Sum(exprs[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< int > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< ILiteral > literals, IEnumerable< long > coeffs)
 Creates Sum(literals[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< int > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr WeightedSum (IEnumerable< BoolVar > vars, IEnumerable< long > coeffs)
 Creates Sum(vars[i] * coeffs[i]). More...
 
static LinearExpr Term (LinearExpr expr, long coeff)
 Creates expr * coeff. More...
 
static LinearExpr Term (ILiteral literal, long coeff)
 Creates literal * coeff. More...
 
static LinearExpr Term (BoolVar var, long coeff)
 Creates var * coeff. More...
 
static LinearExpr Affine (LinearExpr expr, long coeff, long offset)
 Creates expr * coeff + offset. More...
 
static LinearExpr Affine (ILiteral literal, long coeff, long offset)
 Creates literal * coeff + offset. More...
 
static LinearExpr Affine (BoolVar var, long coeff, long offset)
 Creates var * coeff + offset. More...
 
static LinearExpr Constant (long value)
 Creates a constant expression. More...
 
static LinearExprBuilder NewBuilder (int sizeHint=2)
 Creates a builder class for linear expression. More...
 
static LinearExpr operator+ (LinearExpr a, LinearExpr b)
 
-

Definition at line 736 of file IntegerExpressions.cs.

+

Definition at line 801 of file IntegerExpressions.cs.

@@ -274,7 +294,9 @@ Properties
-

Definition at line 167 of file IntegerExpressions.cs.

+

Creates var * coeff + offset.

+ +

Definition at line 190 of file IntegerExpressions.cs.

@@ -318,7 +340,9 @@ Properties
-

Definition at line 162 of file IntegerExpressions.cs.

+

Creates literal * coeff + offset.

+ +

Definition at line 184 of file IntegerExpressions.cs.

@@ -362,7 +386,9 @@ Properties
-

Definition at line 153 of file IntegerExpressions.cs.

+

Creates expr * coeff + offset.

+ +

Definition at line 174 of file IntegerExpressions.cs.

@@ -390,7 +416,9 @@ Properties
-

Definition at line 172 of file IntegerExpressions.cs.

+

Creates a constant expression.

+ +

Definition at line 196 of file IntegerExpressions.cs.

@@ -417,9 +445,11 @@ Properties
+

Returns the logical index of the literal.

+

Implements ILiteral.

-

Definition at line 741 of file IntegerExpressions.cs.

+

Definition at line 806 of file IntegerExpressions.cs.

@@ -463,7 +493,7 @@ Properties
-

Definition at line 323 of file IntegerExpressions.cs.

+

Definition at line 348 of file IntegerExpressions.cs.

@@ -491,7 +521,9 @@ Properties
-

Definition at line 177 of file IntegerExpressions.cs.

+

Creates a builder class for linear expression.

+ +

Definition at line 202 of file IntegerExpressions.cs.

@@ -518,9 +550,11 @@ Properties
+

Returns the Boolean negation of the literal.

+

Implements ILiteral.

-

Definition at line 753 of file IntegerExpressions.cs.

+

Definition at line 818 of file IntegerExpressions.cs.

@@ -547,9 +581,11 @@ Properties
+

Returns the Boolean negation of the literal as a linear expression.

+

Implements ILiteral.

-

Definition at line 758 of file IntegerExpressions.cs.

+

Definition at line 823 of file IntegerExpressions.cs.

@@ -587,7 +623,7 @@ Properties
-

Definition at line 232 of file IntegerExpressions.cs.

+

Definition at line 257 of file IntegerExpressions.cs.

@@ -625,7 +661,7 @@ Properties
-

Definition at line 242 of file IntegerExpressions.cs.

+

Definition at line 267 of file IntegerExpressions.cs.

@@ -663,7 +699,7 @@ Properties
-

Definition at line 212 of file IntegerExpressions.cs.

+

Definition at line 237 of file IntegerExpressions.cs.

@@ -701,7 +737,7 @@ Properties
-

Definition at line 217 of file IntegerExpressions.cs.

+

Definition at line 242 of file IntegerExpressions.cs.

@@ -739,7 +775,7 @@ Properties
-

Definition at line 182 of file IntegerExpressions.cs.

+

Definition at line 207 of file IntegerExpressions.cs.

@@ -777,7 +813,7 @@ Properties
-

Definition at line 187 of file IntegerExpressions.cs.

+

Definition at line 212 of file IntegerExpressions.cs.

@@ -815,7 +851,7 @@ Properties
-

Definition at line 192 of file IntegerExpressions.cs.

+

Definition at line 217 of file IntegerExpressions.cs.

@@ -843,7 +879,7 @@ Properties
-

Definition at line 222 of file IntegerExpressions.cs.

+

Definition at line 247 of file IntegerExpressions.cs.

@@ -881,7 +917,7 @@ Properties
-

Definition at line 197 of file IntegerExpressions.cs.

+

Definition at line 222 of file IntegerExpressions.cs.

@@ -919,7 +955,7 @@ Properties
-

Definition at line 202 of file IntegerExpressions.cs.

+

Definition at line 227 of file IntegerExpressions.cs.

@@ -957,7 +993,7 @@ Properties
-

Definition at line 207 of file IntegerExpressions.cs.

+

Definition at line 232 of file IntegerExpressions.cs.

@@ -995,7 +1031,7 @@ Properties
-

Definition at line 302 of file IntegerExpressions.cs.

+

Definition at line 327 of file IntegerExpressions.cs.

@@ -1033,7 +1069,7 @@ Properties
-

Definition at line 277 of file IntegerExpressions.cs.

+

Definition at line 302 of file IntegerExpressions.cs.

@@ -1071,7 +1107,7 @@ Properties
-

Definition at line 282 of file IntegerExpressions.cs.

+

Definition at line 307 of file IntegerExpressions.cs.

@@ -1109,7 +1145,7 @@ Properties
-

Definition at line 297 of file IntegerExpressions.cs.

+

Definition at line 322 of file IntegerExpressions.cs.

@@ -1147,7 +1183,7 @@ Properties
-

Definition at line 267 of file IntegerExpressions.cs.

+

Definition at line 292 of file IntegerExpressions.cs.

@@ -1185,7 +1221,7 @@ Properties
-

Definition at line 272 of file IntegerExpressions.cs.

+

Definition at line 297 of file IntegerExpressions.cs.

@@ -1223,7 +1259,7 @@ Properties
-

Definition at line 227 of file IntegerExpressions.cs.

+

Definition at line 252 of file IntegerExpressions.cs.

@@ -1261,7 +1297,7 @@ Properties
-

Definition at line 237 of file IntegerExpressions.cs.

+

Definition at line 262 of file IntegerExpressions.cs.

@@ -1299,7 +1335,7 @@ Properties
-

Definition at line 292 of file IntegerExpressions.cs.

+

Definition at line 317 of file IntegerExpressions.cs.

@@ -1337,7 +1373,7 @@ Properties
-

Definition at line 257 of file IntegerExpressions.cs.

+

Definition at line 282 of file IntegerExpressions.cs.

@@ -1375,7 +1411,7 @@ Properties
-

Definition at line 262 of file IntegerExpressions.cs.

+

Definition at line 287 of file IntegerExpressions.cs.

@@ -1413,7 +1449,7 @@ Properties
-

Definition at line 287 of file IntegerExpressions.cs.

+

Definition at line 312 of file IntegerExpressions.cs.

@@ -1451,7 +1487,7 @@ Properties
-

Definition at line 247 of file IntegerExpressions.cs.

+

Definition at line 272 of file IntegerExpressions.cs.

@@ -1489,7 +1525,7 @@ Properties
-

Definition at line 252 of file IntegerExpressions.cs.

+

Definition at line 277 of file IntegerExpressions.cs.

@@ -1527,7 +1563,7 @@ Properties
-

Definition at line 307 of file IntegerExpressions.cs.

+

Definition at line 332 of file IntegerExpressions.cs.

@@ -1565,7 +1601,7 @@ Properties
-

Definition at line 373 of file IntegerExpressions.cs.

+

Definition at line 398 of file IntegerExpressions.cs.

@@ -1593,7 +1629,9 @@ Properties
-

Definition at line 96 of file IntegerExpressions.cs.

+

Creates Sum(vars).

+ +

Definition at line 107 of file IntegerExpressions.cs.

@@ -1621,7 +1659,9 @@ Properties
-

Definition at line 91 of file IntegerExpressions.cs.

+

Creates Sum(literals).

+ +

Definition at line 101 of file IntegerExpressions.cs.

@@ -1649,7 +1689,9 @@ Properties
-

Definition at line 86 of file IntegerExpressions.cs.

+

Creates Sum(exprs).

+ +

Definition at line 95 of file IntegerExpressions.cs.

@@ -1687,7 +1729,9 @@ Properties
-

Definition at line 148 of file IntegerExpressions.cs.

+

Creates var * coeff.

+ +

Definition at line 168 of file IntegerExpressions.cs.

@@ -1725,7 +1769,9 @@ Properties
-

Definition at line 136 of file IntegerExpressions.cs.

+

Creates literal * coeff.

+ +

Definition at line 155 of file IntegerExpressions.cs.

@@ -1763,7 +1809,9 @@ Properties
-

Definition at line 131 of file IntegerExpressions.cs.

+

Creates expr * coeff.

+ +

Definition at line 149 of file IntegerExpressions.cs.

@@ -1790,7 +1838,7 @@ Properties
-

Definition at line 763 of file IntegerExpressions.cs.

+

Definition at line 828 of file IntegerExpressions.cs.

@@ -1828,7 +1876,9 @@ Properties
-

Definition at line 121 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 137 of file IntegerExpressions.cs.

@@ -1866,7 +1916,9 @@ Properties
-

Definition at line 126 of file IntegerExpressions.cs.

+

Creates Sum(vars[i] * coeffs[i]).

+ +

Definition at line 143 of file IntegerExpressions.cs.

@@ -1904,7 +1956,9 @@ Properties
-

Definition at line 111 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 125 of file IntegerExpressions.cs.

@@ -1942,7 +1996,9 @@ Properties
-

Definition at line 116 of file IntegerExpressions.cs.

+

Creates Sum(literals[i] * coeffs[i]).

+ +

Definition at line 131 of file IntegerExpressions.cs.

@@ -1980,7 +2036,9 @@ Properties
-

Definition at line 101 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 113 of file IntegerExpressions.cs.

@@ -2018,7 +2076,9 @@ Properties
-

Definition at line 106 of file IntegerExpressions.cs.

+

Creates Sum(exprs[i] * coeffs[i]).

+ +

Definition at line 119 of file IntegerExpressions.cs.

@@ -2043,7 +2103,7 @@ Properties
-

Definition at line 746 of file IntegerExpressions.cs.

+

Definition at line 811 of file IntegerExpressions.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ObjectiveSolutionPrinter.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ObjectiveSolutionPrinter.html index 49fd5edef7..9ca92d89c0 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ObjectiveSolutionPrinter.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ObjectiveSolutionPrinter.html @@ -90,8 +90,9 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Objec

Detailed Description

-
-

Definition at line 82 of file SearchHelpers.cs.

+

A specialized solution printer.

+ +

Definition at line 102 of file SearchHelpers.cs.

@@ -102,8 +103,10 @@ Public Member Functions + + @@ -170,7 +173,7 @@ Protected Attributes

Public Member Functions

int solutionCount ()
 
long Value (LinearExpr e)
 Returns the value of a linear expression in the current solution. More...
 
Boolean BooleanValue (ILiteral literal)
 Returns the Boolean value of a literal in the current solution. More...
 
void Dispose ()
 
-

Definition at line 87 of file SearchHelpers.cs.

+

Definition at line 107 of file SearchHelpers.cs.

@@ -226,7 +229,9 @@ Protected Attributes
-

Definition at line 68 of file SearchHelpers.cs.

+

Returns the Boolean value of a literal in the current solution.

+ +

Definition at line 83 of file SearchHelpers.cs.

@@ -472,7 +477,7 @@ Protected Attributes

Reimplemented from SolutionCallback.

-

Definition at line 92 of file SearchHelpers.cs.

+

Definition at line 112 of file SearchHelpers.cs.

@@ -679,7 +684,9 @@ Protected Attributes
-

Definition at line 22 of file SearchHelpers.cs.

+

Returns the value of a linear expression in the current solution.

+ +

Definition at line 32 of file SearchHelpers.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ReservoirConstraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ReservoirConstraint.html index 15841ae339..8911471e8b 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ReservoirConstraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1ReservoirConstraint.html @@ -92,32 +92,32 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Reser

Specialized reservoir constraint.

This constraint allows adding events (time, levelChange, isActive (optional)) to the reservoir constraint incrementally.

-

Definition at line 305 of file Constraints.cs.

+

Definition at line 306 of file Constraints.cs.

- + - + - + - +

Public Member Functions

 ReservoirConstraint (CpModel cp_model, CpModelProto model)
 
ReservoirConstraint AddEvent< T, L > (T time, L level_change)
 Adds a mandatory event More...
 Adds a mandatory event. More...
 
ReservoirConstraint AddOptionalEvent< T, L > (T time, L level_change, ILiteral literal)
 Adds an optional event More...
 Adds an optional event. More...
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -155,7 +155,7 @@ Properties
-

Definition at line 307 of file Constraints.cs.

+

Definition at line 308 of file Constraints.cs.

@@ -194,10 +194,10 @@ Properties
-

Adds a mandatory event

+

Adds a mandatory event.

It will increase the used capacity by level_change at time time. time must be an affine expression.

-

Definition at line 322 of file Constraints.cs.

+

Definition at line 323 of file Constraints.cs.

@@ -241,10 +241,10 @@ Properties
-

Adds an optional event

+

Adds an optional event.

If is_active is true, It will increase the used capacity by level_change at time time. time must be an affine expression.

-

Definition at line 341 of file Constraints.cs.

+

Definition at line 342 of file Constraints.cs.

@@ -272,9 +272,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -302,9 +302,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -329,9 +329,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -355,9 +355,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1TableConstraint.html b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1TableConstraint.html index 57e087d7eb..d6418c8ac0 100644 --- a/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1TableConstraint.html +++ b/docs/dotnet/classGoogle_1_1OrTools_1_1Sat_1_1TableConstraint.html @@ -92,7 +92,7 @@ $(document).ready(function(){initNavTree('classGoogle_1_1OrTools_1_1Sat_1_1Table

Specialized assignment constraint.

This constraint allows adding tuples to the allowed/forbidden assignment constraint incrementally.

-

Definition at line 150 of file Constraints.cs.

+

Definition at line 151 of file Constraints.cs.

@@ -111,19 +111,19 @@ Public Member Functions - + - +

Public Member Functions

 Adds a set of tuples of possible/forbidden values to the constraint. More...
 
void OnlyEnforceIf (ILiteral lit)
 Adds a literal to the constraint More...
 Adds a literal to the constraint. More...
 
void OnlyEnforceIf (ILiteral[] lits)
 Adds a list of literals to the constraint More...
 Adds a list of literals to the constraint. More...
 
- + - +

Properties

int Index [get]
 The index of the constraint in the model More...
 The index of the constraint in the model. More...
 
ConstraintProto Proto [get, set]
 The underlying constraint proto More...
 The underlying constraint proto. More...
 

Constructor & Destructor Documentation

@@ -151,7 +151,7 @@ Properties
-

Definition at line 152 of file Constraints.cs.

+

Definition at line 153 of file Constraints.cs.

@@ -194,7 +194,7 @@ Properties -

Definition at line 165 of file Constraints.cs.

+

Definition at line 166 of file Constraints.cs.

@@ -236,7 +236,7 @@ Properties -

Definition at line 191 of file Constraints.cs.

+

Definition at line 192 of file Constraints.cs.

@@ -278,7 +278,7 @@ Properties -

Definition at line 217 of file Constraints.cs.

+

Definition at line 218 of file Constraints.cs.

@@ -320,7 +320,7 @@ Properties -

Definition at line 245 of file Constraints.cs.

+

Definition at line 246 of file Constraints.cs.

@@ -348,9 +348,9 @@ Properties
-

Adds a literal to the constraint

+

Adds a literal to the constraint.

-

Definition at line 37 of file Constraints.cs.

+

Definition at line 38 of file Constraints.cs.

@@ -378,9 +378,9 @@ Properties
-

Adds a list of literals to the constraint

+

Adds a list of literals to the constraint.

-

Definition at line 43 of file Constraints.cs.

+

Definition at line 44 of file Constraints.cs.

@@ -405,9 +405,9 @@ Properties
-

The index of the constraint in the model

+

The index of the constraint in the model.

-

Definition at line 52 of file Constraints.cs.

+

Definition at line 53 of file Constraints.cs.

@@ -431,9 +431,9 @@ Properties
-

The underlying constraint proto

+

The underlying constraint proto.

-

Definition at line 60 of file Constraints.cs.

+

Definition at line 61 of file Constraints.cs.

diff --git a/docs/dotnet/hierarchy.html b/docs/dotnet/hierarchy.html index 3e8ae3be03..ff94f026d6 100644 --- a/docs/dotnet/hierarchy.html +++ b/docs/dotnet/hierarchy.html @@ -88,7 +88,7 @@ $(document).ready(function(){initNavTree('hierarchy.html',''); initResizable();

Go to the graphical class hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:
[detail level 123456]
- + @@ -304,8 +304,8 @@ This inheritance list is sorted roughly, but not completely, alphabetically: - - + + @@ -362,10 +362,10 @@ This inheritance list is sorted roughly, but not completely, alphabetically: - - - - + + + + @@ -528,8 +528,8 @@ This inheritance list is sorted roughly, but not completely, alphabetically: - - + + diff --git a/docs/dotnet/inherit_graph_0.map b/docs/dotnet/inherit_graph_0.map index 26d724f0b9..6745d2183c 100644 --- a/docs/dotnet/inherit_graph_0.map +++ b/docs/dotnet/inherit_graph_0.map @@ -1,3 +1,3 @@ - + diff --git a/docs/dotnet/inherit_graph_0.md5 b/docs/dotnet/inherit_graph_0.md5 index b0aa4eecee..5fe0059c10 100644 --- a/docs/dotnet/inherit_graph_0.md5 +++ b/docs/dotnet/inherit_graph_0.md5 @@ -1 +1 @@ -a11632e1a0559a8fad2527e11c7437db \ No newline at end of file +cd9d1b7a88fdfe6307d52e77353e38ac \ No newline at end of file diff --git a/docs/dotnet/inherit_graph_12.map b/docs/dotnet/inherit_graph_12.map index a676284576..09b2d79fc5 100644 --- a/docs/dotnet/inherit_graph_12.map +++ b/docs/dotnet/inherit_graph_12.map @@ -1,8 +1,8 @@ - - + + - - - + + + diff --git a/docs/dotnet/inherit_graph_12.md5 b/docs/dotnet/inherit_graph_12.md5 index f3918b2fec..9bc622e72f 100644 --- a/docs/dotnet/inherit_graph_12.md5 +++ b/docs/dotnet/inherit_graph_12.md5 @@ -1 +1 @@ -93385ac1b5e4b7bdfab84b14a1e5c671 \ No newline at end of file +4fa35d6b3c03664123b1b786ae2c9306 \ No newline at end of file diff --git a/docs/dotnet/inherit_graph_5.map b/docs/dotnet/inherit_graph_5.map index 532bd45104..16904856a3 100644 --- a/docs/dotnet/inherit_graph_5.map +++ b/docs/dotnet/inherit_graph_5.map @@ -1,3 +1,3 @@ - + diff --git a/docs/dotnet/inherit_graph_5.md5 b/docs/dotnet/inherit_graph_5.md5 index 8a0233b33e..ae0299396a 100644 --- a/docs/dotnet/inherit_graph_5.md5 +++ b/docs/dotnet/inherit_graph_5.md5 @@ -1 +1 @@ -4932b373b0a0b4e9722007e9039b8f8f \ No newline at end of file +b283f1612a9026f4a45e10a75bfceca9 \ No newline at end of file diff --git a/docs/dotnet/inherit_graph_9.map b/docs/dotnet/inherit_graph_9.map index f10becf630..71f9c51a7c 100644 --- a/docs/dotnet/inherit_graph_9.map +++ b/docs/dotnet/inherit_graph_9.map @@ -135,6 +135,6 @@ - - + + diff --git a/docs/dotnet/inherit_graph_9.md5 b/docs/dotnet/inherit_graph_9.md5 index 5860fc6a4b..7f72839981 100644 --- a/docs/dotnet/inherit_graph_9.md5 +++ b/docs/dotnet/inherit_graph_9.md5 @@ -1 +1 @@ -dba7ebad43a0d3579d5410f26919af2c \ No newline at end of file +76a14578277a9cdc5267fa1a17993b45 \ No newline at end of file diff --git a/docs/dotnet/inherits.html b/docs/dotnet/inherits.html index 9b323d8925..01cbbc415b 100644 --- a/docs/dotnet/inherits.html +++ b/docs/dotnet/inherits.html @@ -89,7 +89,7 @@ $(document).ready(function(){initNavTree('hierarchy.html',''); initResizable();
 CBoundedLinearExpression
 CBoundedLinearExpressionHolds a linear constraint: expression ∈ domain
 CConstraintWrapper around a ConstraintProto
 CSymmetryBreakerVector
 CILiteral
 CILiteralHolds a Boolean variable or its negation
 CIMessage
 CSumCst
 CLinearExpr
 CLinearExprHolds a linear expression: sum (ai * xi) + b
 CLinearExprArrayHelper
 CNestedArrayHelper
 CLogCallback
- +
@@ -121,7 +121,7 @@ $(document).ready(function(){initNavTree('hierarchy.html',''); initResizable();
- +
@@ -317,8 +317,8 @@ $(document).ready(function(){initNavTree('hierarchy.html',''); initResizable(); - - + +
@@ -362,12 +362,12 @@ $(document).ready(function(){initNavTree('hierarchy.html',''); initResizable();
- - + + - - - + + +
diff --git a/docs/dotnet/interfaceGoogle_1_1OrTools_1_1Sat_1_1ILiteral.html b/docs/dotnet/interfaceGoogle_1_1OrTools_1_1Sat_1_1ILiteral.html index 07d8edb47f..bf0b2951ec 100644 --- a/docs/dotnet/interfaceGoogle_1_1OrTools_1_1Sat_1_1ILiteral.html +++ b/docs/dotnet/interfaceGoogle_1_1OrTools_1_1Sat_1_1ILiteral.html @@ -88,16 +88,20 @@ $(document).ready(function(){initNavTree('interfaceGoogle_1_1OrTools_1_1Sat_1_1I

Detailed Description

-
-

Definition at line 24 of file IntegerExpressions.cs.

+

Holds a Boolean variable or its negation.

+ +

Definition at line 25 of file IntegerExpressions.cs.

+ + +

Public Member Functions

ILiteral Not ()
 Returns the Boolean negation of the literal. More...
 
int GetIndex ()
 Returns the logical index of the literal. More...
 
LinearExpr NotAsExpr ()
 Returns the Boolean negation of the literal as a linear expression. More...
 

Member Function Documentation

@@ -116,6 +120,8 @@ Public Member Functions
+

Returns the logical index of the literal.

+

Implemented in NotBoolVar.

@@ -135,6 +141,8 @@ Public Member Functions
+

Returns the Boolean negation of the literal.

+

Implemented in BoolVar, and NotBoolVar.

@@ -154,6 +162,8 @@ Public Member Functions
+

Returns the Boolean negation of the literal as a linear expression.

+

Implemented in BoolVar, and NotBoolVar.

diff --git a/docs/dotnet/namespaceGoogle_1_1OrTools_1_1Sat.html b/docs/dotnet/namespaceGoogle_1_1OrTools_1_1Sat.html index 069d96e1e9..b4442515f9 100644 --- a/docs/dotnet/namespaceGoogle_1_1OrTools_1_1Sat.html +++ b/docs/dotnet/namespaceGoogle_1_1OrTools_1_1Sat.html @@ -104,8 +104,10 @@ Classes  Argument of the constraints of the form OP(literals). More...
  class  BoolVar + Holds a Boolean variable. More...
  class  BoundedLinearExpression + Holds a linear constraint: expression ∈ domain More...
  class  CircuitConstraint  Specialized circuit constraint. More...
@@ -134,7 +136,7 @@ Classes class  CpSatHelper   class  CpSolver - Wrapper around the SAT solver More...
+ Wrapper around the SAT solver. More...
  class  CpSolverResponse  The response returned by a solver trying to solve a CpModelProto. More...
@@ -143,6 +145,7 @@ Classes  Just a message used to store dense solution. More...
  class  CpSolverSolutionCallback + Parent class to create a callback called at each solution. More...
  class  CumulativeConstraint  Specialized cumulative constraint. More...
@@ -165,6 +168,7 @@ Classes class  HelperExtensions   interface  ILiteral + Holds a Boolean variable or its negation. More...
  class  IntegerVariableProto  An integer variable. More...
@@ -176,6 +180,7 @@ Classes  An interval variable More...
  class  IntVar + Holds a integer variable with a discrete domain. More...
  class  InverseConstraintProto  The two arrays of variable each represent a function, the second is the inverse of the first: f_direct[i] == j <=> f_inverse[j] == i. More...
@@ -186,8 +191,10 @@ Classes  The linear sum vars[i] * coeffs[i] must fall in the given domain. More...
  class  LinearExpr + Holds a linear expression: sum (ai * xi) + b. More...
  class  LinearExprBuilder + A builder class for linear expressions. More...
  class  LinearExpressionProto  Some constraints supports linear expression instead of just using a reference to a variable. More...
@@ -214,6 +221,7 @@ Classes class  NotBoolVar   class  ObjectiveSolutionPrinter + A specialized solution printer. More...
  class  operations_research_sat   diff --git a/docs/dotnet/namespaces.html b/docs/dotnet/namespaces.html index c7c98315ae..c63438d8e2 100644 --- a/docs/dotnet/namespaces.html +++ b/docs/dotnet/namespaces.html @@ -299,8 +299,8 @@ $(document).ready(function(){initNavTree('namespaces.html',''); initResizable();  CAutomatonConstraintSpecialized automaton constraint  CAutomatonConstraintProtoThis constraint forces a sequence of variables to be accepted by an automaton  CBoolArgumentProtoArgument of the constraints of the form OP(literals) - CBoolVar - CBoundedLinearExpression + CBoolVarHolds a Boolean variable + CBoundedLinearExpressionHolds a linear constraint: expression ∈ domain  CCircuitConstraintSpecialized circuit constraint  CCircuitConstraintProtoThe circuit constraint is defined on a graph where the arc presence are controlled by literals  CConstraintWrapper around a ConstraintProto @@ -313,7 +313,7 @@ $(document).ready(function(){initNavTree('namespaces.html',''); initResizable();  CCpSolverWrapper around the SAT solver  CCpSolverResponseThe response returned by a solver trying to solve a CpModelProto  CCpSolverSolutionJust a message used to store dense solution - CCpSolverSolutionCallback + CCpSolverSolutionCallbackParent class to create a callback called at each solution  CCumulativeConstraintSpecialized cumulative constraint  CCumulativeConstraintProtoThe sum of the demands of the intervals at each interval point cannot exceed a capacity  CDecisionStrategyProtoDefine the strategy to follow when the solver needs to take a new decision @@ -322,16 +322,16 @@ $(document).ready(function(){initNavTree('namespaces.html',''); initResizable();  CDenseMatrixProtoA dense matrix of numbers encoded in a flat way, row by row  CElementConstraintProtoThe constraint target = vars[index]  CFloatObjectiveProtoA linear floating point objective: sum coeffs[i] * vars[i] + offset - CILiteral + CILiteralHolds a Boolean variable or its negation  CIntegerVariableProtoAn integer variable  CIntervalConstraintProtoThis is not really a constraint  CIntervalVarAn interval variable - CIntVar + CIntVarHolds a integer variable with a discrete domain  CInverseConstraintProtoThe two arrays of variable each represent a function, the second is the inverse of the first: f_direct[i] == j <=> f_inverse[j] == i  CLinearArgumentProto  CLinearConstraintProtoThe linear sum vars[i] * coeffs[i] must fall in the given domain - CLinearExpr - CLinearExprBuilder + CLinearExprHolds a linear expression: sum (ai * xi) + b + CLinearExprBuilderA builder class for linear expressions  CLinearExpressionProtoSome constraints supports linear expression instead of just using a reference to a variable  CListOfVariablesProtoA list of variables, without any semantics  CLogCallback @@ -341,7 +341,7 @@ $(document).ready(function(){initNavTree('namespaces.html',''); initResizable();  CNoOverlap2DConstraintProtoThe boxes defined by [start_x, end_x) * [start_y, end_y) cannot overlap  CNoOverlapConstraintProtoAll the intervals (index of IntervalConstraintProto) must be disjoint  CNotBoolVar - CObjectiveSolutionPrinter + CObjectiveSolutionPrinterA specialized solution printer  Coperations_research_sat  Coperations_research_satPINVOKE  CSWIGExceptionHelper diff --git a/docs/dotnet/structGoogle_1_1OrTools_1_1Sat_1_1Term.html b/docs/dotnet/structGoogle_1_1OrTools_1_1Sat_1_1Term.html index e8b5bc6689..047cccbf80 100644 --- a/docs/dotnet/structGoogle_1_1OrTools_1_1Sat_1_1Term.html +++ b/docs/dotnet/structGoogle_1_1OrTools_1_1Sat_1_1Term.html @@ -90,7 +90,7 @@ $(document).ready(function(){initNavTree('structGoogle_1_1OrTools_1_1Sat_1_1Term

Detailed Description

-

Definition at line 71 of file IntegerExpressions.cs.

+

Definition at line 75 of file IntegerExpressions.cs.

@@ -139,7 +139,7 @@ Public Attributes

Public Member Functions

-

Definition at line 76 of file IntegerExpressions.cs.

+

Definition at line 80 of file IntegerExpressions.cs.

@@ -156,7 +156,7 @@ Public Attributes
-

Definition at line 74 of file IntegerExpressions.cs.

+

Definition at line 78 of file IntegerExpressions.cs.

@@ -172,7 +172,7 @@ Public Attributes
-

Definition at line 73 of file IntegerExpressions.cs.

+

Definition at line 77 of file IntegerExpressions.cs.

diff --git a/ortools/sat/csharp/Constraints.cs b/ortools/sat/csharp/Constraints.cs index 89b19d0f29..7934a50fc0 100644 --- a/ortools/sat/csharp/Constraints.cs +++ b/ortools/sat/csharp/Constraints.cs @@ -34,13 +34,13 @@ public class Constraint model.Constraints.Add(constraint_); } - /** Adds a literal to the constraint */ + /** Adds a literal to the constraint. */ public void OnlyEnforceIf(ILiteral lit) { constraint_.EnforcementLiteral.Add(lit.GetIndex()); } - /** Adds a list of literals to the constraint */ + /** Adds a list of literals to the constraint. */ public void OnlyEnforceIf(ILiteral[] lits) { foreach (ILiteral lit in lits) @@ -49,7 +49,7 @@ public class Constraint } } - /** The index of the constraint in the model */ + /** The index of the constraint in the model. */ public int Index { get { @@ -57,7 +57,7 @@ public class Constraint } } - /** The underlying constraint proto */ + /** The underlying constraint proto. */ public ConstraintProto Proto { get { @@ -312,7 +312,7 @@ public class ReservoirConstraint : Constraint /** * - * Adds a mandatory event + * Adds a mandatory event. * * * @@ -331,7 +331,7 @@ public class ReservoirConstraint : Constraint /** * - * Adds an optional event + * Adds an optional event. * * * diff --git a/ortools/sat/csharp/CpSolver.cs b/ortools/sat/csharp/CpSolver.cs index 6001d5601d..8294976fa4 100644 --- a/ortools/sat/csharp/CpSolver.cs +++ b/ortools/sat/csharp/CpSolver.cs @@ -19,7 +19,7 @@ namespace Google.OrTools.Sat { /** * - * Wrapper around the SAT solver + * Wrapper around the SAT solver. * * * This class proposes a Solve() method, as well as accessors to get the values of @@ -28,7 +28,7 @@ namespace Google.OrTools.Sat */ public class CpSolver { - /** Solves the given model, and returns the solve status */ + /** Solves the given model, and returns the solve status. */ public CpSolverStatus Solve(CpModel model, SolutionCallback cb = null) { // Setup search. @@ -58,12 +58,14 @@ public class CpSolver return response_.Status; } + /** Deprecated, use Solve() instead. */ [ObsoleteAttribute("This method is obsolete. Call Solve instead.", false)] public CpSolverStatus SolveWithSolutionCallback(CpModel model, SolutionCallback cb) { return Solve(model, cb); } + /** Deprecated, use Solve() instead. */ [ObsoleteAttribute("This method is obsolete. Call Solve instead with the enumerate_all_solutions parameter.", false)] public CpSolverStatus SearchAllSolutions(CpModel model, SolutionCallback cb) { @@ -74,8 +76,8 @@ public class CpSolver return response_.Status; } + /** Stops the search asynchronously. */ [MethodImpl(MethodImplOptions.Synchronized)] - /** Stops the search asynchronously */ public void StopSearch() { if (solve_wrapper_ is not null) @@ -96,13 +98,13 @@ public class CpSolver solve_wrapper_ = null; } - /** Statistics on the solution found as a string */ + /** Statistics on the solution found as a string.*/ public String ResponseStats() { return CpSatHelper.SolverResponseStats(response_); } - /** The best objective value found during search*/ + /** The best objective value found during search.*/ public double ObjectiveValue { get { @@ -200,7 +202,7 @@ public class CpSolver /** * - * Returns the Boolean value of a linear expression in the last solution found. + * Returns the Boolean value of a literal in the last solution found. * */ public Boolean BooleanValue(ILiteral literal) @@ -223,19 +225,19 @@ public class CpSolver } } - /** Returns the number of branches explored during search. */ + /** Returns the number of branches explored during search. */ public long NumBranches() { return response_.NumBranches; } - /** Returns the number of conflicts created during search. */ + /** Returns the number of conflicts created during search. */ public long NumConflicts() { return response_.NumConflicts; } - /** Returns the wall time of the search. */ + /** Returns the wall time of the search. */ public double WallTime() { return response_.WallTime; @@ -247,8 +249,10 @@ public class CpSolver } /** + * * Returns some information on how the solution was found, or the reason why the model or the * parameters are invalid. + * */ public String SolutionInfo() { diff --git a/ortools/sat/csharp/IntegerExpressions.cs b/ortools/sat/csharp/IntegerExpressions.cs index acc0c84811..f7e3cd0900 100644 --- a/ortools/sat/csharp/IntegerExpressions.cs +++ b/ortools/sat/csharp/IntegerExpressions.cs @@ -21,10 +21,14 @@ using System.Linq; using System.Runtime.CompilerServices; using Google.Protobuf.Collections; +/** Holds a Boolean variable or its negation. */ public interface ILiteral { + /** Returns the Boolean negation of the literal. */ ILiteral Not(); + /** Returns the logical index of the literal. */ int GetIndex(); + /** Returns the Boolean negation of the literal as a linear expression. */ LinearExpr NotAsExpr(); } @@ -80,59 +84,74 @@ public struct Term } } -// Holds a linear expression. +/** + * + * Holds a linear expression: sum (ai * xi) + b. + * + */ public class LinearExpr { + /** Creates Sum(exprs). */ public static LinearExpr Sum(IEnumerable exprs) { return NewBuilder(0).AddSum(exprs); } + /** Creates Sum(literals). */ public static LinearExpr Sum(IEnumerable literals) { return NewBuilder(0).AddSum(literals); } + /** Creates Sum(vars). */ public static LinearExpr Sum(IEnumerable vars) { return NewBuilder(0).AddSum(vars); } + /** Creates Sum(exprs[i] * coeffs[i]). */ public static LinearExpr WeightedSum(IEnumerable exprs, IEnumerable coeffs) { return NewBuilder(0).AddWeightedSum(exprs, coeffs); } + /** Creates Sum(exprs[i] * coeffs[i]). */ public static LinearExpr WeightedSum(IEnumerable exprs, IEnumerable coeffs) { return NewBuilder(0).AddWeightedSum(exprs, coeffs); } + /** Creates Sum(literals[i] * coeffs[i]). */ public static LinearExpr WeightedSum(IEnumerable literals, IEnumerable coeffs) { return NewBuilder(0).AddWeightedSum(literals, coeffs); } + /** Creates Sum(literals[i] * coeffs[i]). */ public static LinearExpr WeightedSum(IEnumerable literals, IEnumerable coeffs) { return NewBuilder(0).AddWeightedSum(literals, coeffs); } + /** Creates Sum(vars[i] * coeffs[i]). */ public static LinearExpr WeightedSum(IEnumerable vars, IEnumerable coeffs) { return NewBuilder(0).AddWeightedSum(vars, coeffs); } + /** Creates Sum(vars[i] * coeffs[i]). */ public static LinearExpr WeightedSum(IEnumerable vars, IEnumerable coeffs) { return NewBuilder(0).AddWeightedSum(vars, coeffs); } + /** Creates expr * coeff. */ public static LinearExpr Term(LinearExpr expr, long coeff) { return Prod(expr, coeff); } + /** Creates literal * coeff. */ public static LinearExpr Term(ILiteral literal, long coeff) { if (literal is BoolVar boolVar) @@ -145,11 +164,13 @@ public class LinearExpr } } + /** Creates var * coeff. */ public static LinearExpr Term(BoolVar var, long coeff) { return Prod(var, coeff); } + /** Creates expr * coeff + offset. */ public static LinearExpr Affine(LinearExpr expr, long coeff, long offset) { if (offset == 0) @@ -159,21 +180,25 @@ public class LinearExpr return NewBuilder().AddTerm(expr, coeff).Add(offset); } + /** Creates literal * coeff + offset. */ public static LinearExpr Affine(ILiteral literal, long coeff, long offset) { return NewBuilder().AddTerm(literal, coeff).Add(offset); } + /** Creates var * coeff + offset. */ public static LinearExpr Affine(BoolVar var, long coeff, long offset) { return NewBuilder().AddTerm(var, coeff).Add(offset); } + /** Creates a constant expression. */ public static LinearExpr Constant(long value) { return NewBuilder(0).Add(value); } + /** Creates a builder class for linear expression. */ public static LinearExprBuilder NewBuilder(int sizeHint = 2) { return new LinearExprBuilder(sizeHint); @@ -397,6 +422,7 @@ public class LinearExpr } } +/** A builder class for linear expressions. */ public sealed class LinearExprBuilder : LinearExpr { public LinearExprBuilder(int sizeHint = 2) @@ -405,33 +431,39 @@ public sealed class LinearExprBuilder : LinearExpr offset_ = 0; } + /** Adds expr to the builder. */ public LinearExprBuilder Add(LinearExpr expr) { return AddTerm(expr, 1); } + /** Adds literal to the builder. */ public LinearExprBuilder Add(ILiteral literal) { return AddTerm(literal, 1); } + /** Adds var to the builder. */ public LinearExprBuilder Add(BoolVar var) { return AddTerm(var, 1); } + /** Adds constant to the builder. */ public LinearExprBuilder Add(long constant) { offset_ += constant; return this; } + /** Adds expr * coefficient to the builder. */ public LinearExprBuilder AddTerm(LinearExpr expr, long coefficient) { terms_.Add(new Term(expr, coefficient)); return this; } + /** Adds literal * coefficient to the builder. */ public LinearExprBuilder AddTerm(ILiteral literal, long coefficient) { if (literal is BoolVar boolVar) @@ -446,12 +478,14 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds var * coefficient to the builder. */ public LinearExprBuilder AddTerm(BoolVar var, long coefficient) { terms_.Add(new Term(var, coefficient)); return this; } + /** Adds sum(exprs) to the builder. */ public LinearExprBuilder AddSum(IEnumerable exprs) { terms_.TryEnsureCapacity(exprs); @@ -462,6 +496,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(literals) to the builder. */ public LinearExprBuilder AddSum(IEnumerable literals) { terms_.TryEnsureCapacity(literals); @@ -472,6 +507,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(vars) to the builder. */ public LinearExprBuilder AddSum(IEnumerable vars) { terms_.TryEnsureCapacity(vars); @@ -482,6 +518,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(exprs[i] * coeffs[i]) to the builder. */ public LinearExprBuilder AddWeightedSum(IEnumerable exprs, IEnumerable coefficients) { terms_.TryEnsureCapacity(exprs); @@ -492,6 +529,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(exprs[i] * coeffs[i]) to the builder. */ public LinearExprBuilder AddWeightedSum(IEnumerable exprs, IEnumerable coefficients) { terms_.TryEnsureCapacity(exprs); @@ -502,6 +540,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(literals[i] * coeffs[i]) to the builder. */ public LinearExprBuilder AddWeightedSum(IEnumerable literals, IEnumerable coefficients) { terms_.TryEnsureCapacity(literals); @@ -512,6 +551,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(literals[i] * coeffs[i]) to the builder. */ public LinearExprBuilder AddWeightedSum(IEnumerable literals, IEnumerable coefficients) { terms_.TryEnsureCapacity(literals); @@ -522,6 +562,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(vars[i] * coeffs[i]) to the builder. */ public LinearExprBuilder AddWeightedSum(IEnumerable vars, IEnumerable coefficients) { terms_.TryEnsureCapacity(vars); @@ -532,6 +573,7 @@ public sealed class LinearExprBuilder : LinearExpr return this; } + /** Adds sum(vars[i] * coeffs[i]) to the builder. */ public LinearExprBuilder AddWeightedSum(IEnumerable vars, IEnumerable coefficients) { terms_.TryEnsureCapacity(vars); @@ -636,6 +678,14 @@ public sealed class LinearExprBuilder : LinearExpr private List terms_; } +/** + * + * Holds a integer variable with a discrete domain. + * + * + * This class must be constructed from the CpModel class. + * + */ public class IntVar : LinearExpr { public IntVar(CpModelProto model, Domain domain, string name) @@ -664,11 +714,13 @@ public class IntVar : LinearExpr var_ = model.Variables[index]; } + /** Returns the index of the variable in the underlying CpModelProto. */ public int GetIndex() { return index_; } + /** Returns the index of the variable in the underlying CpModelProto. */ public int Index { get { @@ -676,6 +728,7 @@ public class IntVar : LinearExpr } } + /** The underlying IntegerVariableProto. */ public IntegerVariableProto Proto { get { @@ -686,6 +739,7 @@ public class IntVar : LinearExpr } } + /** Returns the domain of the variable. */ public Domain Domain { get { @@ -698,6 +752,7 @@ public class IntVar : LinearExpr return var_.Name ?? var_.ToString(); } + /** Returns the name of the variable given upon creation. */ public string Name() { return var_.Name; @@ -707,6 +762,14 @@ public class IntVar : LinearExpr protected IntegerVariableProto var_; } +/** + * + * Holds a Boolean variable. + * + * + * This class must be constructed from the CpModel class. + * + */ public sealed class BoolVar : IntVar, ILiteral { @@ -718,11 +781,13 @@ public sealed class BoolVar : IntVar, ILiteral { } + /** Returns the Boolean negation of that variable. */ public ILiteral Not() { return negation_ ??= new NotBoolVar(this); } + /** Returns the Boolean negation of that variable as a linear expression. */ public LinearExpr NotAsExpr() { return (LinearExpr)Not(); @@ -768,6 +833,14 @@ public sealed class NotBoolVar : LinearExpr, ILiteral private readonly BoolVar boolvar_; } +/** + * + * Holds a linear constraint: expression ∈ domain + * + * + * This class must be constructed from the CpModel class or from the comparison operators. + * + */ public sealed class BoundedLinearExpression { public enum Type diff --git a/ortools/sat/csharp/IntervalVariables.cs b/ortools/sat/csharp/IntervalVariables.cs index e2db8203fd..7efce19991 100644 --- a/ortools/sat/csharp/IntervalVariables.cs +++ b/ortools/sat/csharp/IntervalVariables.cs @@ -56,7 +56,7 @@ public class IntervalVar model_.Constraints.Add(ct); } - /** The Indexraint in the model proto */ + /** The Index of the interval in the model proto */ public int GetIndex() { return index_; diff --git a/ortools/sat/csharp/SearchHelpers.cs b/ortools/sat/csharp/SearchHelpers.cs index e770330670..7c4c7af1e3 100644 --- a/ortools/sat/csharp/SearchHelpers.cs +++ b/ortools/sat/csharp/SearchHelpers.cs @@ -17,8 +17,18 @@ using System.Collections.Generic; namespace Google.OrTools.Sat { +/** + * + * Parent class to create a callback called at each solution. + * + */ public class CpSolverSolutionCallback : SolutionCallback { + /** + * + * Returns the value of a linear expression in the current solution. + * + */ public long Value(LinearExpr e) { List terms = new List(); @@ -65,6 +75,11 @@ public class CpSolverSolutionCallback : SolutionCallback return constant; } + /** + * + * Returns the Boolean value of a literal in the current solution. + * + */ public Boolean BooleanValue(ILiteral literal) { if (literal is BoolVar || literal is NotBoolVar) @@ -79,6 +94,11 @@ public class CpSolverSolutionCallback : SolutionCallback } } +/** + * + * A specialized solution printer. + * + */ public class ObjectiveSolutionPrinter : CpSolverSolutionCallback { private DateTime _startTime;