Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
Google.OrTools.LinearSolver.Solver Class Reference
Inheritance diagram for Google.OrTools.LinearSolver.Solver:

Public Types

enum  OptimizationProblemType {
  CLP_LINEAR_PROGRAMMING = 0 , GLPK_LINEAR_PROGRAMMING = 1 , GLOP_LINEAR_PROGRAMMING = 2 , PDLP_LINEAR_PROGRAMMING = 8 ,
  SCIP_MIXED_INTEGER_PROGRAMMING = 3 , GLPK_MIXED_INTEGER_PROGRAMMING = 4 , CBC_MIXED_INTEGER_PROGRAMMING = 5 , BOP_INTEGER_PROGRAMMING = 12 ,
  SAT_INTEGER_PROGRAMMING = 14 , GUROBI_LINEAR_PROGRAMMING = 6 , GUROBI_MIXED_INTEGER_PROGRAMMING = 7 , CPLEX_LINEAR_PROGRAMMING = 10 ,
  CPLEX_MIXED_INTEGER_PROGRAMMING = 11 , XPRESS_LINEAR_PROGRAMMING = 101 , XPRESS_MIXED_INTEGER_PROGRAMMING = 102
}
 
enum  ResultStatus {
  OPTIMAL , FEASIBLE , INFEASIBLE , UNBOUNDED ,
  ABNORMAL , MODEL_INVALID , NOT_SOLVED = 6
}
 
enum  BasisStatus {
  FREE = 0 , AT_LOWER_BOUND , AT_UPPER_BOUND , FIXED_VALUE ,
  BASIC
}
 

Public Member Functions

Variable[] MakeVarArray (int count, double lb, double ub, bool integer)
 
Variable[] MakeVarArray (int count, double lb, double ub, bool integer, string var_name)
 
Variable[,] MakeVarMatrix (int rows, int cols, double lb, double ub, bool integer)
 
Variable[,] MakeVarMatrix (int rows, int cols, double lb, double ub, bool integer, string name)
 
Variable[] MakeNumVarArray (int count, double lb, double ub)
 
Variable[] MakeNumVarArray (int count, double lb, double ub, string var_name)
 
Variable[,] MakeNumVarMatrix (int rows, int cols, double lb, double ub)
 
Variable[,] MakeNumVarMatrix (int rows, int cols, double lb, double ub, string name)
 
Variable[] MakeIntVarArray (int count, double lb, double ub)
 
Variable[] MakeIntVarArray (int count, double lb, double ub, string var_name)
 
Variable[,] MakeIntVarMatrix (int rows, int cols, double lb, double ub)
 
Variable[,] MakeIntVarMatrix (int rows, int cols, double lb, double ub, string name)
 
Variable[] MakeBoolVarArray (int count)
 
Variable[] MakeBoolVarArray (int count, string var_name)
 
Variable[,] MakeBoolVarMatrix (int rows, int cols)
 
Variable[,] MakeBoolVarMatrix (int rows, int cols, string name)
 
Constraint Add (LinearConstraint constraint)
 
void Minimize (LinearExpr expr)
 
void Maximize (LinearExpr expr)
 
void Minimize (Variable var)
 
void Maximize (Variable var)
 
void Dispose ()
 
 Solver (string name, Solver.OptimizationProblemType problem_type)
 
bool IsMip ()
 
void Clear ()
 
int NumVariables ()
 
MPVariableVector variables ()
 
Variable Variable (int index)
 
Variable LookupVariableOrNull (string var_name)
 
Variable MakeVar (double lb, double ub, bool integer, string name)
 
Variable MakeNumVar (double lb, double ub, string name)
 
Variable MakeIntVar (double lb, double ub, string name)
 
Variable MakeBoolVar (string name)
 
int NumConstraints ()
 
MPConstraintVector constraints ()
 
Constraint Constraint (int index)
 
Constraint LookupConstraintOrNull (string constraint_name)
 
Constraint MakeConstraint (double lb, double ub)
 
Constraint MakeConstraint ()
 
Constraint MakeConstraint (double lb, double ub, string name)
 
Constraint MakeConstraint (string name)
 
Objective Objective ()
 
Solver.ResultStatus Solve ()
 
Solver.ResultStatus Solve (MPSolverParameters param)
 
double[] ComputeConstraintActivities ()
 
bool VerifySolution (double tolerance, bool log_errors)
 
void Reset ()
 
bool InterruptSolve ()
 
bool SetSolverSpecificParametersAsString (string parameters)
 
void EnableOutput ()
 
void SuppressOutput ()
 
long Iterations ()
 
long Nodes ()
 
string SolverVersion ()
 
double ComputeExactConditionNumber ()
 
