Go to the documentation of this file.
31 Variable x = solver.MakeIntVar(0.0,
double.PositiveInfinity,
"x");
32 Variable y = solver.MakeIntVar(0.0,
double.PositiveInfinity,
"y");
34 Console.WriteLine(
"Number of variables = " + solver.NumVariables());
39 solver.
Add(x + 7 * y <= 17.5);
44 Console.WriteLine(
"Number of constraints = " + solver.NumConstraints());
53 Solver.ResultStatus resultStatus = solver.Solve();
55 if (resultStatus !=
Solver.ResultStatus.OPTIMAL)
57 Console.WriteLine(
"The problem does not have an optimal solution!");
63 Console.WriteLine(
"Solution:");
64 Console.WriteLine(
"Objective value = " + solver.Objective().Value());
65 Console.WriteLine(
"x = " + x.SolutionValue());
66 Console.WriteLine(
"y = " + y.SolutionValue());
70 Console.WriteLine(
"\nAdvanced usage:");
71 Console.WriteLine(
"Problem solved in " + solver.WallTime() +
" milliseconds");
72 Console.WriteLine(
"Problem solved in " + solver.Iterations() +
" iterations");
73 Console.WriteLine(
"Problem solved in " + solver.Nodes() +
" branch-and-bound nodes");