diff --git a/ortools/linear_solver/csharp/linear_solver.i b/ortools/linear_solver/csharp/linear_solver.i index ea814869cc..8ee9c7e7ac 100644 --- a/ortools/linear_solver/csharp/linear_solver.i +++ b/ortools/linear_solver/csharp/linear_solver.i @@ -124,6 +124,7 @@ CONVERT_VECTOR(operations_research::MPVariable, MPVariable) // Expose the MPSolver's basic API, with trivial renames when needed. %unignore operations_research::MPSolver::MPSolver; %unignore operations_research::MPSolver::~MPSolver; +%newobject operations_research::MPSolver::CreateSolver; %unignore operations_research::MPSolver::CreateSolver; %unignore operations_research::MPSolver::ParseAndCheckSupportForProblemType; %unignore operations_research::MPSolver::MakeBoolVar; diff --git a/ortools/linear_solver/linear_solver.h b/ortools/linear_solver/linear_solver.h index b1fcc82c9a..5a45f907ec 100644 --- a/ortools/linear_solver/linear_solver.h +++ b/ortools/linear_solver/linear_solver.h @@ -221,7 +221,9 @@ class MPSolver { virtual ~MPSolver(); /** - * Recommended factory method to create a MPSolver instance. + * Recommended factory method to create a MPSolver instance, especially in + * non C++ languages. + * * It returns a newly created solver instance if successful, or a nullptr * otherwise. This can occur if the relevant interface is not linked in, or if * a needed license is not accessible for commercial solvers. diff --git a/ortools/linear_solver/python/linear_solver.i b/ortools/linear_solver/python/linear_solver.i index 4a5937cdae..9c9cd745e0 100644 --- a/ortools/linear_solver/python/linear_solver.i +++ b/ortools/linear_solver/python/linear_solver.i @@ -300,6 +300,7 @@ PY_CONVERT(MPVariable); %rename (Constraint) operations_research::MPSolver::MakeRowConstraint(double, double, const std::string&); %rename (Constraint) operations_research::MPSolver::MakeRowConstraint(const std::string&); %unignore operations_research::MPSolver::~MPSolver; +%newobject operations_research::MPSolver::CreateSolver; %unignore operations_research::MPSolver::CreateSolver; %unignore operations_research::MPSolver::ParseAndCheckSupportForProblemType; %unignore operations_research::MPSolver::Solve;