void SetTimeLimit (long time_limit_milliseconds)
 
long WallTime ()
 
string ExportModelAsLpFormat (bool obfuscated)
 
string ExportModelAsMpsFormat (bool fixed_format, bool obfuscated)
 
void SetHint (MPVariableVector variables, double[] values)
 
bool SetNumThreads (int num_theads)
 

Static Public Member Functions

static Solver CreateSolver (string solver_id)
 
static bool SupportsProblemType (Solver.OptimizationProblemType problem_type)
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Protected Attributes

bool swigCMemOwn
 

Detailed Description

Patch the MPSolver class to:

  • support custom versions of the array-based APIs (MakeVarArray, etc).
  • customize the construction, and the OptimizationProblemType enum.
  • support the natural language API.

Definition at line 15 of file Solver.cs.

Member Enumeration Documentation

◆ BasisStatus

Enumerator
FREE 
AT_LOWER_BOUND 
AT_UPPER_BOUND 
FIXED_VALUE 
BASIC 

Definition at line 321 of file Solver.cs.

◆ OptimizationProblemType

Enumerator
CLP_LINEAR_PROGRAMMING 
GLPK_LINEAR_PROGRAMMING 
GLOP_LINEAR_PROGRAMMING 
PDLP_LINEAR_PROGRAMMING 
SCIP_MIXED_INTEGER_PROGRAMMING 
GLPK_MIXED_INTEGER_PROGRAMMING 
CBC_MIXED_INTEGER_PROGRAMMING 
BOP_INTEGER_PROGRAMMING 
SAT_INTEGER_PROGRAMMING 
GUROBI_LINEAR_PROGRAMMING 
GUROBI_MIXED_INTEGER_PROGRAMMING 
CPLEX_LINEAR_PROGRAMMING 
CPLEX_MIXED_INTEGER_PROGRAMMING 
XPRESS_LINEAR_PROGRAMMING 
XPRESS_MIXED_INTEGER_PROGRAMMING 

Definition at line 293 of file Solver.cs.

◆ ResultStatus

Enumerator
OPTIMAL 
FEASIBLE 
INFEASIBLE 
UNBOUNDED 
ABNORMAL 
MODEL_INVALID 
NOT_SOLVED 

Definition at line 311 of file Solver.cs.

Constructor & Destructor Documentation

◆ Solver()

Google.OrTools.LinearSolver.Solver.Solver ( string name,
Solver.OptimizationProblemType problem_type )
inline

Definition at line 62 of file Solver.cs.

Member Function Documentation

◆ Add()

Constraint Google.OrTools.LinearSolver.Solver.Add ( LinearConstraint constraint)
inline

Definition at line 183 of file SolverHelper.cs.

◆ Clear()

void Google.OrTools.LinearSolver.Solver.Clear ( )
inline

Definition at line 83 of file Solver.cs.

◆ ComputeConstraintActivities()

double[] Google.OrTools.LinearSolver.Solver.ComputeConstraintActivities ( )
inline

Definition at line 204 of file Solver.cs.

◆ ComputeExactConditionNumber()

double Google.OrTools.LinearSolver.Solver.ComputeExactConditionNumber ( )
inline

Definition at line 259 of file Solver.cs.

◆ Constraint()

Constraint Google.OrTools.LinearSolver.Solver.Constraint ( int index)
inline

Definition at line 148 of file Solver.cs.

◆ constraints()

MPConstraintVector Google.OrTools.LinearSolver.Solver.constraints ( )
inline

Definition at line 143 of file Solver.cs.

◆ CreateSolver()

static Solver Google.OrTools.LinearSolver.Solver.CreateSolver ( string solver_id)
inlinestatic

Definition at line 66 of file Solver.cs.

◆ Dispose() [1/2]

void Google.OrTools.LinearSolver.Solver.Dispose ( )
inline

Definition at line 45 of file Solver.cs.

◆ Dispose() [2/2]

virtual void Google.OrTools.LinearSolver.Solver.Dispose ( bool disposing)
inlineprotectedvirtual

Definition at line 50 of file Solver.cs.

◆ EnableOutput()

void Google.OrTools.LinearSolver.Solver.EnableOutput ( )
inline

Definition at line 236 of file Solver.cs.

◆ ExportModelAsLpFormat()

string Google.OrTools.LinearSolver.Solver.ExportModelAsLpFormat ( bool obfuscated)
inline

Definition at line 273 of file Solver.cs.

◆ ExportModelAsMpsFormat()

string Google.OrTools.LinearSolver.Solver.ExportModelAsMpsFormat ( bool fixed_format,
bool obfuscated )
inline

Definition at line 278 of file Solver.cs.

