DotNet Reference

DotNet Reference

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  MpDoubleVector tmpVector = null;
168  if (cPtr != global::System.IntPtr.Zero) {
169  tmpVector = new MpDoubleVector(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  }
255 
256  public enum ResultStatus {
257  OPTIMAL,
258  FEASIBLE,
259  INFEASIBLE,
260  UNBOUNDED,
261  ABNORMAL,
262  NOT_SOLVED = 6
263  }
264 
265  public enum BasisStatus {
266  FREE = 0,
267  AT_LOWER_BOUND,
268  AT_UPPER_BOUND,
269  FIXED_VALUE,
270  BASIC
271  }
272 
273 }
274 
275 }
Solver.ResultStatus Solve()
Definition: Solver.cs:154
static int Solver_Solve__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static long Solver_Nodes(global::System.Runtime.InteropServices.HandleRef jarg1)
static int Solver_NumVariables(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_MakeConstraint__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1)
bool VerifySolution(double tolerance, bool log_errors)
Definition: Solver.cs:177
static bool SupportsProblemType(Solver.OptimizationProblemType problem_type)
Definition: Solver.cs:51
static global::System.IntPtr Solver_MakeNumVar(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, string jarg4)
static bool Solver_InterruptSolve(global::System.Runtime.InteropServices.HandleRef jarg1)
static void Solver_SetHint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int length3, double[] jarg3)
static global::System.IntPtr Solver_ComputeConstraintActivities(global::System.Runtime.InteropServices.HandleRef jarg1)
Variable MakeNumVar(double lb, double ub, string name)
Definition: Solver.cs:84
static void delete_Solver(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_variables(global::System.Runtime.InteropServices.HandleRef jarg1)
Variable LookupVariableOrNull(string var_name)
Definition: Solver.cs:70
Constraint MakeConstraint(double lb, double ub, string name)
Definition: Solver.cs:134
Constraint MakeConstraint(double lb, double ub)
Definition: Solver.cs:122
Variable MakeVar(double lb, double ub, bool integer, string name)
Definition: Solver.cs:77
static bool Solver_SetSolverSpecificParametersAsString(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
static global::System.IntPtr Solver_MakeConstraint__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
static int Solver_Solve__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static long Solver_WallTime(global::System.Runtime.InteropServices.HandleRef jarg1)
static double Solver_ComputeExactConditionNumber(global::System.Runtime.InteropServices.HandleRef jarg1)
MPConstraintVector constraints()
Definition: Solver.cs:110
static void Solver_EnableOutput(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_MakeVar(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, bool jarg4, string jarg5)
virtual void Dispose(bool disposing)
Definition: Solver.cs:35
Constraint LookupConstraintOrNull(string constraint_name)
Definition: Solver.cs:115
Variable MakeIntVar(double lb, double ub, string name)
Definition: Solver.cs:91
string ExportModelAsLpFormat(bool obfuscated)
Definition: Solver.cs:229
Solver.ResultStatus Solve(MPSolverParameters param)
Definition: Solver.cs:159
static string Solver_ExportModelAsLpFormat(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2)
static global::System.IntPtr Solver_LookupConstraintOrNull(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
static int Solver_NumConstraints(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_MakeBoolVar(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
static string Solver_ExportModelAsMpsFormat(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2, bool jarg3)
MPVariableVector variables()
Definition: Solver.cs:65
static void Solver_SuppressOutput(global::System.Runtime.InteropServices.HandleRef jarg1)
Constraint MakeConstraint(string name)
Definition: Solver.cs:141
bool SetNumThreads(int num_theads)
Definition: Solver.cs:244
static global::System.IntPtr Solver_MakeConstraint__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3)
Variable MakeBoolVar(string name)
Definition: Solver.cs:98
static global::System.IntPtr Solver_MakeIntVar(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, string jarg4)
static long Solver_Iterations(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Solver_MakeConstraint__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, double jarg3, string jarg4)
static void Solver_Reset(global::System.Runtime.InteropServices.HandleRef jarg1)
static void Solver_SetTimeLimit(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static global::System.IntPtr Solver_Objective(global::System.Runtime.InteropServices.HandleRef jarg1)
double [] ComputeConstraintActivities()
Definition: Solver.cs:165
static bool Solver_SetNumThreads(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static global::System.IntPtr Solver_constraints(global::System.Runtime.InteropServices.HandleRef jarg1)
string ExportModelAsMpsFormat(bool fixed_format, bool obfuscated)
Definition: Solver.cs:234
Solver(string name, Solver.OptimizationProblemType problem_type)
Definition: Solver.cs:47
static void Solver_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool Solver_VerifySolution(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2, bool jarg3)
bool SetSolverSpecificParametersAsString(string parameters)
Definition: Solver.cs:191
void SetHint(MPVariableVector variables, double[] values)
Definition: Solver.cs:239
static global::System.IntPtr Solver_LookupVariableOrNull(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
void SetTimeLimit(long time_limit_milliseconds)
Definition: Solver.cs:220