Go to the documentation of this file.
15 using System.Collections.Generic;
24 List<LinearExpr> exprs =
new List<LinearExpr>();
25 List<long> coeffs =
new List<long>();
30 while (exprs.Count > 0)
34 long coeff = coeffs[0];
36 if (coeff == 0)
continue;
44 coeffs.Add(p.
Coeff * coeff);
59 int index = expr.
Index;
60 long value = SolutionIntegerValue(index);
61 constant += coeff * value;
65 throw new ArgumentException(
66 "Cannot evaluate a literal in an integer expression.");
70 throw new ArgumentException(
"Cannot evaluate '" + expr.ToString() +
71 "' in an integer expression");
82 return SolutionBooleanValue(index);
86 throw new ArgumentException(
"Cannot evaluate '" + literal.ToString() +
87 "' as a boolean literal");
94 private DateTime _startTime;
95 private int _solutionCount;
99 _startTime = DateTime.Now;
104 var currentTime = DateTime.Now;
105 var objective = ObjectiveValue();
106 var objectiveBound = BestObjectiveBound();
107 var objLb = Math.Min(objective, objectiveBound);
108 var objUb = Math.Max(objective, objectiveBound);
109 var time = currentTime - _startTime;
111 Console.WriteLine(value: $
"Solution {_solutionCount}, time = {time.TotalSeconds} s, objective = [{objLb}, {objUb}]");