◆ InterruptSolve()

bool Google.OrTools.LinearSolver.Solver.InterruptSolve ( )
inline

Definition at line 225 of file Solver.cs.

◆ IsMip()

bool Google.OrTools.LinearSolver.Solver.IsMip ( )
inline

Definition at line 78 of file Solver.cs.

◆ Iterations()

long Google.OrTools.LinearSolver.Solver.Iterations ( )
inline

Definition at line 244 of file Solver.cs.

◆ LookupConstraintOrNull()

Constraint Google.OrTools.LinearSolver.Solver.LookupConstraintOrNull ( string constraint_name)
inline

Definition at line 154 of file Solver.cs.

◆ LookupVariableOrNull()

Variable Google.OrTools.LinearSolver.Solver.LookupVariableOrNull ( string var_name)
inline

Definition at line 103 of file Solver.cs.

◆ MakeBoolVar()

Variable Google.OrTools.LinearSolver.Solver.MakeBoolVar ( string name)
inline

Definition at line 131 of file Solver.cs.

◆ MakeBoolVarArray() [1/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeBoolVarArray ( int count)
inline

Definition at line 146 of file SolverHelper.cs.

◆ MakeBoolVarArray() [2/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeBoolVarArray ( int count,
string var_name )
inline

Definition at line 151 of file SolverHelper.cs.

◆ MakeBoolVarMatrix() [1/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeBoolVarMatrix ( int rows,
int cols )
inline

Definition at line 156 of file SolverHelper.cs.

◆ MakeBoolVarMatrix() [2/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeBoolVarMatrix ( int rows,
int cols,
string name )
inline

Definition at line 169 of file SolverHelper.cs.

◆ MakeConstraint() [1/4]

Constraint Google.OrTools.LinearSolver.Solver.MakeConstraint ( )
inline

Definition at line 167 of file Solver.cs.

◆ MakeConstraint() [2/4]

Constraint Google.OrTools.LinearSolver.Solver.MakeConstraint ( double lb,
double ub )
inline

Definition at line 161 of file Solver.cs.

◆ MakeConstraint() [3/4]

Constraint Google.OrTools.LinearSolver.Solver.MakeConstraint ( double lb,
double ub,
string name )
inline

Definition at line 173 of file Solver.cs.

◆ MakeConstraint() [4/4]

Constraint Google.OrTools.LinearSolver.Solver.MakeConstraint ( string name)
inline

Definition at line 180 of file Solver.cs.

◆ MakeIntVar()

Variable Google.OrTools.LinearSolver.Solver.MakeIntVar ( double lb,
double ub,
string name )
inline

Definition at line 124 of file Solver.cs.

◆ MakeIntVarArray() [1/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeIntVarArray ( int count,
double lb,
double ub )
inline

Definition at line 109 of file SolverHelper.cs.

◆ MakeIntVarArray() [2/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeIntVarArray ( int count,
double lb,
double ub,
string var_name )
inline

Definition at line 114 of file SolverHelper.cs.

◆ MakeIntVarMatrix() [1/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeIntVarMatrix ( int rows,
int cols,
double lb,
double ub )
inline

Definition at line 119 of file SolverHelper.cs.

◆ MakeIntVarMatrix() [2/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeIntVarMatrix ( int rows,
int cols,
double lb,
double ub,
string name )
inline

Definition at line 132 of file SolverHelper.cs.

◆ MakeNumVar()

Variable Google.OrTools.LinearSolver.Solver.MakeNumVar ( double lb,
double ub,
string name )
inline

Definition at line 117 of file Solver.cs.

◆ MakeNumVarArray() [1/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeNumVarArray ( int count,
double lb,
double ub )
inline

Definition at line 72 of file SolverHelper.cs.

◆ MakeNumVarArray() [2/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeNumVarArray ( int count,
double lb,
double ub,
string var_name )
inline

Definition at line 77 of file SolverHelper.cs.

◆ MakeNumVarMatrix() [1/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeNumVarMatrix ( int rows,
int cols,
double lb,
double ub )
inline

Definition at line 82 of file SolverHelper.cs.

◆ MakeNumVarMatrix() [2/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeNumVarMatrix ( int rows,
int cols,
double lb,
double ub,
string name )
inline

Definition at line 95 of file SolverHelper.cs.

◆ MakeVar()

Variable Google.OrTools.LinearSolver.Solver.MakeVar ( double lb,
double ub,
bool integer,
string name )
inline

Definition at line 110 of file Solver.cs.

◆ MakeVarArray() [1/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeVarArray ( int count,
double lb,
double ub,
bool integer )
inline

Definition at line 25 of file SolverHelper.cs.

◆ MakeVarArray() [2/2]

Variable[] Google.OrTools.LinearSolver.Solver.MakeVarArray ( int count,
double lb,
double ub,
bool integer,
string var_name )
inline

Definition at line 35 of file SolverHelper.cs.

◆ MakeVarMatrix() [1/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeVarMatrix ( int rows,
int cols,
double lb,
double ub,
bool integer )
inline

Definition at line 45 of file SolverHelper.cs.

◆ MakeVarMatrix() [2/2]

Variable[,] Google.OrTools.LinearSolver.Solver.MakeVarMatrix ( int rows,
int cols,
double lb,
double ub,
bool integer,
string name )
inline

Definition at line 58 of file SolverHelper.cs.

◆ Maximize() [1/2]

void Google.OrTools.LinearSolver.Solver.Maximize ( LinearExpr expr)
inline

Definition at line 201 of file SolverHelper.cs.

◆ Maximize() [2/2]

void Google.OrTools.LinearSolver.Solver.Maximize ( Variable var)
inline

Definition at line 221 of file SolverHelper.cs.

◆ Minimize() [1/2]

void Google.OrTools.LinearSolver.Solver.Minimize ( LinearExpr expr)
inline

Definition at line 188 of file SolverHelper.cs.

◆ Minimize() [2/2]

void Google.OrTools.LinearSolver.Solver.Minimize ( Variable var)
inline

Definition at line 214 of file SolverHelper.cs.

◆ Nodes()

long Google.OrTools.LinearSolver.Solver.Nodes ( )
inline

Definition at line 249 of file Solver.cs.

◆ NumConstraints()

int Google.OrTools.LinearSolver.Solver.NumConstraints ( )
inline

Definition at line 138 of file Solver.cs.

◆ NumVariables()

int Google.OrTools.LinearSolver.Solver.NumVariables ( )
inline

Definition at line 87 of file Solver.cs.

◆ Objective()

Objective Google.OrTools.LinearSolver.Solver.Objective ( )
inline

Definition at line 187 of file Solver.cs.

◆ Reset()

void Google.OrTools.LinearSolver.Solver.Reset ( )
inline

Definition at line 221 of file Solver.cs.

◆ SetHint()

void Google.OrTools.LinearSolver.Solver.SetHint ( MPVariableVector variables,
double[] values )
inline

Definition at line 283 of file Solver.cs.

◆ SetNumThreads()

bool Google.OrTools.LinearSolver.Solver.SetNumThreads ( int num_theads)
inline

Definition at line 288 of file Solver.cs.

◆ SetSolverSpecificParametersAsString()

bool Google.OrTools.LinearSolver.Solver.SetSolverSpecificParametersAsString ( string parameters)
inline

Definition at line 230 of file Solver.cs.

◆ SetTimeLimit()

void Google.OrTools.LinearSolver.Solver.SetTimeLimit ( long time_limit_milliseconds)
inline

Definition at line 264 of file Solver.cs.

◆ Solve() [1/2]

Solver.ResultStatus Google.OrTools.LinearSolver.Solver.Solve ( )
inline

Definition at line 193 of file Solver.cs.

◆ Solve() [2/2]

Solver.ResultStatus Google.OrTools.LinearSolver.Solver.Solve ( MPSolverParameters param)
inline

Definition at line 198 of file Solver.cs.

◆ SolverVersion()

string Google.OrTools.LinearSolver.Solver.SolverVersion ( )
inline

Definition at line 254 of file Solver.cs.

◆ SupportsProblemType()

static bool Google.OrTools.LinearSolver.Solver.SupportsProblemType ( Solver.OptimizationProblemType problem_type)
inlinestatic

Definition at line 73 of file Solver.cs.

◆ SuppressOutput()

void Google.OrTools.LinearSolver.Solver.SuppressOutput ( )
inline

Definition at line 240 of file Solver.cs.

◆ Variable()

Variable Google.OrTools.LinearSolver.Solver.Variable ( int index)
inline

Definition at line 97 of file Solver.cs.

◆ variables()

MPVariableVector Google.OrTools.LinearSolver.Solver.variables ( )
inline

Definition at line 92 of file Solver.cs.

◆ VerifySolution()

bool Google.OrTools.LinearSolver.Solver.VerifySolution ( double tolerance,
bool log_errors )
inline

Definition at line 216 of file Solver.cs.

◆ WallTime()

long Google.OrTools.LinearSolver.Solver.WallTime ( )
inline

Definition at line 268 of file Solver.cs.

Member Data Documentation

◆ swigCMemOwn

bool Google.OrTools.LinearSolver.Solver.swigCMemOwn
protected

Definition at line 17 of file Solver.cs.


The documentation for this class was generated from the following files: