linear_solver: format .cs
This commit is contained in:
@@ -194,7 +194,7 @@ class ProductCst : LinearExpr
|
||||
{
|
||||
return expr_.SolutionValue() * coeff_;
|
||||
}
|
||||
|
||||
|
||||
private LinearExpr expr_;
|
||||
private double coeff_;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ class SumCst : LinearExpr
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override double SolutionValue()
|
||||
{
|
||||
return expr_.SolutionValue() + coeff_;
|
||||
|
||||
@@ -446,16 +446,17 @@ public class LinearSolverTest
|
||||
[Fact]
|
||||
static void Given_a_LinearExpr_and_a_solution_When_SolutionValue_is_called_then_the_result_is_correct()
|
||||
{
|
||||
Console.WriteLine(nameof(Given_a_LinearExpr_and_a_solution_When_SolutionValue_is_called_then_the_result_is_correct));
|
||||
Console.WriteLine(
|
||||
nameof(Given_a_LinearExpr_and_a_solution_When_SolutionValue_is_called_then_the_result_is_correct));
|
||||
Solver solver = Solver.CreateSolver("glop");
|
||||
// x, y and z are fixed; we don't want to test the solver here.
|
||||
Variable x = solver.MakeIntVar(3, 3, "x");
|
||||
Variable y = solver.MakeIntVar(4, 4, "y");
|
||||
Variable z = solver.MakeIntVar(5, 5, "z");
|
||||
|
||||
LinearExpr part1 = x * 2; // 6
|
||||
LinearExpr part2 = y * 3 + z + 4; // 21
|
||||
LinearExpr objective = part1 + part2; // 27
|
||||
LinearExpr part1 = x * 2; // 6
|
||||
LinearExpr part2 = y * 3 + z + 4; // 21
|
||||
LinearExpr objective = part1 + part2; // 27
|
||||
LinearExpr anew = new();
|
||||
solver.Maximize(objective);
|
||||
solver.Solve();
|
||||
|
||||
Reference in New Issue
Block a user