diff --git a/examples/dotnet/csintegerprogramming.cs b/examples/dotnet/csintegerprogramming.cs index c8e2181f39..557a0caf01 100644 --- a/examples/dotnet/csintegerprogramming.cs +++ b/examples/dotnet/csintegerprogramming.cs @@ -106,19 +106,19 @@ public class CsIntegerProgramming static void Main() { Console.WriteLine("---- Integer programming example with GLPK ----"); - RunIntegerProgrammingExample("GLPK_MIXED_INTEGER_PROGRAMMING"); + RunIntegerProgrammingExample("GLPK"); Console.WriteLine("---- Linear programming example with CBC ----"); - RunIntegerProgrammingExample("CBC_MIXED_INTEGER_PROGRAMMING"); + RunIntegerProgrammingExample("CBC"); Console.WriteLine("---- Linear programming example with SCIP ----"); - RunIntegerProgrammingExample("SCIP_MIXED_INTEGER_PROGRAMMING"); + RunIntegerProgrammingExample("SCIP"); Console.WriteLine( "---- Integer programming example (Natural API) with GLPK ----"); - RunIntegerProgrammingExampleNaturalApi("GLPK_MIXED_INTEGER_PROGRAMMING"); + RunIntegerProgrammingExampleNaturalApi("GLPK"); Console.WriteLine( "---- Linear programming example (Natural API) with CBC ----"); - RunIntegerProgrammingExampleNaturalApi("CBC_MIXED_INTEGER_PROGRAMMING"); + RunIntegerProgrammingExampleNaturalApi("CBC"); Console.WriteLine( "---- Linear programming example (Natural API) with SCIP ----"); - RunIntegerProgrammingExampleNaturalApi("SCIP_MIXED_INTEGER_PROGRAMMING"); + RunIntegerProgrammingExampleNaturalApi("SCIP"); } } diff --git a/examples/dotnet/cslinearprogramming.cs b/examples/dotnet/cslinearprogramming.cs index 28b2128d68..b58611f1bc 100644 --- a/examples/dotnet/cslinearprogramming.cs +++ b/examples/dotnet/cslinearprogramming.cs @@ -18,6 +18,8 @@ public class CsLinearProgramming { private static void RunLinearProgrammingExample(String solverType) { + Console.WriteLine($"---- Linear programming example with {solverType} ----"); + Solver solver = Solver.CreateSolver("IntegerProgramming", solverType); if (solver == null) { @@ -96,6 +98,9 @@ public class CsLinearProgramming private static void RunLinearProgrammingExampleNaturalApi( String solverType, bool printModel) { + Console.WriteLine( + $"---- Linear programming example (Natural API) with {solverType} ----"); + Solver solver = Solver.CreateSolver("IntegerProgramming", solverType); if (solver == null) { @@ -157,20 +162,12 @@ public class CsLinearProgramming static void Main() { - Console.WriteLine("---- Linear programming example with GLOP ----"); - RunLinearProgrammingExample("GLOP_LINEAR_PROGRAMMING"); - Console.WriteLine("---- Linear programming example with GLPK ----"); - RunLinearProgrammingExample("GLPK_LINEAR_PROGRAMMING"); - Console.WriteLine("---- Linear programming example with CLP ----"); - RunLinearProgrammingExample("CLP_LINEAR_PROGRAMMING"); - Console.WriteLine( - "---- Linear programming example (Natural API) with GLOP ----"); - RunLinearProgrammingExampleNaturalApi("GLOP_LINEAR_PROGRAMMING", true); - Console.WriteLine( - "---- Linear programming example (Natural API) with GLPK ----"); - RunLinearProgrammingExampleNaturalApi("GLPK_LINEAR_PROGRAMMING", false); - Console.WriteLine( - "---- Linear programming example (Natural API) with CLP ----"); - RunLinearProgrammingExampleNaturalApi("CLP_LINEAR_PROGRAMMING", false); + RunLinearProgrammingExample("GLOP"); + RunLinearProgrammingExample("GLPK_LP"); + RunLinearProgrammingExample("CLP"); + + RunLinearProgrammingExampleNaturalApi("GLOP", true); + RunLinearProgrammingExampleNaturalApi("GLPK_LP", false); + RunLinearProgrammingExampleNaturalApi("CLP", false); } } diff --git a/examples/java/IntegerProgramming.java b/examples/java/IntegerProgramming.java index 2d48a6c379..353cd50ee1 100644 --- a/examples/java/IntegerProgramming.java +++ b/examples/java/IntegerProgramming.java @@ -80,10 +80,10 @@ public class IntegerProgramming { public static void main(String[] args) throws Exception { System.out.println("---- Integer programming example with SCIP (recommended) ----"); - runIntegerProgrammingExample("SCIP_MIXED_INTEGER_PROGRAMMING"); + runIntegerProgrammingExample("SCIP"); System.out.println("---- Integer programming example with CBC ----"); - runIntegerProgrammingExample("CBC_MIXED_INTEGER_PROGRAMMING"); + runIntegerProgrammingExample("CBC"); System.out.println("---- Integer programming example with CP-SAT ----"); - runIntegerProgrammingExample("SAT_INTEGER_PROGRAMMING"); + runIntegerProgrammingExample("SAT"); } } diff --git a/examples/java/LinearProgramming.java b/examples/java/LinearProgramming.java index c6cf0e5900..271674d75e 100644 --- a/examples/java/LinearProgramming.java +++ b/examples/java/LinearProgramming.java @@ -116,8 +116,8 @@ public class LinearProgramming { public static void main(String[] args) throws Exception { System.out.println("---- Linear programming example with GLOP (recommended) ----"); - runLinearProgrammingExample("GLOP_LINEAR_PROGRAMMING", true); + runLinearProgrammingExample("GLOP", true); System.out.println("---- Linear programming example with CLP ----"); - runLinearProgrammingExample("CLP_LINEAR_PROGRAMMING", false); + runLinearProgrammingExample("CLP", false); } } diff --git a/examples/python/linear_programming.py b/examples/python/linear_programming.py index 4f404bb60e..62da7bc23e 100644 --- a/examples/python/linear_programming.py +++ b/examples/python/linear_programming.py @@ -13,6 +13,7 @@ """Linear programming examples that show how to use the APIs.""" from __future__ import print_function + from ortools.linear_solver import pywraplp diff --git a/ortools/linear_solver/java/linear_solver.i b/ortools/linear_solver/java/linear_solver.i index b530d40e94..469e30ed74 100644 --- a/ortools/linear_solver/java/linear_solver.i +++ b/ortools/linear_solver/java/linear_solver.i @@ -285,6 +285,7 @@ PROTO2_RETURN( %unignore operations_research::MPSolver; %unignore operations_research::MPSolver::MPSolver; %unignore operations_research::MPSolver::~MPSolver; +%newobject operations_research::MPSolver::CreateSolver; %rename (createSolver) operations_research::MPSolver::CreateSolver; %rename (parseAndCheckSupportForProblemType) operations_research::MPSolver::ParseAndCheckSupportForProblemType; diff --git a/ortools/linear_solver/samples/AssignmentMip.cs b/ortools/linear_solver/samples/AssignmentMip.cs index 7e34df46a9..52606a1e06 100644 --- a/ortools/linear_solver/samples/AssignmentMip.cs +++ b/ortools/linear_solver/samples/AssignmentMip.cs @@ -36,7 +36,7 @@ public class AssignmentMip // Model. // [START model] - Solver solver = Solver.CreateSolver("AssignmentMip", "cbc"); + Solver solver = Solver.CreateSolver("AssignmentMip", "CBC"); // [END model] // Variables. diff --git a/ortools/linear_solver/samples/AssignmentMip.java b/ortools/linear_solver/samples/AssignmentMip.java index 3d7310f974..364526ae45 100644 --- a/ortools/linear_solver/samples/AssignmentMip.java +++ b/ortools/linear_solver/samples/AssignmentMip.java @@ -43,7 +43,7 @@ public class AssignmentMip { // Solver // [START solver] // Create the linear solver with the CBC backend. - MPSolver solver = MPSolver.createSolver("AssignmentMip", "cbc"); + MPSolver solver = MPSolver.createSolver("AssignmentMip", "CBC"); // [END solver] // Variables diff --git a/ortools/linear_solver/samples/BinPackingMip.cs b/ortools/linear_solver/samples/BinPackingMip.cs index 18ed6664c0..3eaee73fe5 100644 --- a/ortools/linear_solver/samples/BinPackingMip.cs +++ b/ortools/linear_solver/samples/BinPackingMip.cs @@ -38,7 +38,7 @@ public class BinPackingMip // [START solver] // Create the linear solver with the CBC backend. - Solver solver = Solver.CreateSolver("BinPackingMip", "cbc"); + Solver solver = Solver.CreateSolver("BinPackingMip", "CBC"); // [END solver] // [START program_part2] diff --git a/ortools/linear_solver/samples/BinPackingMip.java b/ortools/linear_solver/samples/BinPackingMip.java index bb53a465bf..1574ae9c0e 100644 --- a/ortools/linear_solver/samples/BinPackingMip.java +++ b/ortools/linear_solver/samples/BinPackingMip.java @@ -45,7 +45,7 @@ public class BinPackingMip { // [START solver] // Create the linear solver with the CBC backend. - MPSolver solver = MPSolver.createSolver("BinPackingMip", "cbc"); + MPSolver solver = MPSolver.createSolver("BinPackingMip", "CBC"); // [END solver] // [START program_part2] diff --git a/ortools/linear_solver/samples/LinearProgrammingExample.cs b/ortools/linear_solver/samples/LinearProgrammingExample.cs index 1573f841f6..dee9d58e80 100644 --- a/ortools/linear_solver/samples/LinearProgrammingExample.cs +++ b/ortools/linear_solver/samples/LinearProgrammingExample.cs @@ -20,7 +20,7 @@ public class LinearProgrammingExample static void Main() { // [START solver] - Solver solver = Solver.CreateSolver("LinearProgrammingExample", "glop"); + Solver solver = Solver.CreateSolver("LinearProgrammingExample", "GLOP"); // [END solver] // x and y are continuous non-negative variables. // [START variables] diff --git a/ortools/linear_solver/samples/LinearProgrammingExample.java b/ortools/linear_solver/samples/LinearProgrammingExample.java index 39129716ae..a280ade296 100644 --- a/ortools/linear_solver/samples/LinearProgrammingExample.java +++ b/ortools/linear_solver/samples/LinearProgrammingExample.java @@ -27,7 +27,7 @@ public class LinearProgrammingExample { public static void main(String[] args) throws Exception { // [START solver] - MPSolver solver = MPSolver.createSolver("LinearProgrammingExample", "glop"); + MPSolver solver = MPSolver.createSolver("LinearProgrammingExample", "GLOP"); // [END solver] // [START variables] diff --git a/ortools/linear_solver/samples/MipVarArray.cs b/ortools/linear_solver/samples/MipVarArray.cs index 61c26e8a3d..2518a96887 100644 --- a/ortools/linear_solver/samples/MipVarArray.cs +++ b/ortools/linear_solver/samples/MipVarArray.cs @@ -44,7 +44,7 @@ public class MipVarArray // [START solver] // Create the linear solver with the CBC backend. - Solver solver = Solver.CreateSolver("MipVarArray", "cbc"); + Solver solver = Solver.CreateSolver("MipVarArray", "CBC"); // [END solver] // [START program_part2] diff --git a/ortools/linear_solver/samples/MipVarArray.java b/ortools/linear_solver/samples/MipVarArray.java index c523ad92b6..c6f287edb2 100644 --- a/ortools/linear_solver/samples/MipVarArray.java +++ b/ortools/linear_solver/samples/MipVarArray.java @@ -50,7 +50,7 @@ public class MipVarArray { // [START solver] // Create the linear solver with the CBC backend. - MPSolver solver = MPSolver.createSolver("MipVarArray", "cbc"); + MPSolver solver = MPSolver.createSolver("MipVarArray", "CBC"); // [END solver] // [START program_part2] diff --git a/ortools/linear_solver/samples/MultipleKnapsackMip.cs b/ortools/linear_solver/samples/MultipleKnapsackMip.cs index 3c2a9c87c9..509bf66b5f 100644 --- a/ortools/linear_solver/samples/MultipleKnapsackMip.cs +++ b/ortools/linear_solver/samples/MultipleKnapsackMip.cs @@ -41,7 +41,7 @@ public class MultipleKnapsackMip // [START solver] // Create the linear solver with the CBC backend. - Solver solver = Solver.CreateSolver("MultipleKnapsackMip", "cbc"); + Solver solver = Solver.CreateSolver("MultipleKnapsackMip", "CBC"); // [END solver] // [START program_part2] diff --git a/ortools/linear_solver/samples/MultipleKnapsackMip.java b/ortools/linear_solver/samples/MultipleKnapsackMip.java index 36cd5e937a..cca0ecd76c 100644 --- a/ortools/linear_solver/samples/MultipleKnapsackMip.java +++ b/ortools/linear_solver/samples/MultipleKnapsackMip.java @@ -46,7 +46,7 @@ public class MultipleKnapsackMip { // [START solver] // Create the linear solver with the CBC backend. - MPSolver solver = MPSolver.createSolver("MultipleKnapsackMip", "cbc"); + MPSolver solver = MPSolver.createSolver("MultipleKnapsackMip", "CBC"); // [END solver] // [START program_part2] diff --git a/ortools/linear_solver/samples/SimpleLpProgram.cs b/ortools/linear_solver/samples/SimpleLpProgram.cs index 9f82556740..80ab61ffd1 100644 --- a/ortools/linear_solver/samples/SimpleLpProgram.cs +++ b/ortools/linear_solver/samples/SimpleLpProgram.cs @@ -22,7 +22,7 @@ public class SimpleLpProgram { // [START solver] // Create the linear solver with the GLOP backend. - Solver solver = Solver.CreateSolver("SimpleLpProgram", "glop"); + Solver solver = Solver.CreateSolver("SimpleLpProgram", "GLOP"); // [END solver] // [START variables] diff --git a/ortools/linear_solver/samples/SimpleLpProgram.java b/ortools/linear_solver/samples/SimpleLpProgram.java index 83d30d6a86..ff4c340f4f 100644 --- a/ortools/linear_solver/samples/SimpleLpProgram.java +++ b/ortools/linear_solver/samples/SimpleLpProgram.java @@ -30,7 +30,7 @@ public class SimpleLpProgram { public static void main(String[] args) throws Exception { // [START solver] // Create the linear solver with the GLOP backend. - MPSolver solver = MPSolver.createSolver("SimpleLpProgram", "glop"); + MPSolver solver = MPSolver.createSolver("SimpleLpProgram", "GLOP"); // [END solver] // [START variables] diff --git a/ortools/linear_solver/samples/SimpleMipProgram.cs b/ortools/linear_solver/samples/SimpleMipProgram.cs index 6d84e8787b..b39e9d08af 100644 --- a/ortools/linear_solver/samples/SimpleMipProgram.cs +++ b/ortools/linear_solver/samples/SimpleMipProgram.cs @@ -23,7 +23,7 @@ public class SimpleMipProgram { // [START solver] // Create the linear solver with the CBC backend. - Solver solver = Solver.CreateSolver("SimpleMipProgram", "cbc"); + Solver solver = Solver.CreateSolver("SimpleMipProgram", "CBC"); // [END solver] // [START variables] diff --git a/ortools/linear_solver/samples/SimpleMipProgram.java b/ortools/linear_solver/samples/SimpleMipProgram.java index 96d6488981..7dd394b716 100644 --- a/ortools/linear_solver/samples/SimpleMipProgram.java +++ b/ortools/linear_solver/samples/SimpleMipProgram.java @@ -30,7 +30,7 @@ public class SimpleMipProgram { public static void main(String[] args) throws Exception { // [START solver] // Create the linear solver with the CBC backend. - MPSolver solver = MPSolver.createSolver("SimpleMipProgram", "cbc"); + MPSolver solver = MPSolver.createSolver("SimpleMipProgram", "CBC"); // [END solver] // [START variables] diff --git a/ortools/linear_solver/samples/assignment_mip.py b/ortools/linear_solver/samples/assignment_mip.py index e272d56a24..3115b7e234 100644 --- a/ortools/linear_solver/samples/assignment_mip.py +++ b/ortools/linear_solver/samples/assignment_mip.py @@ -34,7 +34,7 @@ def main(): # Solver # [START solver] # Create the mip solver with the CBC backend. - solver = pywraplp.Solver.CreateSolver('assignment_mip', 'cbc') + solver = pywraplp.Solver.CreateSolver('assignment_mip', 'CBC') # [END solver] diff --git a/ortools/linear_solver/samples/bin_packing_mip.py b/ortools/linear_solver/samples/bin_packing_mip.py index 8c8e23d970..42674b8738 100644 --- a/ortools/linear_solver/samples/bin_packing_mip.py +++ b/ortools/linear_solver/samples/bin_packing_mip.py @@ -43,7 +43,7 @@ def main(): # [START solver] # Create the mip solver with the CBC backend. - solver = pywraplp.Solver.CreateSolver('bin_packing_mip', 'cbc') + solver = pywraplp.Solver.CreateSolver('bin_packing_mip', 'CBC') # [END solver] diff --git a/ortools/linear_solver/samples/integer_programming_example.py b/ortools/linear_solver/samples/integer_programming_example.py index b49be1d9a9..0c219bc011 100644 --- a/ortools/linear_solver/samples/integer_programming_example.py +++ b/ortools/linear_solver/samples/integer_programming_example.py @@ -22,7 +22,7 @@ def IntegerProgrammingExample(): """Integer programming sample.""" # [START solver] # Create the mip solver with the CBC backend. - solver = pywraplp.Solver.CreateSolver('integer_programming_example', 'cbc') + solver = pywraplp.Solver.CreateSolver('integer_programming_example', 'CBC') # [END solver] diff --git a/ortools/linear_solver/samples/linear_programming_example.py b/ortools/linear_solver/samples/linear_programming_example.py index 55e2352e55..9508c6414a 100644 --- a/ortools/linear_solver/samples/linear_programming_example.py +++ b/ortools/linear_solver/samples/linear_programming_example.py @@ -23,7 +23,7 @@ def LinearProgrammingExample(): """Linear programming sample.""" # Instantiate a Glop solver, naming it LinearExample. # [START solver] - solver = pywraplp.Solver.CreateSolver('linear_programming_examples', 'glop') + solver = pywraplp.Solver.CreateSolver('linear_programming_examples', 'GLOP') # [END solver] # Create the two variables and let them take on any non-negative value. diff --git a/ortools/linear_solver/samples/mip_var_array.py b/ortools/linear_solver/samples/mip_var_array.py index 6c02d37c12..549a782a06 100644 --- a/ortools/linear_solver/samples/mip_var_array.py +++ b/ortools/linear_solver/samples/mip_var_array.py @@ -47,7 +47,7 @@ def main(): # [END program_part1] # [START solver] # Create the mip solver with the CBC backend. - solver = pywraplp.Solver.CreateSolver('mip_var_array', 'cbc') + solver = pywraplp.Solver.CreateSolver('mip_var_array', 'CBC') # [END solver] # [START program_part2] diff --git a/ortools/linear_solver/samples/multiple_knapsack_mip.py b/ortools/linear_solver/samples/multiple_knapsack_mip.py index aa20275ea6..6fb868a467 100644 --- a/ortools/linear_solver/samples/multiple_knapsack_mip.py +++ b/ortools/linear_solver/samples/multiple_knapsack_mip.py @@ -47,7 +47,7 @@ def main(): # [START solver] # Create the mip solver with the CBC backend. - solver = pywraplp.Solver.CreateSolver('multiple_knapsack_mip', 'cbc') + solver = pywraplp.Solver.CreateSolver('multiple_knapsack_mip', 'CBC') # [END solver] # [START program_part2] diff --git a/ortools/linear_solver/samples/simple_lp_program.py b/ortools/linear_solver/samples/simple_lp_program.py index 9dc49f3b3e..c112e8a96a 100644 --- a/ortools/linear_solver/samples/simple_lp_program.py +++ b/ortools/linear_solver/samples/simple_lp_program.py @@ -21,7 +21,7 @@ from ortools.linear_solver import pywraplp def main(): # [START solver] # Create the linear solver with the GLOP backend. - solver = pywraplp.Solver.CreateSolver('simple_lp_program', 'glop') + solver = pywraplp.Solver.CreateSolver('simple_lp_program', 'GLOP') # [END solver] # [START variables] diff --git a/ortools/linear_solver/samples/simple_mip_program.py b/ortools/linear_solver/samples/simple_mip_program.py index 26e6ec4b6a..28cd43d806 100644 --- a/ortools/linear_solver/samples/simple_mip_program.py +++ b/ortools/linear_solver/samples/simple_mip_program.py @@ -21,7 +21,7 @@ from ortools.linear_solver import pywraplp def main(): # [START solver] # Create the mip solver with the CBC backend. - solver = pywraplp.Solver.CreateSolver('simple_mip_program', 'cbc') + solver = pywraplp.Solver.CreateSolver('simple_mip_program', 'CBC') # [END solver] # [START variables]