Sync g3 -> github

This commit is contained in:
Corentin Le Molgat
2019-05-14 09:44:13 +02:00
parent 6cc1df06d7
commit d7a33542a2
10 changed files with 32 additions and 31 deletions

View File

@@ -29,7 +29,8 @@ public class SimpleLpProgram {
public static void main(String[] args) throws Exception {
// [START solver]
// Create the linear solver with the GLOP backend.
MPSolver solver = new MPSolver("SimpleLpProgram",
MPSolver solver = new MPSolver(
"SimpleLpProgram",
MPSolver.OptimizationProblemType.GLOP_LINEAR_PROGRAMMING);
// [END solver]

View File

@@ -30,7 +30,7 @@ def main():
x = solver.NumVar(0, 1, 'x')
y = solver.NumVar(0, 2, 'y')
print('Number of variables = ', solver.NumVariables())
print('Number of variables =', solver.NumVariables())
# [END variables]
# [START constraints]
@@ -39,7 +39,7 @@ def main():
ct.SetCoefficient(x, 1)
ct.SetCoefficient(y, 1)
print('Number of constraints = ', solver.NumConstraints())
print('Number of constraints =', solver.NumConstraints())
# [END constraints]
# [START objective]
@@ -56,9 +56,9 @@ def main():
# [START print_solution]
print('Solution:')
print('Objective value = ', objective.Value())
print('x = ', x.solution_value())
print('y = ', y.solution_value())
print('Objective value =', objective.Value())
print('x =', x.solution_value())
print('y =', y.solution_value())
# [END print_solution]

View File

@@ -31,7 +31,7 @@ def main():
x = solver.IntVar(0.0, infinity, 'x')
y = solver.IntVar(0.0, infinity, 'y')
print('Number of variables = ', solver.NumVariables())
print('Number of variables =', solver.NumVariables())
# [END variables]
# [START constraints]
@@ -41,7 +41,7 @@ def main():
# x <= 3.5.
solver.Add(x <= 3.5)
print('Number of constraints = ', solver.NumConstraints())
print('Number of constraints =', solver.NumConstraints())
# [END constraints]
# [START objective]
@@ -61,9 +61,9 @@ def main():
# [START print_solution]
print('Solution:')
print('Objective value = ', solver.Objective().Value())
print('x = ', x.solution_value())
print('y = ', y.solution_value())
print('Objective value =', solver.Objective().Value())
print('x =', x.solution_value())
print('y =', y.solution_value())
# [END print_solution]
# [START advanced]