DotNet Reference

DotNet Reference

linear_solver/Solver.cs
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 4.0.1
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10 
12 
13 public partial class Solver : global::System.IDisposable {
14  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
15  protected bool swigCMemOwn;
16 
17  internal Solver(global::System.IntPtr cPtr, bool cMemoryOwn) {
18  swigCMemOwn = cMemoryOwn;
19  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
20  }
21 
22  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Solver obj) {
23  return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
24  }
25 
26  ~Solver() {
27  Dispose(false);
28  }
29 
30  public void Dispose() {
31  Dispose(true);
32  global::System.GC.SuppressFinalize(this);
33  }
34 
35  protected virtual void Dispose(bool disposing) {
36  lock(this) {
37  if (swigCPtr.Handle != global::System.IntPtr.Zero) {
38  if (swigCMemOwn) {
39  swigCMemOwn = false;
41  }
42  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
43  }
44  }
45  }
46 
47  public Solver(string name, Solver.OptimizationProblemType problem_type) : this(operations_research_linear_solverPINVOKE.new_Solver(name, (int)problem_type), true) {
49  }
50 
51  public static bool SupportsProblemType(Solver.OptimizationProblemType problem_type) {
53  return ret;
54  }
55 
56  public void Clear() {
58  }
59 
60  public int NumVariables() {
62  return ret;
63  }
64 
67  return ret;
68  }
69 
70  public Variable LookupVariableOrNull(string var_name) {
71  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_LookupVariableOrNull(swigCPtr, var_name);
72  Variable ret = (cPtr == global::System.IntPtr.Zero) ? null : new Variable(cPtr, false);
74  return ret;
75  }
76 
77  public Variable MakeVar(double lb, double ub, bool integer, string name) {
78  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeVar(swigCPtr, lb, ub, integer, name);
79  Variable ret = (cPtr == global::System.IntPtr.Zero) ? null : new Variable(cPtr, false);
81  return ret;
82  }
83 
84  public Variable MakeNumVar(double lb, double ub, string name) {
85  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeNumVar(swigCPtr, lb, ub, name);
86  Variable ret = (cPtr == global::System.IntPtr.Zero) ? null : new Variable(cPtr, false);
88  return ret;
89  }
90 
91  public Variable MakeIntVar(double lb, double ub, string name) {
92  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeIntVar(swigCPtr, lb, ub, name);
93  Variable ret = (cPtr == global::System.IntPtr.Zero) ? null : new Variable(cPtr, false);
95  return ret;
96  }
97 
98  public Variable MakeBoolVar(string name) {
99  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeBoolVar(swigCPtr, name);
100  Variable ret = (cPtr == global::System.IntPtr.Zero) ? null : new Variable(cPtr, false);
102  return ret;
103  }
104 
105  public int NumConstraints() {
107  return ret;
108  }
109 
112  return ret;
113  }
114 
115  public Constraint LookupConstraintOrNull(string constraint_name) {
116  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_LookupConstraintOrNull(swigCPtr, constraint_name);
117  Constraint ret = (cPtr == global::System.IntPtr.Zero) ? null : new Constraint(cPtr, false);
119  return ret;
120  }
121 
122  public Constraint MakeConstraint(double lb, double ub) {
123  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeConstraint__SWIG_0(swigCPtr, lb, ub);
124  Constraint ret = (cPtr == global::System.IntPtr.Zero) ? null : new Constraint(cPtr, false);
125  return ret;
126  }
127 
129  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeConstraint__SWIG_1(swigCPtr);
130  Constraint ret = (cPtr == global::System.IntPtr.Zero) ? null : new Constraint(cPtr, false);
131  return ret;
132  }
133 
134  public Constraint MakeConstraint(double lb, double ub, string name) {
135  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeConstraint__SWIG_2(swigCPtr, lb, ub, name);
136  Constraint ret = (cPtr == global::System.IntPtr.Zero) ? null : new Constraint(cPtr, false);
138  return ret;
139  }
140 
141  public Constraint MakeConstraint(string name) {
142  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_MakeConstraint__SWIG_3(swigCPtr, name);
143  Constraint ret = (cPtr == global::System.IntPtr.Zero) ? null : new Constraint(cPtr, false);
145  return ret;
146  }
147 
148  public Objective Objective() {
149  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.Solver_Objective(swigCPtr);
150  Objective ret = (cPtr == global::System.IntPtr.Zero) ? null : new Objective(cPtr, false);
151  return ret;
152  }
153 
156  return ret;
157  }
158 
162  return ret;
163  }
164 
165  public double[] ComputeConstraintActivities() {
167  DoubleVector tmpVector = null;
168  if (cPtr != global::System.IntPtr.Zero) {
169  tmpVector = new DoubleVector(cPtr, true);
170  double[] outArray = new double[tmpVector.Count];
171  tmpVector.CopyTo(outArray);
172  return outArray;
173  }
174  return null;
175 }
176 
177  public bool VerifySolution(double tolerance, bool log_errors) {
178  bool ret = operations_research_linear_solverPINVOKE.Solver_VerifySolution(swigCPtr, tolerance, log_errors);
179  return ret;
180  }
181 
182  public void Reset() {
184  }
185 
186  public bool InterruptSolve() {
188  return ret;
189  }
190 
191  public bool SetSolverSpecificParametersAsString(string parameters) {
194  return ret;
195  }
196 
197  public void EnableOutput() {
199  }
200 
201  public void SuppressOutput() {
203  }
204 
205  public long Iterations() {
207  return ret;
208  }
209 
210  public long Nodes() {
212  return ret;
213  }
214 
215  public double ComputeExactConditionNumber() {
217  return ret;
218  }
219 
220  public void SetTimeLimit(long time_limit_milliseconds) {
221  operations_research_linear_solverPINVOKE.Solver_SetTimeLimit(swigCPtr, time_limit_milliseconds);
222  }
223 
224  public long WallTime() {
226  return ret;
227  }
228 
229  public string ExportModelAsLpFormat(bool obfuscated) {
231  return ret;
232  }
233 
234  public string ExportModelAsMpsFormat(bool fixed_format, bool obfuscated) {
235  string ret = operations_research_linear_solverPINVOKE.Solver_ExportModelAsMpsFormat(swigCPtr, fixed_format, obfuscated);
236  return ret;
237  }
238 
239  public void SetHint(MPVariableVector variables, double[] values) {
240  operations_research_linear_solverPINVOKE.Solver_SetHint(swigCPtr, MPVariableVector.getCPtr(variables), values.Length, values );
242  }
243 
244  public bool SetNumThreads(int num_theads) {
245  bool ret = operations_research_linear_solverPINVOKE.Solver_SetNumThreads(swigCPtr, num_theads);
246  return ret;
247  }
248 
250  CLP_LINEAR_PROGRAMMING = 0,
251  GLOP_LINEAR_PROGRAMMING = 2,
252  CBC_MIXED_INTEGER_PROGRAMMING = 5,
253  BOP_INTEGER_PROGRAMMING = 12,
254  SAT_INTEGER_PROGRAMMING = 14
255  }
256 
257  public enum ResultStatus {
258  OPTIMAL,
259  FEASIBLE,
260  INFEASIBLE,
261  UNBOUNDED,
262  ABNORMAL,
263  NOT_SOLVED = 6
264  }
265 
266  public enum BasisStatus {
267  FREE = 0,
268  AT_LOWER_BOUND,
269  AT_UPPER_BOUND,
270  FIXED_VALUE,
271  BASIC
272  }
273 
274 }
275 
276 }
int NumConstraints()
Variable MakeVar(double lb, double ub, bool integer, string name)
static global::System.IntPtr Solver_MakeConstraint__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
static global::System.IntPtr Solver_MakeIntVar(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, string jarg4)
Definition: Variable.cs:13
static global::System.IntPtr Solver_MakeConstraint__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1)
MPConstraintVector constraints()
Solver.ResultStatus Solve()
static void Solver_SetTimeLimit(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
string ExportModelAsLpFormat(bool obfuscated)
static long Solver_WallTime(global::System.Runtime.InteropServices.HandleRef jarg1)
void SuppressOutput()
Constraint MakeConstraint(string name)
int NumVariables()
double ComputeExactConditionNumber()
static global::System.IntPtr Solver_MakeNumVar(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, string jarg4)
static bool Solver_VerifySolution(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, bool jarg3)
static global::System.IntPtr Solver_MakeConstraint__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, string jarg4)
virtual void Dispose(bool disposing)
static long Solver_Nodes(global::System.Runtime.InteropServices.HandleRef jarg1)
Constraint MakeConstraint(double lb, double ub, string name)
long Iterations()
bool VerifySolution(double tolerance, bool log_errors)
MPVariableVector variables()
static global::System.IntPtr Solver_LookupConstraintOrNull(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
Definition: Objective.cs:13
static bool Pending
static int Solver_Solve__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static global::System.IntPtr Solver_LookupVariableOrNull(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
bool SetNumThreads(int num_theads)
void SetHint(MPVariableVector variables, double[] values)
void EnableOutput()
static string Solver_ExportModelAsMpsFormat(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2, bool jarg3)
static int Solver_NumVariables(global::System.Runtime.InteropServices.HandleRef jarg1)
Constraint MakeConstraint()
static int Solver_Solve__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_variables(global::System.Runtime.InteropServices.HandleRef jarg1)
Objective Objective()
static double Solver_ComputeExactConditionNumber(global::System.Runtime.InteropServices.HandleRef jarg1)
int Count
Definition: DoubleVector.cs:96
Variable LookupVariableOrNull(string var_name)
bool InterruptSolve()
static global::System.IntPtr Solver_MakeVar(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, bool jarg4, string jarg5)
Constraint LookupConstraintOrNull(string constraint_name)
static void Solver_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
Solver.ResultStatus Solve(MPSolverParameters param)
static void Solver_Reset(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_constraints(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_Objective(global::System.Runtime.InteropServices.HandleRef jarg1)
long WallTime()
static long Solver_Iterations(global::System.Runtime.InteropServices.HandleRef jarg1)
void Reset()
void SetTimeLimit(long time_limit_milliseconds)
static bool Solver_SetNumThreads(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
bool swigCMemOwn
static bool SupportsProblemType(Solver.OptimizationProblemType problem_type)
static bool Solver_SetSolverSpecificParametersAsString(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
static string Solver_ExportModelAsLpFormat(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2)
OptimizationProblemType
string ExportModelAsMpsFormat(bool fixed_format, bool obfuscated)
static bool Solver_SupportsProblemType(int jarg1)
BasisStatus
Solver(string name, Solver.OptimizationProblemType problem_type)
double[] ComputeConstraintActivities()
Definition: DoubleVector.cs:14
long Nodes()
void Clear()
static void Solver_SetHint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int length3, double[] jarg3)
ResultStatus
bool SetSolverSpecificParametersAsString(string parameters)
static global::System.Exception Retrieve()
void Dispose()
void CopyTo(double[] array)
static global::System.IntPtr Solver_MakeConstraint__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3)
static global::System.IntPtr Solver_ComputeConstraintActivities(global::System.Runtime.InteropServices.HandleRef jarg1)
static void delete_Solver(global::System.Runtime.InteropServices.HandleRef jarg1)
Variable MakeIntVar(double lb, double ub, string name)
static bool Solver_InterruptSolve(global::System.Runtime.InteropServices.HandleRef jarg1)
Variable MakeBoolVar(string name)
static void Solver_EnableOutput(global::System.Runtime.InteropServices.HandleRef jarg1)
static int Solver_NumConstraints(global::System.Runtime.InteropServices.HandleRef jarg1)
Variable MakeNumVar(double lb, double ub, string name)
static void Solver_SuppressOutput(global::System.Runtime.InteropServices.HandleRef jarg1)
Constraint MakeConstraint(double lb, double ub)
static global::System.IntPtr Solver_MakeBoolVar(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)