From 8982bcac1b9cf4b7a7bc2cb3a80fbe218ec387c1 Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Mon, 15 Jul 2019 15:36:07 -0700 Subject: [PATCH] improve java linearsolver + doc --- docs/java.tag | 21 +- docs/java/MPConstraint_8java_source.html | 14 +- docs/java/MPSolver_8java_source.html | 147 +++--- docs/java/MPVariable_8java_source.html | 8 +- ...tools_1_1linearsolver_1_1MPConstraint.html | 11 +- ...s_1_1linearsolver_1_1MPSolver-members.html | 77 ++- ..._1ortools_1_1linearsolver_1_1MPSolver.html | 231 ++++----- ...ortools_1_1linearsolver_1_1MPVariable.html | 8 +- ...nearsolver_1_1MPSolver_1_1BasisStatus.html | 16 +- ..._1MPSolver_1_1OptimizationProblemType.html | 14 +- ...earsolver_1_1MPSolver_1_1ResultStatus.html | 18 +- docs/java/functions_func_l.html | 4 +- docs/java/functions_l.html | 2 +- ortools/linear_solver/java/linear_solver.i | 95 +++- ortools/linear_solver/linear_solver.h | 447 +++++++++--------- 15 files changed, 579 insertions(+), 534 deletions(-) diff --git a/docs/java.tag b/docs/java.tag index 412458f223..c5a75c454b 100644 --- a/docs/java.tag +++ b/docs/java.tag @@ -30254,20 +30254,6 @@ a336148f74465d5c49970c59b6fb9a49b () - - SWIGTYPE_p_util__Status - loadSolutionFromProto - classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver.html - aa816cab0e1d166d7f51264eb39ba5f5b - (com.google.ortools.linearsolver.MPSolutionResponse response, double tolerance) - - - SWIGTYPE_p_util__Status - loadSolutionFromProto - classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver.html - aeea0da9d16ab53de4d9b02aaa205df96 - (com.google.ortools.linearsolver.MPSolutionResponse response) - boolean setSolverSpecificParametersAsString @@ -30352,6 +30338,13 @@ a0cfeb3d424b1823acedc91eaebb3fc60 () + + boolean + loadSolutionFromProto + classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver.html + a496bf7a8ed6ecae40620c15f702c0291 + (com.google.ortools.linearsolver.MPSolutionResponse response) + String exportModelAsLpFormat diff --git a/docs/java/MPConstraint_8java_source.html b/docs/java/MPConstraint_8java_source.html index 726fcec44b..fcc8f9c253 100644 --- a/docs/java/MPConstraint_8java_source.html +++ b/docs/java/MPConstraint_8java_source.html @@ -41,25 +41,25 @@
MPConstraint.java
-Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.0
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.linearsolver;
10 
11 import java.lang.reflect.*;
12 
18 public class MPConstraint {
19  private transient long swigCPtr;
20  protected transient boolean swigCMemOwn;
21 
22  protected MPConstraint(long cPtr, boolean cMemoryOwn) {
23  swigCMemOwn = cMemoryOwn;
24  swigCPtr = cPtr;
25  }
26 
27  protected static long getCPtr(MPConstraint obj) {
28  return (obj == null) ? 0 : obj.swigCPtr;
29  }
30 
31  @SuppressWarnings("deprecation")
32  protected void finalize() {
33  delete();
34  }
35 
36  public synchronized void delete() {
37  if (swigCPtr != 0) {
38  if (swigCMemOwn) {
39  swigCMemOwn = false;
40  main_research_linear_solverJNI.delete_MPConstraint(swigCPtr);
41  }
42  swigCPtr = 0;
43  }
44  }
45 
49  public String name() {
50  return main_research_linear_solverJNI.MPConstraint_name(swigCPtr, this);
51  }
52 
59  public void setCoefficient(MPVariable var, double coeff) {
60  main_research_linear_solverJNI.MPConstraint_setCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var, coeff);
61  }
62 
67  public double getCoefficient(MPVariable var) {
68  return main_research_linear_solverJNI.MPConstraint_getCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var);
69  }
70 
74  public double lb() {
75  return main_research_linear_solverJNI.MPConstraint_lb(swigCPtr, this);
76  }
77 
81  public double ub() {
82  return main_research_linear_solverJNI.MPConstraint_ub(swigCPtr, this);
83  }
84 
88  public void setLb(double lb) {
89  main_research_linear_solverJNI.MPConstraint_setLb(swigCPtr, this, lb);
90  }
91 
95  public void setUb(double ub) {
96  main_research_linear_solverJNI.MPConstraint_setUb(swigCPtr, this, ub);
97  }
98 
102  public void setBounds(double lb, double ub) {
103  main_research_linear_solverJNI.MPConstraint_setBounds(swigCPtr, this, lb, ub);
104  }
105 
109  public boolean isLazy() {
110  return main_research_linear_solverJNI.MPConstraint_isLazy(swigCPtr, this);
111  }
112 
125  public void setIsLazy(boolean laziness) {
126  main_research_linear_solverJNI.MPConstraint_setIsLazy(swigCPtr, this, laziness);
127  }
128 
132  public int index() {
133  return main_research_linear_solverJNI.MPConstraint_index(swigCPtr, this);
134  }
135 
140  public double dualValue() {
141  return main_research_linear_solverJNI.MPConstraint_dualValue(swigCPtr, this);
142  }
143 
157  return MPSolver.BasisStatus.swigToEnum(main_research_linear_solverJNI.MPConstraint_basisStatus(swigCPtr, this));
158  }
159 
160 }
String name()
Returns the name of the constraint.
+Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.0
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.linearsolver;
10 
11 import java.lang.reflect.*;
12 
18 public class MPConstraint {
19  private transient long swigCPtr;
20  protected transient boolean swigCMemOwn;
21 
22  protected MPConstraint(long cPtr, boolean cMemoryOwn) {
23  swigCMemOwn = cMemoryOwn;
24  swigCPtr = cPtr;
25  }
26 
27  protected static long getCPtr(MPConstraint obj) {
28  return (obj == null) ? 0 : obj.swigCPtr;
29  }
30 
31  @SuppressWarnings("deprecation")
32  protected void finalize() {
33  delete();
34  }
35 
36  public synchronized void delete() {
37  if (swigCPtr != 0) {
38  if (swigCMemOwn) {
39  swigCMemOwn = false;
40  main_research_linear_solverJNI.delete_MPConstraint(swigCPtr);
41  }
42  swigCPtr = 0;
43  }
44  }
45 
49  public String name() {
50  return main_research_linear_solverJNI.MPConstraint_name(swigCPtr, this);
51  }
52 
59  public void setCoefficient(MPVariable var, double coeff) {
60  main_research_linear_solverJNI.MPConstraint_setCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var, coeff);
61  }
62 
67  public double getCoefficient(MPVariable var) {
68  return main_research_linear_solverJNI.MPConstraint_getCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var);
69  }
70 
74  public double lb() {
75  return main_research_linear_solverJNI.MPConstraint_lb(swigCPtr, this);
76  }
77 
81  public double ub() {
82  return main_research_linear_solverJNI.MPConstraint_ub(swigCPtr, this);
83  }
84 
88  public void setLb(double lb) {
89  main_research_linear_solverJNI.MPConstraint_setLb(swigCPtr, this, lb);
90  }
91 
95  public void setUb(double ub) {
96  main_research_linear_solverJNI.MPConstraint_setUb(swigCPtr, this, ub);
97  }
98 
102  public void setBounds(double lb, double ub) {
103  main_research_linear_solverJNI.MPConstraint_setBounds(swigCPtr, this, lb, ub);
104  }
105 
109  public boolean isLazy() {
110  return main_research_linear_solverJNI.MPConstraint_isLazy(swigCPtr, this);
111  }
112 
126  public void setIsLazy(boolean laziness) {
127  main_research_linear_solverJNI.MPConstraint_setIsLazy(swigCPtr, this, laziness);
128  }
129 
133  public int index() {
134  return main_research_linear_solverJNI.MPConstraint_index(swigCPtr, this);
135  }
136 
141  public double dualValue() {
142  return main_research_linear_solverJNI.MPConstraint_dualValue(swigCPtr, this);
143  }
144 
158  return MPSolver.BasisStatus.swigToEnum(main_research_linear_solverJNI.MPConstraint_basisStatus(swigCPtr, this));
159  }
160 
161 }
String name()
Returns the name of the constraint.
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
MPConstraint(long cPtr, boolean cMemoryOwn)
-
int index()
Returns the index of the constraint in the MPSolver::constraints_.
+
int index()
Returns the index of the constraint in the MPSolver::constraints_.
The class for constraints of a Mathematical Programming (MP) model.
-
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:697
+
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:703
void setBounds(double lb, double ub)
Sets both the lower and upper bounds.
void setUb(double ub)
Sets the upper bound.
-
void setIsLazy(boolean laziness)
Advanced usage: sets the constraint "laziness".
+
void setIsLazy(boolean laziness)
Advanced usage: sets the constraint "laziness".
This mathematical programming (MP) solver class is the main class though which users build and solve...
Definition: MPSolver.java:17
-
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:686
+
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:692
double lb()
Returns the lower bound.
-
double dualValue()
Advanced usage: returns the dual value of the constraint in the current solution (only available for...
+
double dualValue()
Advanced usage: returns the dual value of the constraint in the current solution (only available for...
double ub()
Returns the upper bound.
boolean isLazy()
Advanced usage: returns true if the constraint is "lazy" (see below).
void setCoefficient(MPVariable var, double coeff)
Sets the coefficient of the variable on the constraint.
double getCoefficient(MPVariable var)
Gets the coefficient of a given variable on the constraint (which is 0 if the variable does not appe...
void setLb(double lb)
Sets the lower bound.
-
MPSolver.BasisStatus basisStatus()
Advanced usage: returns the basis status of the constraint.
+
MPSolver.BasisStatus basisStatus()
Advanced usage: returns the basis status of the constraint.
-Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.0
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.linearsolver;
10 
11 import java.lang.reflect.*;
12 
17 public class MPSolver {
18  private transient long swigCPtr;
19  protected transient boolean swigCMemOwn;
20 
21  protected MPSolver(long cPtr, boolean cMemoryOwn) {
22  swigCMemOwn = cMemoryOwn;
23  swigCPtr = cPtr;
24  }
25 
26  protected static long getCPtr(MPSolver obj) {
27  return (obj == null) ? 0 : obj.swigCPtr;
28  }
29 
30  @SuppressWarnings("deprecation")
31  protected void finalize() {
32  delete();
33  }
34 
35  public synchronized void delete() {
36  if (swigCPtr != 0) {
37  if (swigCMemOwn) {
38  swigCMemOwn = false;
39  main_research_linear_solverJNI.delete_MPSolver(swigCPtr);
40  }
41  swigCPtr = 0;
42  }
43  }
44 
45  public MPVariable[] makeVarArray(int count, double lb, double ub, boolean integer) {
46  MPVariable[] array = new MPVariable[count];
47  for (int i = 0; i < count; ++i) {
48  array[i] = makeVar(lb, ub, integer, "");
49  }
50  return array;
51  }
52 
53  public MPVariable[] makeVarArray(int count, double lb, double ub, boolean integer,
54  String var_name) {
55  MPVariable[] array = new MPVariable[count];
56  for (int i = 0; i < count; ++i) {
57  array[i] = makeVar(lb, ub, integer, var_name + i);
58  }
59  return array;
60  }
61 
62  public MPVariable[] makeNumVarArray(int count, double lb, double ub) {
63  return makeVarArray(count, lb, ub, false);
64  }
65 
66  public MPVariable[] makeNumVarArray(int count, double lb, double ub, String var_name) {
67  return makeVarArray(count, lb, ub, false, var_name);
68  }
69 
70  public MPVariable[] makeIntVarArray(int count, double lb, double ub) {
71  return makeVarArray(count, lb, ub, true);
72  }
73 
74  public MPVariable[] makeIntVarArray(int count, double lb, double ub, String var_name) {
75  return makeVarArray(count, lb, ub, true, var_name);
76  }
77 
78  public MPVariable[] makeBoolVarArray(int count) {
79  return makeVarArray(count, 0.0, 1.0, true);
80  }
81 
82  public MPVariable[] makeBoolVarArray(int count, String var_name) {
83  return makeVarArray(count, 0.0, 1.0, true, var_name);
84  }
85 
89  public MPSolver(String name, MPSolver.OptimizationProblemType problem_type) {
90  this(main_research_linear_solverJNI.new_MPSolver(name, problem_type.swigValue()), true);
91  }
92 
97  public static boolean supportsProblemType(MPSolver.OptimizationProblemType problem_type) {
98  return main_research_linear_solverJNI.MPSolver_supportsProblemType(problem_type.swigValue());
99  }
100 
106  public void clear() {
107  main_research_linear_solverJNI.MPSolver_clear(swigCPtr, this);
108  }
109 
113  public int numVariables() {
114  return main_research_linear_solverJNI.MPSolver_numVariables(swigCPtr, this);
115  }
116 
121  public MPVariable[] variables() {
122  return main_research_linear_solverJNI.MPSolver_variables(swigCPtr, this);
123 }
124 
130  public MPVariable lookupVariableOrNull(String var_name) {
131  long cPtr = main_research_linear_solverJNI.MPSolver_lookupVariableOrNull(swigCPtr, this, var_name);
132  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
133  }
134 
142  public MPVariable makeVar(double lb, double ub, boolean integer, String name) {
143  long cPtr = main_research_linear_solverJNI.MPSolver_makeVar(swigCPtr, this, lb, ub, integer, name);
144  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
145  }
146 
150  public MPVariable makeNumVar(double lb, double ub, String name) {
151  long cPtr = main_research_linear_solverJNI.MPSolver_makeNumVar(swigCPtr, this, lb, ub, name);
152  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
153  }
154 
158  public MPVariable makeIntVar(double lb, double ub, String name) {
159  long cPtr = main_research_linear_solverJNI.MPSolver_makeIntVar(swigCPtr, this, lb, ub, name);
160  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
161  }
162 
166  public MPVariable makeBoolVar(String name) {
167  long cPtr = main_research_linear_solverJNI.MPSolver_makeBoolVar(swigCPtr, this, name);
168  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
169  }
170 
174  public int numConstraints() {
175  return main_research_linear_solverJNI.MPSolver_numConstraints(swigCPtr, this);
176  }
177 
184  return main_research_linear_solverJNI.MPSolver_constraints(swigCPtr, this);
185 }
186 
194  public MPConstraint lookupConstraintOrNull(String constraint_name) {
195  long cPtr = main_research_linear_solverJNI.MPSolver_lookupConstraintOrNull(swigCPtr, this, constraint_name);
196  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
197  }
198 
207  public MPConstraint makeConstraint(double lb, double ub) {
208  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_0(swigCPtr, this, lb, ub);
209  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
210  }
211 
216  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_1(swigCPtr, this);
217  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
218  }
219 
223  public MPConstraint makeConstraint(double lb, double ub, String name) {
224  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_2(swigCPtr, this, lb, ub, name);
225  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
226  }
227 
231  public MPConstraint makeConstraint(String name) {
232  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_3(swigCPtr, this, name);
233  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
234  }
235 
240  long cPtr = main_research_linear_solverJNI.MPSolver_objective(swigCPtr, this);
241  return (cPtr == 0) ? null : new MPObjective(cPtr, false);
242  }
243 
248  return MPSolver.ResultStatus.swigToEnum(main_research_linear_solverJNI.MPSolver_solve__SWIG_0(swigCPtr, this));
249  }
250 
255  return MPSolver.ResultStatus.swigToEnum(main_research_linear_solverJNI.MPSolver_solve__SWIG_1(swigCPtr, this, MPSolverParameters.getCPtr(param), param));
256  }
257 
264  public double[] computeConstraintActivities() {
265  return main_research_linear_solverJNI.MPSolver_computeConstraintActivities(swigCPtr, this);
266 }
267 
286  public boolean verifySolution(double tolerance, boolean log_errors) {
287  return main_research_linear_solverJNI.MPSolver_verifySolution(swigCPtr, this, tolerance, log_errors);
288  }
289 
298  public void reset() {
299  main_research_linear_solverJNI.MPSolver_reset(swigCPtr, this);
300  }
301 
310  public boolean interruptSolve() {
311  return main_research_linear_solverJNI.MPSolver_interruptSolve(swigCPtr, this);
312  }
313 
345  public SWIGTYPE_p_util__Status loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response, double tolerance) {
346  return new SWIGTYPE_p_util__Status(main_research_linear_solverJNI.MPSolver_loadSolutionFromProto__SWIG_0(swigCPtr, this, response.toByteArray(), tolerance), true);
347  }
348 
380  public SWIGTYPE_p_util__Status loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response) {
381  return new SWIGTYPE_p_util__Status(main_research_linear_solverJNI.MPSolver_loadSolutionFromProto__SWIG_1(swigCPtr, this, response.toByteArray()), true);
382  }
383 
394  public boolean setSolverSpecificParametersAsString(String parameters) {
395  return main_research_linear_solverJNI.MPSolver_setSolverSpecificParametersAsString(swigCPtr, this, parameters);
396  }
397 
403  public static double infinity() {
404  return main_research_linear_solverJNI.MPSolver_infinity();
405  }
406 
410  public void enableOutput() {
411  main_research_linear_solverJNI.MPSolver_enableOutput(swigCPtr, this);
412  }
413 
417  public void suppressOutput() {
418  main_research_linear_solverJNI.MPSolver_suppressOutput(swigCPtr, this);
419  }
420 
424  public long iterations() {
425  return main_research_linear_solverJNI.MPSolver_iterations(swigCPtr, this);
426  }
427 
433  public long nodes() {
434  return main_research_linear_solverJNI.MPSolver_nodes(swigCPtr, this);
435  }
436 
461  public double computeExactConditionNumber() {
462  return main_research_linear_solverJNI.MPSolver_computeExactConditionNumber(swigCPtr, this);
463  }
464 
465  public void setTimeLimit(long time_limit_milliseconds) {
466  main_research_linear_solverJNI.MPSolver_setTimeLimit(swigCPtr, this, time_limit_milliseconds);
467  }
468 
469  public long wallTime() {
470  return main_research_linear_solverJNI.MPSolver_wallTime(swigCPtr, this);
471  }
472 
474  return main_research_linear_solverJNI.MPSolver_loadModelFromProto(swigCPtr, this, input_model.toByteArray());
475  }
476 
478  return main_research_linear_solverJNI.MPSolver_loadModelFromProtoWithUniqueNamesOrDie(swigCPtr, this, input_model.toByteArray());
479  }
480 
482  byte[] buf = main_research_linear_solverJNI.MPSolver_exportModelToProto(swigCPtr, this);
483  if (buf == null || buf.length == 0) {
484  return null;
485  }
486  try {
488  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
489  throw new RuntimeException(
490  "Unable to parse com.google.ortools.linearsolver.MPModelProto protocol message.");
491  }
492 }
493 
495  byte[] buf = main_research_linear_solverJNI.MPSolver_createSolutionResponseProto(swigCPtr, this);
496  if (buf == null || buf.length == 0) {
497  return null;
498  }
499  try {
501  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
502  throw new RuntimeException(
503  "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
504  }
505 }
506 
508  byte[] buf = main_research_linear_solverJNI.MPSolver_solveWithProto(model_request.toByteArray());
509  if (buf == null || buf.length == 0) {
510  return null;
511  }
512  try {
514  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
515  throw new RuntimeException(
516  "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
517  }
518 }
519 
521  return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_0(swigCPtr, this, MPModelExportOptions.getCPtr(options), options);
522  }
523 
524  public String exportModelAsLpFormat() {
525  return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_1(swigCPtr, this);
526  }
527 
529  return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_0(swigCPtr, this, MPModelExportOptions.getCPtr(options), options);
530  }
531 
532  public String exportModelAsMpsFormat() {
533  return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_1(swigCPtr, this);
534  }
535 
539  public void setHint(MPVariable[] variables, double[] values) {
540  main_research_linear_solverJNI.MPSolver_setHint(swigCPtr, this, variables, values);
541  }
542 
546  public boolean setNumThreads(int num_theads) {
547  return main_research_linear_solverJNI.MPSolver_setNumThreads(swigCPtr, this, num_theads);
548  }
549 
560  CLP_LINEAR_PROGRAMMING(main_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get()),
564  GLOP_LINEAR_PROGRAMMING(main_research_linear_solverJNI.MPSolver_GLOP_LINEAR_PROGRAMMING_get()),
568  CBC_MIXED_INTEGER_PROGRAMMING(main_research_linear_solverJNI.MPSolver_CBC_MIXED_INTEGER_PROGRAMMING_get()),
572  BOP_INTEGER_PROGRAMMING(main_research_linear_solverJNI.MPSolver_BOP_INTEGER_PROGRAMMING_get());
573 
574  public final int swigValue() {
575  return swigValue;
576  }
577 
578  public static OptimizationProblemType swigToEnum(int swigValue) {
579  OptimizationProblemType[] swigValues = OptimizationProblemType.class.getEnumConstants();
580  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
581  return swigValues[swigValue];
582  for (OptimizationProblemType swigEnum : swigValues)
583  if (swigEnum.swigValue == swigValue)
584  return swigEnum;
585  throw new IllegalArgumentException("No enum " + OptimizationProblemType.class + " with value " + swigValue);
586  }
587 
588  @SuppressWarnings("unused")
589  private OptimizationProblemType() {
590  this.swigValue = SwigNext.next++;
591  }
592 
593  @SuppressWarnings("unused")
594  private OptimizationProblemType(int swigValue) {
595  this.swigValue = swigValue;
596  SwigNext.next = swigValue+1;
597  }
598 
599  @SuppressWarnings("unused")
600  private OptimizationProblemType(OptimizationProblemType swigEnum) {
601  this.swigValue = swigEnum.swigValue;
602  SwigNext.next = this.swigValue+1;
603  }
604 
605  private final int swigValue;
606 
607  private static class SwigNext {
608  private static int next = 0;
609  }
610  }
611 
618  public enum ResultStatus {
642  NOT_SOLVED(main_research_linear_solverJNI.MPSolver_NOT_SOLVED_get());
643 
644  public final int swigValue() {
645  return swigValue;
646  }
647 
648  public static ResultStatus swigToEnum(int swigValue) {
649  ResultStatus[] swigValues = ResultStatus.class.getEnumConstants();
650  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
651  return swigValues[swigValue];
652  for (ResultStatus swigEnum : swigValues)
653  if (swigEnum.swigValue == swigValue)
654  return swigEnum;
655  throw new IllegalArgumentException("No enum " + ResultStatus.class + " with value " + swigValue);
656  }
657 
658  @SuppressWarnings("unused")
659  private ResultStatus() {
660  this.swigValue = SwigNext.next++;
661  }
662 
663  @SuppressWarnings("unused")
664  private ResultStatus(int swigValue) {
665  this.swigValue = swigValue;
666  SwigNext.next = swigValue+1;
667  }
668 
669  @SuppressWarnings("unused")
670  private ResultStatus(ResultStatus swigEnum) {
671  this.swigValue = swigEnum.swigValue;
672  SwigNext.next = this.swigValue+1;
673  }
674 
675  private final int swigValue;
676 
677  private static class SwigNext {
678  private static int next = 0;
679  }
680  }
681 
686  public enum BasisStatus {
687  FREE(main_research_linear_solverJNI.MPSolver_FREE_get()),
688  AT_LOWER_BOUND,
689  AT_UPPER_BOUND,
690  FIXED_VALUE,
691  BASIC;
692 
693  public final int swigValue() {
694  return swigValue;
695  }
696 
697  public static BasisStatus swigToEnum(int swigValue) {
698  BasisStatus[] swigValues = BasisStatus.class.getEnumConstants();
699  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
700  return swigValues[swigValue];
701  for (BasisStatus swigEnum : swigValues)
702  if (swigEnum.swigValue == swigValue)
703  return swigEnum;
704  throw new IllegalArgumentException("No enum " + BasisStatus.class + " with value " + swigValue);
705  }
706 
707  @SuppressWarnings("unused")
708  private BasisStatus() {
709  this.swigValue = SwigNext.next++;
710  }
711 
712  @SuppressWarnings("unused")
713  private BasisStatus(int swigValue) {
714  this.swigValue = swigValue;
715  SwigNext.next = swigValue+1;
716  }
717 
718  @SuppressWarnings("unused")
719  private BasisStatus(BasisStatus swigEnum) {
720  this.swigValue = swigEnum.swigValue;
721  SwigNext.next = this.swigValue+1;
722  }
723 
724  private final int swigValue;
725 
726  private static class SwigNext {
727  private static int next = 0;
728  }
729  }
730 
731 }
- -
com.google.ortools.linearsolver.MPSolutionResponse createSolutionResponseProto()
Definition: MPSolver.java:494
-
CBC_MIXED_INTEGER_PROGRAMMING
Mixed integer Programming Solver using Coin CBC.
Definition: MPSolver.java:568
-
com.google.ortools.linearsolver.MPModelProto exportModelToProto()
Definition: MPSolver.java:481
+Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.0
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.linearsolver;
10 
11 import java.lang.reflect.*;
12 
17 public class MPSolver {
18  private transient long swigCPtr;
19  protected transient boolean swigCMemOwn;
20 
21  protected MPSolver(long cPtr, boolean cMemoryOwn) {
22  swigCMemOwn = cMemoryOwn;
23  swigCPtr = cPtr;
24  }
25 
26  protected static long getCPtr(MPSolver obj) {
27  return (obj == null) ? 0 : obj.swigCPtr;
28  }
29 
30  @SuppressWarnings("deprecation")
31  protected void finalize() {
32  delete();
33  }
34 
35  public synchronized void delete() {
36  if (swigCPtr != 0) {
37  if (swigCMemOwn) {
38  swigCMemOwn = false;
39  main_research_linear_solverJNI.delete_MPSolver(swigCPtr);
40  }
41  swigCPtr = 0;
42  }
43  }
44 
48  public MPVariable[] makeVarArray(int count, double lb, double ub, boolean integer) {
49  MPVariable[] array = new MPVariable[count];
50  for (int i = 0; i < count; ++i) {
51  array[i] = makeVar(lb, ub, integer, "");
52  }
53  return array;
54  }
55 
59  public MPVariable[] makeVarArray(int count, double lb, double ub, boolean integer,
60  String var_name) {
61  MPVariable[] array = new MPVariable[count];
62  for (int i = 0; i < count; ++i) {
63  array[i] = makeVar(lb, ub, integer, var_name + i);
64  }
65  return array;
66  }
67 
68  public MPVariable[] makeNumVarArray(int count, double lb, double ub) {
69  return makeVarArray(count, lb, ub, false);
70  }
71 
72  public MPVariable[] makeNumVarArray(int count, double lb, double ub, String var_name) {
73  return makeVarArray(count, lb, ub, false, var_name);
74  }
75 
76  public MPVariable[] makeIntVarArray(int count, double lb, double ub) {
77  return makeVarArray(count, lb, ub, true);
78  }
79 
80  public MPVariable[] makeIntVarArray(int count, double lb, double ub, String var_name) {
81  return makeVarArray(count, lb, ub, true, var_name);
82  }
83 
84  public MPVariable[] makeBoolVarArray(int count) {
85  return makeVarArray(count, 0.0, 1.0, true);
86  }
87 
88  public MPVariable[] makeBoolVarArray(int count, String var_name) {
89  return makeVarArray(count, 0.0, 1.0, true, var_name);
90  }
91 
95  public MPSolver(String name, MPSolver.OptimizationProblemType problem_type) {
96  this(main_research_linear_solverJNI.new_MPSolver(name, problem_type.swigValue()), true);
97  }
98 
103  public static boolean supportsProblemType(MPSolver.OptimizationProblemType problem_type) {
104  return main_research_linear_solverJNI.MPSolver_supportsProblemType(problem_type.swigValue());
105  }
106 
112  public void clear() {
113  main_research_linear_solverJNI.MPSolver_clear(swigCPtr, this);
114  }
115 
119  public int numVariables() {
120  return main_research_linear_solverJNI.MPSolver_numVariables(swigCPtr, this);
121  }
122 
127  public MPVariable[] variables() {
128  return main_research_linear_solverJNI.MPSolver_variables(swigCPtr, this);
129 }
130 
136  public MPVariable lookupVariableOrNull(String var_name) {
137  long cPtr = main_research_linear_solverJNI.MPSolver_lookupVariableOrNull(swigCPtr, this, var_name);
138  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
139  }
140 
148  public MPVariable makeVar(double lb, double ub, boolean integer, String name) {
149  long cPtr = main_research_linear_solverJNI.MPSolver_makeVar(swigCPtr, this, lb, ub, integer, name);
150  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
151  }
152 
156  public MPVariable makeNumVar(double lb, double ub, String name) {
157  long cPtr = main_research_linear_solverJNI.MPSolver_makeNumVar(swigCPtr, this, lb, ub, name);
158  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
159  }
160 
164  public MPVariable makeIntVar(double lb, double ub, String name) {
165  long cPtr = main_research_linear_solverJNI.MPSolver_makeIntVar(swigCPtr, this, lb, ub, name);
166  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
167  }
168 
172  public MPVariable makeBoolVar(String name) {
173  long cPtr = main_research_linear_solverJNI.MPSolver_makeBoolVar(swigCPtr, this, name);
174  return (cPtr == 0) ? null : new MPVariable(cPtr, false);
175  }
176 
180  public int numConstraints() {
181  return main_research_linear_solverJNI.MPSolver_numConstraints(swigCPtr, this);
182  }
183 
190  return main_research_linear_solverJNI.MPSolver_constraints(swigCPtr, this);
191 }
192 
200  public MPConstraint lookupConstraintOrNull(String constraint_name) {
201  long cPtr = main_research_linear_solverJNI.MPSolver_lookupConstraintOrNull(swigCPtr, this, constraint_name);
202  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
203  }
204 
213  public MPConstraint makeConstraint(double lb, double ub) {
214  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_0(swigCPtr, this, lb, ub);
215  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
216  }
217 
222  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_1(swigCPtr, this);
223  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
224  }
225 
229  public MPConstraint makeConstraint(double lb, double ub, String name) {
230  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_2(swigCPtr, this, lb, ub, name);
231  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
232  }
233 
237  public MPConstraint makeConstraint(String name) {
238  long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_3(swigCPtr, this, name);
239  return (cPtr == 0) ? null : new MPConstraint(cPtr, false);
240  }
241 
246  long cPtr = main_research_linear_solverJNI.MPSolver_objective(swigCPtr, this);
247  return (cPtr == 0) ? null : new MPObjective(cPtr, false);
248  }
249 
254  return MPSolver.ResultStatus.swigToEnum(main_research_linear_solverJNI.MPSolver_solve__SWIG_0(swigCPtr, this));
255  }
256 
261  return MPSolver.ResultStatus.swigToEnum(main_research_linear_solverJNI.MPSolver_solve__SWIG_1(swigCPtr, this, MPSolverParameters.getCPtr(param), param));
262  }
263 
270  public double[] computeConstraintActivities() {
271  return main_research_linear_solverJNI.MPSolver_computeConstraintActivities(swigCPtr, this);
272 }
273 
292  public boolean verifySolution(double tolerance, boolean log_errors) {
293  return main_research_linear_solverJNI.MPSolver_verifySolution(swigCPtr, this, tolerance, log_errors);
294  }
295 
304  public void reset() {
305  main_research_linear_solverJNI.MPSolver_reset(swigCPtr, this);
306  }
307 
316  public boolean interruptSolve() {
317  return main_research_linear_solverJNI.MPSolver_interruptSolve(swigCPtr, this);
318  }
319 
330  public boolean setSolverSpecificParametersAsString(String parameters) {
331  return main_research_linear_solverJNI.MPSolver_setSolverSpecificParametersAsString(swigCPtr, this, parameters);
332  }
333 
339  public static double infinity() {
340  return main_research_linear_solverJNI.MPSolver_infinity();
341  }
342 
346  public void enableOutput() {
347  main_research_linear_solverJNI.MPSolver_enableOutput(swigCPtr, this);
348  }
349 
353  public void suppressOutput() {
354  main_research_linear_solverJNI.MPSolver_suppressOutput(swigCPtr, this);
355  }
356 
360  public long iterations() {
361  return main_research_linear_solverJNI.MPSolver_iterations(swigCPtr, this);
362  }
363 
369  public long nodes() {
370  return main_research_linear_solverJNI.MPSolver_nodes(swigCPtr, this);
371  }
372 
397  public double computeExactConditionNumber() {
398  return main_research_linear_solverJNI.MPSolver_computeExactConditionNumber(swigCPtr, this);
399  }
400 
401  public void setTimeLimit(long time_limit_milliseconds) {
402  main_research_linear_solverJNI.MPSolver_setTimeLimit(swigCPtr, this, time_limit_milliseconds);
403  }
404 
405  public long wallTime() {
406  return main_research_linear_solverJNI.MPSolver_wallTime(swigCPtr, this);
407  }
408 
414  return main_research_linear_solverJNI.MPSolver_loadModelFromProto(swigCPtr, this, input_model.toByteArray());
415  }
416 
418  return main_research_linear_solverJNI.MPSolver_loadModelFromProtoWithUniqueNamesOrDie(swigCPtr, this, input_model.toByteArray());
419  }
420 
425  byte[] buf = main_research_linear_solverJNI.MPSolver_exportModelToProto(swigCPtr, this);
426  if (buf == null || buf.length == 0) {
427  return null;
428  }
429  try {
431  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
432  throw new RuntimeException(
433  "Unable to parse com.google.ortools.linearsolver.MPModelProto protocol message.");
434  }
435 }
436 
441  byte[] buf = main_research_linear_solverJNI.MPSolver_createSolutionResponseProto(swigCPtr, this);
442  if (buf == null || buf.length == 0) {
443  return null;
444  }
445  try {
447  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
448  throw new RuntimeException(
449  "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
450  }
451 }
452 
485  return main_research_linear_solverJNI.MPSolver_loadSolutionFromProto(swigCPtr, this, response.toByteArray());
486  }
487 
492  byte[] buf = main_research_linear_solverJNI.MPSolver_solveWithProto(model_request.toByteArray());
493  if (buf == null || buf.length == 0) {
494  return null;
495  }
496  try {
498  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
499  throw new RuntimeException(
500  "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
501  }
502 }
503 
508  return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_0(swigCPtr, this, MPModelExportOptions.getCPtr(options), options);
509  }
510 
514  public String exportModelAsLpFormat() {
515  return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_1(swigCPtr, this);
516  }
517 
522  return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_0(swigCPtr, this, MPModelExportOptions.getCPtr(options), options);
523  }
524 
528  public String exportModelAsMpsFormat() {
529  return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_1(swigCPtr, this);
530  }
531 
545  public void setHint(MPVariable[] variables, double[] values) {
546  main_research_linear_solverJNI.MPSolver_setHint(swigCPtr, this, variables, values);
547  }
548 
552  public boolean setNumThreads(int num_theads) {
553  return main_research_linear_solverJNI.MPSolver_setNumThreads(swigCPtr, this, num_theads);
554  }
555 
566  CLP_LINEAR_PROGRAMMING(main_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get()),
570  GLOP_LINEAR_PROGRAMMING(main_research_linear_solverJNI.MPSolver_GLOP_LINEAR_PROGRAMMING_get()),
574  CBC_MIXED_INTEGER_PROGRAMMING(main_research_linear_solverJNI.MPSolver_CBC_MIXED_INTEGER_PROGRAMMING_get()),
578  BOP_INTEGER_PROGRAMMING(main_research_linear_solverJNI.MPSolver_BOP_INTEGER_PROGRAMMING_get());
579 
580  public final int swigValue() {
581  return swigValue;
582  }
583 
584  public static OptimizationProblemType swigToEnum(int swigValue) {
585  OptimizationProblemType[] swigValues = OptimizationProblemType.class.getEnumConstants();
586  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
587  return swigValues[swigValue];
588  for (OptimizationProblemType swigEnum : swigValues)
589  if (swigEnum.swigValue == swigValue)
590  return swigEnum;
591  throw new IllegalArgumentException("No enum " + OptimizationProblemType.class + " with value " + swigValue);
592  }
593 
594  @SuppressWarnings("unused")
595  private OptimizationProblemType() {
596  this.swigValue = SwigNext.next++;
597  }
598 
599  @SuppressWarnings("unused")
600  private OptimizationProblemType(int swigValue) {
601  this.swigValue = swigValue;
602  SwigNext.next = swigValue+1;
603  }
604 
605  @SuppressWarnings("unused")
606  private OptimizationProblemType(OptimizationProblemType swigEnum) {
607  this.swigValue = swigEnum.swigValue;
608  SwigNext.next = this.swigValue+1;
609  }
610 
611  private final int swigValue;
612 
613  private static class SwigNext {
614  private static int next = 0;
615  }
616  }
617 
624  public enum ResultStatus {
648  NOT_SOLVED(main_research_linear_solverJNI.MPSolver_NOT_SOLVED_get());
649 
650  public final int swigValue() {
651  return swigValue;
652  }
653 
654  public static ResultStatus swigToEnum(int swigValue) {
655  ResultStatus[] swigValues = ResultStatus.class.getEnumConstants();
656  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
657  return swigValues[swigValue];
658  for (ResultStatus swigEnum : swigValues)
659  if (swigEnum.swigValue == swigValue)
660  return swigEnum;
661  throw new IllegalArgumentException("No enum " + ResultStatus.class + " with value " + swigValue);
662  }
663 
664  @SuppressWarnings("unused")
665  private ResultStatus() {
666  this.swigValue = SwigNext.next++;
667  }
668 
669  @SuppressWarnings("unused")
670  private ResultStatus(int swigValue) {
671  this.swigValue = swigValue;
672  SwigNext.next = swigValue+1;
673  }
674 
675  @SuppressWarnings("unused")
676  private ResultStatus(ResultStatus swigEnum) {
677  this.swigValue = swigEnum.swigValue;
678  SwigNext.next = this.swigValue+1;
679  }
680 
681  private final int swigValue;
682 
683  private static class SwigNext {
684  private static int next = 0;
685  }
686  }
687 
692  public enum BasisStatus {
693  FREE(main_research_linear_solverJNI.MPSolver_FREE_get()),
694  AT_LOWER_BOUND,
695  AT_UPPER_BOUND,
696  FIXED_VALUE,
697  BASIC;
698 
699  public final int swigValue() {
700  return swigValue;
701  }
702 
703  public static BasisStatus swigToEnum(int swigValue) {
704  BasisStatus[] swigValues = BasisStatus.class.getEnumConstants();
705  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
706  return swigValues[swigValue];
707  for (BasisStatus swigEnum : swigValues)
708  if (swigEnum.swigValue == swigValue)
709  return swigEnum;
710  throw new IllegalArgumentException("No enum " + BasisStatus.class + " with value " + swigValue);
711  }
712 
713  @SuppressWarnings("unused")
714  private BasisStatus() {
715  this.swigValue = SwigNext.next++;
716  }
717 
718  @SuppressWarnings("unused")
719  private BasisStatus(int swigValue) {
720  this.swigValue = swigValue;
721  SwigNext.next = swigValue+1;
722  }
723 
724  @SuppressWarnings("unused")
725  private BasisStatus(BasisStatus swigEnum) {
726  this.swigValue = swigEnum.swigValue;
727  SwigNext.next = this.swigValue+1;
728  }
729 
730  private final int swigValue;
731 
732  private static class SwigNext {
733  private static int next = 0;
734  }
735  }
736 
737 }
+ +
com.google.ortools.linearsolver.MPSolutionResponse createSolutionResponseProto()
Fills the solution found to a response proto and returns it.
Definition: MPSolver.java:440
+
CBC_MIXED_INTEGER_PROGRAMMING
Mixed integer Programming Solver using Coin CBC.
Definition: MPSolver.java:574
+
com.google.ortools.linearsolver.MPModelProto exportModelToProto()
Export the loaded model to proto and returns it.
Definition: MPSolver.java:424
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
static com.google.ortools.linearsolver.MPSolutionResponse parseFrom(java.nio.ByteBuffer data)
-
static double infinity()
Infinity.
Definition: MPSolver.java:403
-
MPVariable [] makeVarArray(int count, double lb, double ub, boolean integer, String var_name)
Definition: MPSolver.java:53
+
static double infinity()
Infinity.
Definition: MPSolver.java:339
+
MPVariable [] makeVarArray(int count, double lb, double ub, boolean integer, String var_name)
Creates and returns an array of named variables.
Definition: MPSolver.java:59
-
MPVariable [] makeNumVarArray(int count, double lb, double ub, String var_name)
Definition: MPSolver.java:66
-
boolean setNumThreads(int num_theads)
Sets the number of threads to be used by the solver.
Definition: MPSolver.java:546
-
boolean interruptSolve()
Interrupts the Solve() execution to terminate processing if possible.
Definition: MPSolver.java:310
-
MPVariable makeIntVar(double lb, double ub, String name)
Creates an integer variable.
Definition: MPSolver.java:158
-
String loadModelFromProtoWithUniqueNamesOrDie(com.google.ortools.linearsolver.MPModelProto input_model)
Definition: MPSolver.java:477
- -
void setHint(MPVariable[] variables, double[] values)
Sets a hint for solution.
Definition: MPSolver.java:539
-
MPConstraint makeConstraint(String name)
Creates a named constraint with -infinity and +infinity bounds.
Definition: MPSolver.java:231
- - -
MPConstraint makeConstraint(double lb, double ub, String name)
Creates a named constraint with given bounds.
Definition: MPSolver.java:223
-
void setTimeLimit(long time_limit_milliseconds)
Definition: MPSolver.java:465
-
MPVariable [] makeBoolVarArray(int count)
Definition: MPSolver.java:78
+
MPVariable [] makeNumVarArray(int count, double lb, double ub, String var_name)
Definition: MPSolver.java:72
+
boolean setNumThreads(int num_theads)
Sets the number of threads to be used by the solver.
Definition: MPSolver.java:552
+
boolean interruptSolve()
Interrupts the Solve() execution to terminate processing if possible.
Definition: MPSolver.java:316
+
MPVariable makeIntVar(double lb, double ub, String name)
Creates an integer variable.
Definition: MPSolver.java:164
+
String loadModelFromProtoWithUniqueNamesOrDie(com.google.ortools.linearsolver.MPModelProto input_model)
Definition: MPSolver.java:417
+ +
void setHint(MPVariable[] variables, double[] values)
Sets a hint for solution.
Definition: MPSolver.java:545
+
MPConstraint makeConstraint(String name)
Creates a named constraint with -infinity and +infinity bounds.
Definition: MPSolver.java:237
+ + +
MPConstraint makeConstraint(double lb, double ub, String name)
Creates a named constraint with given bounds.
Definition: MPSolver.java:229
+
void setTimeLimit(long time_limit_milliseconds)
Definition: MPSolver.java:401
+
MPVariable [] makeBoolVarArray(int count)
Definition: MPSolver.java:84
The class for constraints of a Mathematical Programming (MP) model.
- -
String exportModelAsLpFormat(MPModelExportOptions options)
Definition: MPSolver.java:520
-
static com.google.ortools.linearsolver.MPSolutionResponse solveWithProto(com.google.ortools.linearsolver.MPModelRequest model_request)
Definition: MPSolver.java:507
-
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:697
- - + +
String exportModelAsLpFormat(MPModelExportOptions options)
Export the loaded model in LP format.
Definition: MPSolver.java:507
+
static com.google.ortools.linearsolver.MPSolutionResponse solveWithProto(com.google.ortools.linearsolver.MPModelRequest model_request)
Solves the given model proto and returns a response proto.
Definition: MPSolver.java:491
+
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:703
+ + - -
MPConstraint [] constraints()
Returns the array of constraints handled by the MPSolver.
Definition: MPSolver.java:183
-
MPVariable [] makeIntVarArray(int count, double lb, double ub)
Definition: MPSolver.java:70
-
MPSolver.ResultStatus solve()
Solves the problem using default parameter values.
Definition: MPSolver.java:247
-
MPVariable [] makeVarArray(int count, double lb, double ub, boolean integer)
Definition: MPSolver.java:45
- -
int numConstraints()
Returns the number of constraints.
Definition: MPSolver.java:174
-
SWIGTYPE_p_util__Status loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response)
Load a solution encoded in a protocol buffer onto this solver for easy access via the MPSolver inter...
Definition: MPSolver.java:380
-
MPConstraint makeConstraint(double lb, double ub)
Creates a linear constraint with given bounds.
Definition: MPSolver.java:207
+ +
MPConstraint [] constraints()
Returns the array of constraints handled by the MPSolver.
Definition: MPSolver.java:189
+
MPVariable [] makeIntVarArray(int count, double lb, double ub)
Definition: MPSolver.java:76
+
MPSolver.ResultStatus solve()
Solves the problem using default parameter values.
Definition: MPSolver.java:253
+
MPVariable [] makeVarArray(int count, double lb, double ub, boolean integer)
Creates and returns an array of variables.
Definition: MPSolver.java:48
+ +
int numConstraints()
Returns the number of constraints.
Definition: MPSolver.java:180
+
MPConstraint makeConstraint(double lb, double ub)
Creates a linear constraint with given bounds.
Definition: MPSolver.java:213
MPSolver(long cPtr, boolean cMemoryOwn)
Definition: MPSolver.java:21
This mathematical programming (MP) solver class is the main class though which users build and solve...
Definition: MPSolver.java:17
-
MPVariable [] makeBoolVarArray(int count, String var_name)
Definition: MPSolver.java:82
+
MPVariable [] makeBoolVarArray(int count, String var_name)
Definition: MPSolver.java:88
-
double [] computeConstraintActivities()
Advanced usage: compute the "activities" of all constraints, which are the sums of their linear term...
Definition: MPSolver.java:264
-
long iterations()
Returns the number of simplex iterations.
Definition: MPSolver.java:424
-
MPSolver(String name, MPSolver.OptimizationProblemType problem_type)
Create a solver with the given name and underlying solver backend.
Definition: MPSolver.java:89
-
MPConstraint makeConstraint()
Creates a constraint with -infinity and +infinity bounds.
Definition: MPSolver.java:215
-
MPVariable [] makeIntVarArray(int count, double lb, double ub, String var_name)
Definition: MPSolver.java:74
-
MPSolver.ResultStatus solve(MPSolverParameters param)
Solves the problem using the specified parameter values.
Definition: MPSolver.java:254
-
String exportModelAsMpsFormat(MPModelExportOptions options)
Definition: MPSolver.java:528
- -
static ResultStatus swigToEnum(int swigValue)
Definition: MPSolver.java:648
-
The type of problems (LP or MIP) that will be solved and the underlying solver (GLOP,...
Definition: MPSolver.java:556
-
static boolean supportsProblemType(MPSolver.OptimizationProblemType problem_type)
Whether the given problem type is supported (this will depend on the targets that you linked).
Definition: MPSolver.java:97
-
long nodes()
Returns the number of branch-and-bound nodes evaluated during the solve.
Definition: MPSolver.java:433
-
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:686
+
double [] computeConstraintActivities()
Advanced usage: compute the "activities" of all constraints, which are the sums of their linear term...
Definition: MPSolver.java:270
+
long iterations()
Returns the number of simplex iterations.
Definition: MPSolver.java:360
+
MPSolver(String name, MPSolver.OptimizationProblemType problem_type)
Create a solver with the given name and underlying solver backend.
Definition: MPSolver.java:95
+
MPConstraint makeConstraint()
Creates a constraint with -infinity and +infinity bounds.
Definition: MPSolver.java:221
+
MPVariable [] makeIntVarArray(int count, double lb, double ub, String var_name)
Definition: MPSolver.java:80
+
MPSolver.ResultStatus solve(MPSolverParameters param)
Solves the problem using the specified parameter values.
Definition: MPSolver.java:260
+
String exportModelAsMpsFormat(MPModelExportOptions options)
Export the loaded model in MPS format.
Definition: MPSolver.java:521
+ +
static ResultStatus swigToEnum(int swigValue)
Definition: MPSolver.java:654
+
The type of problems (LP or MIP) that will be solved and the underlying solver (GLOP,...
Definition: MPSolver.java:562
+
static boolean supportsProblemType(MPSolver.OptimizationProblemType problem_type)
Whether the given problem type is supported (this will depend on the targets that you linked).
Definition: MPSolver.java:103
+
long nodes()
Returns the number of branch-and-bound nodes evaluated during the solve.
Definition: MPSolver.java:369
+
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:692
This class stores parameter settings for LP and MIP solvers.
-
MPVariable makeVar(double lb, double ub, boolean integer, String name)
Creates a variable with the given bounds, integrality requirement and name.
Definition: MPSolver.java:142
-
boolean setSolverSpecificParametersAsString(String parameters)
Advanced usage: pass solver specific parameters in text format.
Definition: MPSolver.java:394
-
ABNORMAL
abnormal, i.e., error of some kind.
Definition: MPSolver.java:638
-
void clear()
Clears the objective (including the optimization direction), all variables and constraints.
Definition: MPSolver.java:106
-
boolean verifySolution(double tolerance, boolean log_errors)
Advanced usage: Verifies the correctness of the solution.
Definition: MPSolver.java:286
+
MPVariable makeVar(double lb, double ub, boolean integer, String name)
Creates a variable with the given bounds, integrality requirement and name.
Definition: MPSolver.java:148
+
boolean setSolverSpecificParametersAsString(String parameters)
Advanced usage: pass solver specific parameters in text format.
Definition: MPSolver.java:330
+
ABNORMAL
abnormal, i.e., error of some kind.
Definition: MPSolver.java:644
+
void clear()
Clears the objective (including the optimization direction), all variables and constraints.
Definition: MPSolver.java:112
+
boolean verifySolution(double tolerance, boolean log_errors)
Advanced usage: Verifies the correctness of the solution.
Definition: MPSolver.java:292
- -
String loadModelFromProto(com.google.ortools.linearsolver.MPModelProto input_model)
Definition: MPSolver.java:473
-
MPVariable [] variables()
Returns the array of variables handled by the MPSolver.
Definition: MPSolver.java:121
-
GLOP_LINEAR_PROGRAMMING
Linear Programming solver using GLOP (Recommended solver).
Definition: MPSolver.java:564
+
String exportModelAsLpFormat()
Export the loaded model in LP format.
Definition: MPSolver.java:514
+
String loadModelFromProto(com.google.ortools.linearsolver.MPModelProto input_model)
Loads a model and returns the error message, which will be empty iff the model is valid.
Definition: MPSolver.java:413
+
MPVariable [] variables()
Returns the array of variables handled by the MPSolver.
Definition: MPSolver.java:127
+
GLOP_LINEAR_PROGRAMMING
Linear Programming solver using GLOP (Recommended solver).
Definition: MPSolver.java:570
A class to express a linear objective.
-
void reset()
Advanced usage: resets extracted model to solve from scratch.
Definition: MPSolver.java:298
-
MPObjective objective()
Returns the mutable objective object.
Definition: MPSolver.java:239
-
int numVariables()
Returns the number of variables.
Definition: MPSolver.java:113
-
CLP_LINEAR_PROGRAMMING
Linear Programming solver using Coin CBC.
Definition: MPSolver.java:560
-
MPVariable makeNumVar(double lb, double ub, String name)
Creates a continuous variable.
Definition: MPSolver.java:150
-
MPConstraint lookupConstraintOrNull(String constraint_name)
Looks up a constraint by name, and returns nullptr if it does not exist.
Definition: MPSolver.java:194
+
void reset()
Advanced usage: resets extracted model to solve from scratch.
Definition: MPSolver.java:304
+
MPObjective objective()
Returns the mutable objective object.
Definition: MPSolver.java:245
+
int numVariables()
Returns the number of variables.
Definition: MPSolver.java:119
+
CLP_LINEAR_PROGRAMMING
Linear Programming solver using Coin CBC.
Definition: MPSolver.java:566
+
MPVariable makeNumVar(double lb, double ub, String name)
Creates a continuous variable.
Definition: MPSolver.java:156
+
MPConstraint lookupConstraintOrNull(String constraint_name)
Looks up a constraint by name, and returns nullptr if it does not exist.
Definition: MPSolver.java:200
-
void suppressOutput()
Suppress output.
Definition: MPSolver.java:417
-
MPVariable [] makeNumVarArray(int count, double lb, double ub)
Definition: MPSolver.java:62
-
MPVariable makeBoolVar(String name)
Creates a boolean variable.
Definition: MPSolver.java:166
-
SWIGTYPE_p_util__Status loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response, double tolerance)
Load a solution encoded in a protocol buffer onto this solver for easy access via the MPSolver inter...
Definition: MPSolver.java:345
-
static OptimizationProblemType swigToEnum(int swigValue)
Definition: MPSolver.java:578
+
void suppressOutput()
Suppress output.
Definition: MPSolver.java:353
+
MPVariable [] makeNumVarArray(int count, double lb, double ub)
Definition: MPSolver.java:68
+
MPVariable makeBoolVar(String name)
Creates a boolean variable.
Definition: MPSolver.java:172
+
boolean loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response)
Load a solution encoded in a protocol buffer onto this solver for easy access via the MPSolver inter...
Definition: MPSolver.java:484
+
static OptimizationProblemType swigToEnum(int swigValue)
Definition: MPSolver.java:584
static com.google.ortools.linearsolver.MPModelProto parseFrom(java.nio.ByteBuffer data)
-
MPVariable lookupVariableOrNull(String var_name)
Looks up a variable by name, and returns nullptr if it does not exist.
Definition: MPSolver.java:130
- - -
double computeExactConditionNumber()
Advanced usage: computes the exact condition number of the current scaled basis: L1norm(B) * L1norm(...
Definition: MPSolver.java:461
- +
MPVariable lookupVariableOrNull(String var_name)
Looks up a variable by name, and returns nullptr if it does not exist.
Definition: MPSolver.java:136
+
String exportModelAsMpsFormat()
Export the loaded model in MPS format.
Definition: MPSolver.java:528
+ +
double computeExactConditionNumber()
Advanced usage: computes the exact condition number of the current scaled basis: L1norm(B) * L1norm(...
Definition: MPSolver.java:397
+
diff --git a/docs/java/MPVariable_8java_source.html b/docs/java/MPVariable_8java_source.html index a74f22e72b..c8880dc26a 100644 --- a/docs/java/MPVariable_8java_source.html +++ b/docs/java/MPVariable_8java_source.html @@ -41,21 +41,21 @@
MPVariable.java
-Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.0
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.linearsolver;
10 
11 import java.lang.reflect.*;
12 
16 public class MPVariable {
17  private transient long swigCPtr;
18  protected transient boolean swigCMemOwn;
19 
20  protected MPVariable(long cPtr, boolean cMemoryOwn) {
21  swigCMemOwn = cMemoryOwn;
22  swigCPtr = cPtr;
23  }
24 
25  protected static long getCPtr(MPVariable obj) {
26  return (obj == null) ? 0 : obj.swigCPtr;
27  }
28 
29  @SuppressWarnings("deprecation")
30  protected void finalize() {
31  delete();
32  }
33 
34  public synchronized void delete() {
35  if (swigCPtr != 0) {
36  if (swigCMemOwn) {
37  swigCMemOwn = false;
38  main_research_linear_solverJNI.delete_MPVariable(swigCPtr);
39  }
40  swigCPtr = 0;
41  }
42  }
43 
47  public String name() {
48  return main_research_linear_solverJNI.MPVariable_name(swigCPtr, this);
49  }
50 
54  public void setInteger(boolean integer) {
55  main_research_linear_solverJNI.MPVariable_setInteger(swigCPtr, this, integer);
56  }
57 
65  public double solutionValue() {
66  return main_research_linear_solverJNI.MPVariable_solutionValue(swigCPtr, this);
67  }
68 
72  public int index() {
73  return main_research_linear_solverJNI.MPVariable_index(swigCPtr, this);
74  }
75 
79  public double lb() {
80  return main_research_linear_solverJNI.MPVariable_lb(swigCPtr, this);
81  }
82 
86  public double ub() {
87  return main_research_linear_solverJNI.MPVariable_ub(swigCPtr, this);
88  }
89 
93  public void setLb(double lb) {
94  main_research_linear_solverJNI.MPVariable_setLb(swigCPtr, this, lb);
95  }
96 
100  public void setUb(double ub) {
101  main_research_linear_solverJNI.MPVariable_setUb(swigCPtr, this, ub);
102  }
103 
107  public void setBounds(double lb, double ub) {
108  main_research_linear_solverJNI.MPVariable_setBounds(swigCPtr, this, lb, ub);
109  }
110 
115  public double reducedCost() {
116  return main_research_linear_solverJNI.MPVariable_reducedCost(swigCPtr, this);
117  }
118 
125  return MPSolver.BasisStatus.swigToEnum(main_research_linear_solverJNI.MPVariable_basisStatus(swigCPtr, this));
126  }
127 
128 }
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
+Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.0
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.linearsolver;
10 
11 import java.lang.reflect.*;
12 
16 public class MPVariable {
17  private transient long swigCPtr;
18  protected transient boolean swigCMemOwn;
19 
20  protected MPVariable(long cPtr, boolean cMemoryOwn) {
21  swigCMemOwn = cMemoryOwn;
22  swigCPtr = cPtr;
23  }
24 
25  protected static long getCPtr(MPVariable obj) {
26  return (obj == null) ? 0 : obj.swigCPtr;
27  }
28 
29  @SuppressWarnings("deprecation")
30  protected void finalize() {
31  delete();
32  }
33 
34  public synchronized void delete() {
35  if (swigCPtr != 0) {
36  if (swigCMemOwn) {
37  swigCMemOwn = false;
38  main_research_linear_solverJNI.delete_MPVariable(swigCPtr);
39  }
40  swigCPtr = 0;
41  }
42  }
43 
47  public String name() {
48  return main_research_linear_solverJNI.MPVariable_name(swigCPtr, this);
49  }
50 
54  public void setInteger(boolean integer) {
55  main_research_linear_solverJNI.MPVariable_setInteger(swigCPtr, this, integer);
56  }
57 
65  public double solutionValue() {
66  return main_research_linear_solverJNI.MPVariable_solutionValue(swigCPtr, this);
67  }
68 
72  public int index() {
73  return main_research_linear_solverJNI.MPVariable_index(swigCPtr, this);
74  }
75 
79  public double lb() {
80  return main_research_linear_solverJNI.MPVariable_lb(swigCPtr, this);
81  }
82 
86  public double ub() {
87  return main_research_linear_solverJNI.MPVariable_ub(swigCPtr, this);
88  }
89 
93  public void setLb(double lb) {
94  main_research_linear_solverJNI.MPVariable_setLb(swigCPtr, this, lb);
95  }
96 
100  public void setUb(double ub) {
101  main_research_linear_solverJNI.MPVariable_setUb(swigCPtr, this, ub);
102  }
103 
107  public void setBounds(double lb, double ub) {
108  main_research_linear_solverJNI.MPVariable_setBounds(swigCPtr, this, lb, ub);
109  }
110 
115  public double reducedCost() {
116  return main_research_linear_solverJNI.MPVariable_reducedCost(swigCPtr, this);
117  }
118 
126  return MPSolver.BasisStatus.swigToEnum(main_research_linear_solverJNI.MPVariable_basisStatus(swigCPtr, this));
127  }
128 
129 }
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
MPVariable(long cPtr, boolean cMemoryOwn)
Definition: MPVariable.java:20
void setBounds(double lb, double ub)
Sets both the lower and upper bounds.
-
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:697
+
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:703
int index()
Returns the index of the variable in the MPSolver::variables_.
Definition: MPVariable.java:72
void setUb(double ub)
Sets the upper bound.
This mathematical programming (MP) solver class is the main class though which users build and solve...
Definition: MPSolver.java:17
String name()
Returns the name of the variable.
Definition: MPVariable.java:47
double solutionValue()
Returns the value of the variable in the current solution.
Definition: MPVariable.java:65
-
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:686
+
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:692
double lb()
Returns the lower bound.
Definition: MPVariable.java:79
double reducedCost()
Advanced usage: returns the reduced cost of the variable in the current solution (only available for...
double ub()
Returns the upper bound.
Definition: MPVariable.java:86
void setLb(double lb)
Sets the lower bound.
Definition: MPVariable.java:93
-
MPSolver.BasisStatus basisStatus()
Advanced usage: returns the basis status of the variable in the current solution (only available for ...
+
MPSolver.BasisStatus basisStatus()
Advanced usage: returns the basis status of the variable in the current solution (only available for...
void setInteger(boolean integer)
Sets the integrality requirement of the variable.
Definition: MPVariable.java:54
diff --git a/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPConstraint.html b/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPConstraint.html index bc5cd41f9a..54f40ca717 100644 --- a/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPConstraint.html +++ b/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPConstraint.html @@ -174,7 +174,7 @@ Protected Member Functions

See also
MPSolver::BasisStatus.
-

Definition at line 156 of file MPConstraint.java.

+

Definition at line 157 of file MPConstraint.java.

@@ -231,7 +231,7 @@ Protected Member Functions

Advanced usage: returns the dual value of the constraint in the current
solution (only available for continuous problems).

-

Definition at line 140 of file MPConstraint.java.

+

Definition at line 141 of file MPConstraint.java.

@@ -291,7 +291,7 @@ Protected Member Functions

Returns the index of the constraint in the MPSolver::constraints_.

-

Definition at line 132 of file MPConstraint.java.

+

Definition at line 133 of file MPConstraint.java.

@@ -493,7 +493,8 @@ Protected Member Functions

Advanced usage: sets the constraint "laziness".



- This is only supported for SCIP and has no effect on other solvers.
+ This is only supported for SCIP and has no effect on other
+ solvers.


When laziness is true, the constraint is only considered by the Linear
Programming solver if its current solution violates the constraint. In this
@@ -502,7 +503,7 @@ Protected Member Functions
For more info see: http://tinyurl.com/lazy-constraints.

-

Definition at line 125 of file MPConstraint.java.

+

Definition at line 126 of file MPConstraint.java.

diff --git a/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver-members.html b/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver-members.html index f5810d7d84..6afa1d1e8f 100644 --- a/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver-members.html +++ b/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver-members.html @@ -56,45 +56,44 @@ iterations()com.google.ortools.linearsolver.MPSolverinline loadModelFromProto(com.google.ortools.linearsolver.MPModelProto input_model)com.google.ortools.linearsolver.MPSolverinline loadModelFromProtoWithUniqueNamesOrDie(com.google.ortools.linearsolver.MPModelProto input_model)com.google.ortools.linearsolver.MPSolverinline - loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response, double tolerance)com.google.ortools.linearsolver.MPSolverinline - loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response)com.google.ortools.linearsolver.MPSolverinline - lookupConstraintOrNull(String constraint_name)com.google.ortools.linearsolver.MPSolverinline - lookupVariableOrNull(String var_name)com.google.ortools.linearsolver.MPSolverinline - makeBoolVar(String name)com.google.ortools.linearsolver.MPSolverinline - makeBoolVarArray(int count)com.google.ortools.linearsolver.MPSolverinline - makeBoolVarArray(int count, String var_name)com.google.ortools.linearsolver.MPSolverinline - makeConstraint(double lb, double ub)com.google.ortools.linearsolver.MPSolverinline - makeConstraint()com.google.ortools.linearsolver.MPSolverinline - makeConstraint(double lb, double ub, String name)com.google.ortools.linearsolver.MPSolverinline - makeConstraint(String name)com.google.ortools.linearsolver.MPSolverinline - makeIntVar(double lb, double ub, String name)com.google.ortools.linearsolver.MPSolverinline - makeIntVarArray(int count, double lb, double ub)com.google.ortools.linearsolver.MPSolverinline - makeIntVarArray(int count, double lb, double ub, String var_name)com.google.ortools.linearsolver.MPSolverinline - makeNumVar(double lb, double ub, String name)com.google.ortools.linearsolver.MPSolverinline - makeNumVarArray(int count, double lb, double ub)com.google.ortools.linearsolver.MPSolverinline - makeNumVarArray(int count, double lb, double ub, String var_name)com.google.ortools.linearsolver.MPSolverinline - makeVar(double lb, double ub, boolean integer, String name)com.google.ortools.linearsolver.MPSolverinline - makeVarArray(int count, double lb, double ub, boolean integer)com.google.ortools.linearsolver.MPSolverinline - makeVarArray(int count, double lb, double ub, boolean integer, String var_name)com.google.ortools.linearsolver.MPSolverinline - MPSolver(long cPtr, boolean cMemoryOwn)com.google.ortools.linearsolver.MPSolverinlineprotected - MPSolver(String name, MPSolver.OptimizationProblemType problem_type)com.google.ortools.linearsolver.MPSolverinline - nodes()com.google.ortools.linearsolver.MPSolverinline - numConstraints()com.google.ortools.linearsolver.MPSolverinline - numVariables()com.google.ortools.linearsolver.MPSolverinline - objective()com.google.ortools.linearsolver.MPSolverinline - reset()com.google.ortools.linearsolver.MPSolverinline - setHint(MPVariable[] variables, double[] values)com.google.ortools.linearsolver.MPSolverinline - setNumThreads(int num_theads)com.google.ortools.linearsolver.MPSolverinline - setSolverSpecificParametersAsString(String parameters)com.google.ortools.linearsolver.MPSolverinline - setTimeLimit(long time_limit_milliseconds)com.google.ortools.linearsolver.MPSolverinline - solve()com.google.ortools.linearsolver.MPSolverinline - solve(MPSolverParameters param)com.google.ortools.linearsolver.MPSolverinline - solveWithProto(com.google.ortools.linearsolver.MPModelRequest model_request)com.google.ortools.linearsolver.MPSolverinlinestatic - supportsProblemType(MPSolver.OptimizationProblemType problem_type)com.google.ortools.linearsolver.MPSolverinlinestatic - suppressOutput()com.google.ortools.linearsolver.MPSolverinline - variables()com.google.ortools.linearsolver.MPSolverinline - verifySolution(double tolerance, boolean log_errors)com.google.ortools.linearsolver.MPSolverinline - wallTime()com.google.ortools.linearsolver.MPSolverinline + loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response)com.google.ortools.linearsolver.MPSolverinline + lookupConstraintOrNull(String constraint_name)com.google.ortools.linearsolver.MPSolverinline + lookupVariableOrNull(String var_name)com.google.ortools.linearsolver.MPSolverinline + makeBoolVar(String name)com.google.ortools.linearsolver.MPSolverinline + makeBoolVarArray(int count)com.google.ortools.linearsolver.MPSolverinline + makeBoolVarArray(int count, String var_name)com.google.ortools.linearsolver.MPSolverinline + makeConstraint(double lb, double ub)com.google.ortools.linearsolver.MPSolverinline + makeConstraint()com.google.ortools.linearsolver.MPSolverinline + makeConstraint(double lb, double ub, String name)com.google.ortools.linearsolver.MPSolverinline + makeConstraint(String name)com.google.ortools.linearsolver.MPSolverinline + makeIntVar(double lb, double ub, String name)com.google.ortools.linearsolver.MPSolverinline + makeIntVarArray(int count, double lb, double ub)com.google.ortools.linearsolver.MPSolverinline + makeIntVarArray(int count, double lb, double ub, String var_name)com.google.ortools.linearsolver.MPSolverinline + makeNumVar(double lb, double ub, String name)com.google.ortools.linearsolver.MPSolverinline + makeNumVarArray(int count, double lb, double ub)com.google.ortools.linearsolver.MPSolverinline + makeNumVarArray(int count, double lb, double ub, String var_name)com.google.ortools.linearsolver.MPSolverinline + makeVar(double lb, double ub, boolean integer, String name)com.google.ortools.linearsolver.MPSolverinline + makeVarArray(int count, double lb, double ub, boolean integer)com.google.ortools.linearsolver.MPSolverinline + makeVarArray(int count, double lb, double ub, boolean integer, String var_name)com.google.ortools.linearsolver.MPSolverinline + MPSolver(long cPtr, boolean cMemoryOwn)com.google.ortools.linearsolver.MPSolverinlineprotected + MPSolver(String name, MPSolver.OptimizationProblemType problem_type)com.google.ortools.linearsolver.MPSolverinline + nodes()com.google.ortools.linearsolver.MPSolverinline + numConstraints()com.google.ortools.linearsolver.MPSolverinline + numVariables()com.google.ortools.linearsolver.MPSolverinline + objective()com.google.ortools.linearsolver.MPSolverinline + reset()com.google.ortools.linearsolver.MPSolverinline + setHint(MPVariable[] variables, double[] values)com.google.ortools.linearsolver.MPSolverinline + setNumThreads(int num_theads)com.google.ortools.linearsolver.MPSolverinline + setSolverSpecificParametersAsString(String parameters)com.google.ortools.linearsolver.MPSolverinline + setTimeLimit(long time_limit_milliseconds)com.google.ortools.linearsolver.MPSolverinline + solve()com.google.ortools.linearsolver.MPSolverinline + solve(MPSolverParameters param)com.google.ortools.linearsolver.MPSolverinline + solveWithProto(com.google.ortools.linearsolver.MPModelRequest model_request)com.google.ortools.linearsolver.MPSolverinlinestatic + supportsProblemType(MPSolver.OptimizationProblemType problem_type)com.google.ortools.linearsolver.MPSolverinlinestatic + suppressOutput()com.google.ortools.linearsolver.MPSolverinline + variables()com.google.ortools.linearsolver.MPSolverinline + verifySolution(double tolerance, boolean log_errors)com.google.ortools.linearsolver.MPSolverinline + wallTime()com.google.ortools.linearsolver.MPSolverinline
-

Definition at line 494 of file MPSolver.java.

+

Fills the solution found to a response proto and returns it.

+ +

Definition at line 440 of file MPSolver.java.

@@ -537,7 +546,7 @@ Protected Member Functions

Enable output.

-

Definition at line 410 of file MPSolver.java.

+

Definition at line 346 of file MPSolver.java.

@@ -565,7 +574,9 @@ Protected Member Functions
-

Definition at line 520 of file MPSolver.java.

+

Export the loaded model in LP format.

+ +

Definition at line 507 of file MPSolver.java.

@@ -592,7 +603,9 @@ Protected Member Functions
-

Definition at line 524 of file MPSolver.java.

+

Export the loaded model in LP format.

+ +

Definition at line 514 of file MPSolver.java.

@@ -620,7 +633,9 @@ Protected Member Functions
-

Definition at line 528 of file MPSolver.java.

+

Export the loaded model in MPS format.

+ +

Definition at line 521 of file MPSolver.java.

@@ -647,7 +662,9 @@ Protected Member Functions
-

Definition at line 532 of file MPSolver.java.

+

Export the loaded model in MPS format.

+ +

Definition at line 528 of file MPSolver.java.

@@ -674,7 +691,9 @@ Protected Member Functions
-

Definition at line 481 of file MPSolver.java.

+

Export the loaded model to proto and returns it.

+ +

Definition at line 424 of file MPSolver.java.

@@ -706,7 +725,7 @@ Protected Member Functions
You can use -MPSolver::infinity() for negative infinity.

-

Definition at line 403 of file MPSolver.java.

+

Definition at line 339 of file MPSolver.java.

@@ -741,7 +760,7 @@ Protected Member Functions call may still linger for a while depending on the conditions. If
interruption is not supported; returns false and does nothing.

-

Definition at line 310 of file MPSolver.java.

+

Definition at line 316 of file MPSolver.java.

@@ -770,7 +789,7 @@ Protected Member Functions

Returns the number of simplex iterations.

-

Definition at line 424 of file MPSolver.java.

+

Definition at line 360 of file MPSolver.java.

@@ -798,7 +817,10 @@ Protected Member Functions
-

Definition at line 473 of file MPSolver.java.

+

Loads a model and returns the error message, which will be empty iff the
+ model is valid.

+ +

Definition at line 413 of file MPSolver.java.

@@ -826,12 +848,12 @@ Protected Member Functions
-

Definition at line 477 of file MPSolver.java.

+

Definition at line 417 of file MPSolver.java.

- -

◆ loadSolutionFromProto() [1/2]

+ +

◆ loadSolutionFromProto()

@@ -840,68 +862,7 @@ Protected Member Functions - - - - - - - - - - - - - - - - -
SWIGTYPE_p_util__Status com.google.ortools.linearsolver.MPSolver.loadSolutionFromProto (com.google.ortools.linearsolver.MPSolutionResponse response,
double tolerance 
)
- - -inline - - -
- -

Load a solution encoded in a protocol buffer onto this solver for easy
- access via the MPSolver interface.

-


-
- IMPORTANT: This may only be used in conjunction with ExportModel(),
- following this example:
-
-

MPSolver my_solver;
... add variables and constraints ...
MPModelProto model_proto;
my_solver.ExportModelToProto(model_proto);
MPSolutionResponse solver_response;
MPSolver::SolveWithProto(model_proto, solver_response);
if (solver_response.result_status() == MPSolutionResponse::OPTIMAL) {
CHECK_OK(my_solver.LoadSolutionFromProto(solver_response));
... inspect the solution using the usual API: solution_value(), etc...
}


-
- The response must be in OPTIMAL or FEASIBLE status.
-
- Returns a non-OK status if a problem arised (typically, if it wasn't used
- like it should be):
-

    -
  • loading a solution whose variables don't correspond to the solver's
    - current variables
    -
  • -
  • loading a solution with a status other than OPTIMAL / FEASIBLE.
    -
    - Note: the objective value isn't checked. You can use VerifySolution() for
    - that.
  • -
- -

Definition at line 345 of file MPSolver.java.

- -
-
- -

◆ loadSolutionFromProto() [2/2]

- -
-
- - -
- - - + @@ -926,7 +887,7 @@ Protected Member Functions
The response must be in OPTIMAL or FEASIBLE status.

- Returns a non-OK status if a problem arised (typically, if it wasn't used
+ Returns a false if a problem arised (typically, if it wasn't used
like it should be):

  • loading a solution whose variables don't correspond to the solver's
    @@ -938,7 +899,7 @@ Protected Member Functions that.
-

Definition at line 380 of file MPSolver.java.

+

Definition at line 484 of file MPSolver.java.

@@ -973,7 +934,7 @@ Protected Member Functions lazily created upon first use. Will crash if constraint names are not
unique.

-

Definition at line 194 of file MPSolver.java.

+

Definition at line 200 of file MPSolver.java.

@@ -1006,7 +967,7 @@ Protected Member Functions first call has a O(n) complexity, as the variable name index is lazily
created upon first use. Will crash if variable names are not unique.

-

Definition at line 130 of file MPSolver.java.

+

Definition at line 136 of file MPSolver.java.

@@ -1036,7 +997,7 @@ Protected Member Functions

Creates a boolean variable.

-

Definition at line 166 of file MPSolver.java.

+

Definition at line 172 of file MPSolver.java.

@@ -1064,7 +1025,7 @@ Protected Member Functions
SWIGTYPE_p_util__Status com.google.ortools.linearsolver.MPSolver.loadSolutionFromProto boolean com.google.ortools.linearsolver.MPSolver.loadSolutionFromProto ( com.google.ortools.linearsolver.MPSolutionResponse  response)
-

Definition at line 78 of file MPSolver.java.

+

Definition at line 84 of file MPSolver.java.

@@ -1102,7 +1063,7 @@ Protected Member Functions
-

Definition at line 82 of file MPSolver.java.

+

Definition at line 88 of file MPSolver.java.

@@ -1148,7 +1109,7 @@ Protected Member Functions

Returns
a pointer to the newly created constraint.
-

Definition at line 207 of file MPSolver.java.

+

Definition at line 213 of file MPSolver.java.

@@ -1177,7 +1138,7 @@ Protected Member Functions

Creates a constraint with -infinity and +infinity bounds.

-

Definition at line 215 of file MPSolver.java.

+

Definition at line 221 of file MPSolver.java.

@@ -1223,7 +1184,7 @@ Protected Member Functions

Creates a named constraint with given bounds.

-

Definition at line 223 of file MPSolver.java.

+

Definition at line 229 of file MPSolver.java.

@@ -1253,7 +1214,7 @@ Protected Member Functions

Creates a named constraint with -infinity and +infinity bounds.

-

Definition at line 231 of file MPSolver.java.

+

Definition at line 237 of file MPSolver.java.

@@ -1299,7 +1260,7 @@ Protected Member Functions

Creates an integer variable.

-

Definition at line 158 of file MPSolver.java.

+

Definition at line 164 of file MPSolver.java.

@@ -1343,7 +1304,7 @@ Protected Member Functions
-

Definition at line 70 of file MPSolver.java.

+

Definition at line 76 of file MPSolver.java.

@@ -1393,7 +1354,7 @@ Protected Member Functions
-

Definition at line 74 of file MPSolver.java.

+

Definition at line 80 of file MPSolver.java.

@@ -1439,7 +1400,7 @@ Protected Member Functions

Creates a continuous variable.

-

Definition at line 150 of file MPSolver.java.

+

Definition at line 156 of file MPSolver.java.

@@ -1483,7 +1444,7 @@ Protected Member Functions
-

Definition at line 62 of file MPSolver.java.

+

Definition at line 68 of file MPSolver.java.

@@ -1533,7 +1494,7 @@ Protected Member Functions
-

Definition at line 66 of file MPSolver.java.

+

Definition at line 72 of file MPSolver.java.

@@ -1590,7 +1551,7 @@ Protected Member Functions optional. If you give an empty name, name() will auto-generate one for you
upon request.

-

Definition at line 142 of file MPSolver.java.

+

Definition at line 148 of file MPSolver.java.

@@ -1640,7 +1601,9 @@ Protected Member Functions
-

Definition at line 45 of file MPSolver.java.

+

Creates and returns an array of variables.

+ +

Definition at line 48 of file MPSolver.java.

@@ -1696,7 +1659,9 @@ Protected Member Functions
-

Definition at line 53 of file MPSolver.java.

+

Creates and returns an array of named variables.

+ +

Definition at line 59 of file MPSolver.java.

@@ -1728,7 +1693,7 @@ Protected Member Functions
Only available for discrete problems.

-

Definition at line 433 of file MPSolver.java.

+

Definition at line 369 of file MPSolver.java.

@@ -1757,7 +1722,7 @@ Protected Member Functions

Returns the number of constraints.

-

Definition at line 174 of file MPSolver.java.

+

Definition at line 180 of file MPSolver.java.

@@ -1786,7 +1751,7 @@ Protected Member Functions

Returns the number of variables.

-

Definition at line 113 of file MPSolver.java.

+

Definition at line 119 of file MPSolver.java.

@@ -1815,7 +1780,7 @@ Protected Member Functions

Returns the mutable objective object.

-

Definition at line 239 of file MPSolver.java.

+

Definition at line 245 of file MPSolver.java.

@@ -1850,7 +1815,7 @@ Protected Member Functions linear program. It will just make sure that next Solve() will be as if
everything was reconstructed from scratch.

-

Definition at line 298 of file MPSolver.java.

+

Definition at line 304 of file MPSolver.java.

@@ -1889,9 +1854,19 @@ Protected Member Functions

Sets a hint for solution.

-

If a feasible or almost-feasible solution to the problem is already known, it may be helpful to pass it to the solver so that it can be used. A solver that supports this feature will try to use this information to create its initial feasible solution. Note that it may not always be faster to give a hint like this to the solver. There is also no guarantee that the solver will use this hint or try to return a solution "close" to this assignment in case of multiple optimal solutions.

+


+
+ If a feasible or almost-feasible solution to the problem is already known,
+ it may be helpful to pass it to the solver so that it can be used. A
+ solver that supports this feature will try to use this information to
+ create its initial feasible solution.
+
+ Note that it may not always be faster to give a hint like this to the
+ solver. There is also no guarantee that the solver will use this hint or
+ try to return a solution "close" to this assignment in case of multiple
+ optimal solutions.

-

Definition at line 539 of file MPSolver.java.

+

Definition at line 545 of file MPSolver.java.

@@ -1921,7 +1896,7 @@ Protected Member Functions

Sets the number of threads to be used by the solver.

-

Definition at line 546 of file MPSolver.java.

+

Definition at line 552 of file MPSolver.java.

@@ -1959,7 +1934,7 @@ Protected Member Functions wrong (you can check the log if you suspect an issue there). This seems to
be a bug in SCIP though.

-

Definition at line 394 of file MPSolver.java.

+

Definition at line 330 of file MPSolver.java.

@@ -1987,7 +1962,7 @@ Protected Member Functions
-

Definition at line 465 of file MPSolver.java.

+

Definition at line 401 of file MPSolver.java.

@@ -2016,7 +1991,7 @@ Protected Member Functions

Solves the problem using default parameter values.

-

Definition at line 247 of file MPSolver.java.

+

Definition at line 253 of file MPSolver.java.

@@ -2046,7 +2021,7 @@ Protected Member Functions

Solves the problem using the specified parameter values.

-

Definition at line 254 of file MPSolver.java.

+

Definition at line 260 of file MPSolver.java.

@@ -2074,7 +2049,9 @@ Protected Member Functions
-

Definition at line 507 of file MPSolver.java.

+

Solves the given model proto and returns a response proto.

+ +

Definition at line 491 of file MPSolver.java.

@@ -2105,7 +2082,7 @@ Protected Member Functions

Whether the given problem type is supported (this will depend on the
targets that you linked).

-

Definition at line 97 of file MPSolver.java.

+

Definition at line 103 of file MPSolver.java.

@@ -2134,7 +2111,7 @@ Protected Member Functions

Suppress output.

-

Definition at line 417 of file MPSolver.java.

+

Definition at line 353 of file MPSolver.java.

@@ -2165,7 +2142,7 @@ Protected Member Functions

(They are listed in
the order in which they were created.)

-

Definition at line 121 of file MPSolver.java.

+

Definition at line 127 of file MPSolver.java.

@@ -2227,7 +2204,7 @@ Protected Member Functions this method directly. -

Definition at line 286 of file MPSolver.java.

+

Definition at line 292 of file MPSolver.java.

@@ -2254,7 +2231,7 @@ Protected Member Functions
-

Definition at line 469 of file MPSolver.java.

+

Definition at line 405 of file MPSolver.java.

diff --git a/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPVariable.html b/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPVariable.html index 933eeffe76..6808128b13 100644 --- a/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPVariable.html +++ b/docs/java/classcom_1_1google_1_1ortools_1_1linearsolver_1_1MPVariable.html @@ -81,7 +81,8 @@ Public Member Functions solution (only available for continuous problems). More...
  MPSolver.BasisStatus basisStatus () - Advanced usage: returns the basis status of the variable in the current solution (only available for continuous problems). More...
+ Advanced usage: returns the basis status of the variable in the current
+ solution (only available for continuous problems). More...
 

@@ -152,12 +153,13 @@ Protected Member Functions

-

Advanced usage: returns the basis status of the variable in the current solution (only available for continuous problems).

+

Advanced usage: returns the basis status of the variable in the current
+ solution (only available for continuous problems).



See also
MPSolver::BasisStatus.
-

Definition at line 124 of file MPVariable.java.

+

Definition at line 125 of file MPVariable.java.

diff --git a/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1BasisStatus.html b/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1BasisStatus.html index c98b8c9d8f..5c9c24bf39 100644 --- a/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1BasisStatus.html +++ b/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1BasisStatus.html @@ -46,7 +46,7 @@

Advanced usage: possible basis status values for a variable and the slack
variable of a linear constraint.

-

Definition at line 686 of file MPSolver.java.

+

Definition at line 692 of file MPSolver.java.

@@ -96,7 +96,7 @@ Public Attributes

Public Member Functions

-

Definition at line 697 of file MPSolver.java.

+

Definition at line 703 of file MPSolver.java.

@@ -123,7 +123,7 @@ Public Attributes
-

Definition at line 693 of file MPSolver.java.

+

Definition at line 699 of file MPSolver.java.

@@ -140,7 +140,7 @@ Public Attributes
-

Definition at line 688 of file MPSolver.java.

+

Definition at line 694 of file MPSolver.java.

@@ -156,7 +156,7 @@ Public Attributes
-

Definition at line 689 of file MPSolver.java.

+

Definition at line 695 of file MPSolver.java.

@@ -172,7 +172,7 @@ Public Attributes
-

Definition at line 691 of file MPSolver.java.

+

Definition at line 697 of file MPSolver.java.

@@ -188,7 +188,7 @@ Public Attributes
-

Definition at line 690 of file MPSolver.java.

+

Definition at line 696 of file MPSolver.java.

@@ -204,7 +204,7 @@ Public Attributes
-

Definition at line 687 of file MPSolver.java.

+

Definition at line 693 of file MPSolver.java.

diff --git a/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1OptimizationProblemType.html b/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1OptimizationProblemType.html index 5356765664..0cb32b11ea 100644 --- a/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1OptimizationProblemType.html +++ b/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1OptimizationProblemType.html @@ -49,7 +49,7 @@ remain consistent with MPModelRequest::OptimizationProblemType
(take particular care of the open-source version).

-

Definition at line 556 of file MPSolver.java.

+

Definition at line 562 of file MPSolver.java.

@@ -101,7 +101,7 @@ Public Attributes

Public Member Functions

-

Definition at line 578 of file MPSolver.java.

+

Definition at line 584 of file MPSolver.java.

@@ -128,7 +128,7 @@ Public Attributes
-

Definition at line 574 of file MPSolver.java.

+

Definition at line 580 of file MPSolver.java.

@@ -147,7 +147,7 @@ Public Attributes

Linear Boolean Programming Solver.

-

Definition at line 572 of file MPSolver.java.

+

Definition at line 578 of file MPSolver.java.

@@ -165,7 +165,7 @@ Public Attributes

Mixed integer Programming Solver using Coin CBC.

-

Definition at line 568 of file MPSolver.java.

+

Definition at line 574 of file MPSolver.java.

@@ -183,7 +183,7 @@ Public Attributes

Linear Programming solver using Coin CBC.

-

Definition at line 560 of file MPSolver.java.

+

Definition at line 566 of file MPSolver.java.

@@ -201,7 +201,7 @@ Public Attributes

Linear Programming solver using GLOP (Recommended solver).

-

Definition at line 564 of file MPSolver.java.

+

Definition at line 570 of file MPSolver.java.

diff --git a/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1ResultStatus.html b/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1ResultStatus.html index 465495fa8d..f27201028c 100644 --- a/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1ResultStatus.html +++ b/docs/java/enumcom_1_1google_1_1ortools_1_1linearsolver_1_1MPSolver_1_1ResultStatus.html @@ -49,7 +49,7 @@ ./linear_solver.proto) is guaranteed by ./enum_consistency_test.cc, you may
rely on it.

-

Definition at line 618 of file MPSolver.java.

+

Definition at line 624 of file MPSolver.java.

@@ -107,7 +107,7 @@ Public Attributes

Public Member Functions

-

Definition at line 648 of file MPSolver.java.

+

Definition at line 654 of file MPSolver.java.

@@ -134,7 +134,7 @@ Public Attributes
-

Definition at line 644 of file MPSolver.java.

+

Definition at line 650 of file MPSolver.java.

@@ -153,7 +153,7 @@ Public Attributes

abnormal, i.e., error of some kind.

-

Definition at line 638 of file MPSolver.java.

+

Definition at line 644 of file MPSolver.java.

@@ -171,7 +171,7 @@ Public Attributes

feasible, or stopped by limit.

-

Definition at line 626 of file MPSolver.java.

+

Definition at line 632 of file MPSolver.java.

@@ -189,7 +189,7 @@ Public Attributes

proven infeasible.

-

Definition at line 630 of file MPSolver.java.

+

Definition at line 636 of file MPSolver.java.

@@ -207,7 +207,7 @@ Public Attributes

not been solved yet.

-

Definition at line 642 of file MPSolver.java.

+

Definition at line 648 of file MPSolver.java.

@@ -225,7 +225,7 @@ Public Attributes

optimal.

-

Definition at line 622 of file MPSolver.java.

+

Definition at line 628 of file MPSolver.java.

@@ -243,7 +243,7 @@ Public Attributes

proven unbounded.

-

Definition at line 634 of file MPSolver.java.

+

Definition at line 640 of file MPSolver.java.

diff --git a/docs/java/functions_func_l.html b/docs/java/functions_func_l.html index 64e88fd380..cb6b1a19a4 100644 --- a/docs/java/functions_func_l.html +++ b/docs/java/functions_func_l.html @@ -80,7 +80,7 @@ : com.google.ortools.linearsolver.MPSolver
  • loadSolutionFromProto() -: com.google.ortools.linearsolver.MPSolver +: com.google.ortools.linearsolver.MPSolver
  • LocalCheapestInsertionFilteredDecisionBuilder() : com.google.ortools.constraintsolver.LocalCheapestInsertionFilteredDecisionBuilder @@ -98,7 +98,7 @@ : com.google.ortools.constraintsolver.LocalSearchOperator
  • LocalSearchPhaseParameters() -: com.google.ortools.constraintsolver.LocalSearchPhaseParameters +: com.google.ortools.constraintsolver.LocalSearchPhaseParameters
  • localSearchProfile() : com.google.ortools.constraintsolver.Solver diff --git a/docs/java/functions_l.html b/docs/java/functions_l.html index fbffc5dc24..92970856c7 100644 --- a/docs/java/functions_l.html +++ b/docs/java/functions_l.html @@ -101,7 +101,7 @@ : com.google.ortools.linearsolver.MPSolver
  • loadSolutionFromProto() -: com.google.ortools.linearsolver.MPSolver +: com.google.ortools.linearsolver.MPSolver
  • LOCAL_CHEAPEST_ARC : com.google.ortools.constraintsolver.FirstSolutionStrategy.Value diff --git a/ortools/linear_solver/java/linear_solver.i b/ortools/linear_solver/java/linear_solver.i index ab2a319b56..38d7d0d930 100644 --- a/ortools/linear_solver/java/linear_solver.i +++ b/ortools/linear_solver/java/linear_solver.i @@ -82,8 +82,10 @@ PROTO2_RETURN( %extend operations_research::MPSolver { - // Replaces MPSolver::LoadModelFromProto. We simply return the error message, - // which will be empty iff the model is valid. + /** + * Loads a model and returns the error message, which will be empty iff the + * model is valid. + */ std::string loadModelFromProto(const operations_research::MPModelProto& input_model) { std::string error_message; $self->LoadModelFromProto(input_model, &error_message); @@ -104,21 +106,62 @@ PROTO2_RETURN( return error_message; } - // Replaces MPSolver::ExportModelToProto + /** + * Export the loaded model to proto and returns it. + */ operations_research::MPModelProto exportModelToProto() { operations_research::MPModelProto model; $self->ExportModelToProto(&model); return model; } - // Replaces MPSolver::FillSolutionResponseProto + /** + * Fills the solution found to a response proto and returns it. + */ operations_research::MPSolutionResponse createSolutionResponseProto() { operations_research::MPSolutionResponse response; $self->FillSolutionResponseProto(&response); return response; } - // Replaces MPSolver::SolveWithProto + /** + * Load a solution encoded in a protocol buffer onto this solver for easy + access via the MPSolver interface. + * + * IMPORTANT: This may only be used in conjunction with ExportModel(), + following this example: + * + \code + MPSolver my_solver; + ... add variables and constraints ... + MPModelProto model_proto; + my_solver.ExportModelToProto(&model_proto); + MPSolutionResponse solver_response; + MPSolver::SolveWithProto(model_proto, &solver_response); + if (solver_response.result_status() == MPSolutionResponse::OPTIMAL) { + CHECK_OK(my_solver.LoadSolutionFromProto(solver_response)); + ... inspect the solution using the usual API: solution_value(), etc... + } + \endcode + * + * The response must be in OPTIMAL or FEASIBLE status. + * + * Returns a false if a problem arised (typically, if it wasn't used + * like it should be): + * - loading a solution whose variables don't correspond to the solver's + * current variables + * - loading a solution with a status other than OPTIMAL / FEASIBLE. + * + * Note: the objective value isn't checked. You can use VerifySolution() for + * that. + */ + bool loadSolutionFromProto(const MPSolutionResponse& response) { + return $self->LoadSolutionFromProto(response).ok(); + } + + /** + * Solves the given model proto and returns a response proto. + */ static operations_research::MPSolutionResponse solveWithProto( const operations_research::MPModelRequest& model_request) { operations_research::MPSolutionResponse response; @@ -126,6 +169,9 @@ PROTO2_RETURN( return response; } + /** + * Export the loaded model in LP format. + */ std::string exportModelAsLpFormat( const operations_research::MPModelExportOptions& options = operations_research::MPModelExportOptions()) { @@ -134,6 +180,9 @@ PROTO2_RETURN( return ExportModelAsLpFormat(model, options).value_or(""); } + /** + * Export the loaded model in MPS format. + */ std::string exportModelAsMpsFormat( const operations_research::MPModelExportOptions& options = operations_research::MPModelExportOptions()) { @@ -142,17 +191,19 @@ PROTO2_RETURN( return ExportModelAsMpsFormat(model, options).value_or(""); } - /// Sets a hint for solution. - /// - /// If a feasible or almost-feasible solution to the problem is already known, - /// it may be helpful to pass it to the solver so that it can be used. A - /// solver that supports this feature will try to use this information to - /// create its initial feasible solution. - /// - /// Note that it may not always be faster to give a hint like this to the - /// solver. There is also no guarantee that the solver will use this hint or - /// try to return a solution "close" to this assignment in case of multiple - /// optimal solutions. + /** + * Sets a hint for solution. + * + * If a feasible or almost-feasible solution to the problem is already known, + * it may be helpful to pass it to the solver so that it can be used. A + * solver that supports this feature will try to use this information to + * create its initial feasible solution. + * + * Note that it may not always be faster to give a hint like this to the + * solver. There is also no guarantee that the solver will use this hint or + * try to return a solution "close" to this assignment in case of multiple + * optimal solutions. + */ void setHint(const std::vector& variables, const std::vector& values) { if (variables.size() != values.size()) { @@ -167,7 +218,9 @@ PROTO2_RETURN( $self->SetHint(hint); } - /// Sets the number of threads to be used by the solver. + /** + * Sets the number of threads to be used by the solver. + */ bool setNumThreads(int num_theads) { return $self->SetNumThreads(num_theads).ok(); } @@ -175,6 +228,9 @@ PROTO2_RETURN( // Add java code on MPSolver. %typemap(javacode) operations_research::MPSolver %{ + /** + * Creates and returns an array of variables. + */ public MPVariable[] makeVarArray(int count, double lb, double ub, boolean integer) { MPVariable[] array = new MPVariable[count]; for (int i = 0; i < count; ++i) { @@ -183,6 +239,9 @@ PROTO2_RETURN( return array; } + /** + * Creates and returns an array of named variables. + */ public MPVariable[] makeVarArray(int count, double lb, double ub, boolean integer, String var_name) { MPVariable[] array = new MPVariable[count]; @@ -287,7 +346,7 @@ PROTO2_RETURN( %unignore operations_research::MPSolver::LoadStatus; %unignore operations_research::MPSolver::NO_ERROR; // no test %unignore operations_research::MPSolver::UNKNOWN_VARIABLE_ID; // no test -%rename (loadSolutionFromProto) operations_research::MPSolver::LoadSolutionFromProto; // no test +// - loadSolutionFromProto; // Use hand-written version. // Expose some of the more advanced MPSolver API. %rename (supportsProblemType) operations_research::MPSolver::SupportsProblemType; // no test diff --git a/ortools/linear_solver/linear_solver.h b/ortools/linear_solver/linear_solver.h index e5a33cbde4..154f39e92a 100644 --- a/ortools/linear_solver/linear_solver.h +++ b/ortools/linear_solver/linear_solver.h @@ -17,8 +17,6 @@ // and Python via SWIG. // // -// ----------------------------------- -// // What is Linear Programming? // // In mathematics, linear programming (LP) is a technique for optimization of @@ -173,63 +171,62 @@ class MPVariable; */ class MPSolver { public: - /** - * The type of problems (LP or MIP) that will be solved and the underlying - * solver (GLOP, GLPK, CLP, CBC or SCIP) that will solve them. This must - * remain consistent with MPModelRequest::OptimizationProblemType - * (take particular care of the open-source version). - */ - enum OptimizationProblemType { + /** + * The type of problems (LP or MIP) that will be solved and the underlying + * solver (GLOP, GLPK, CLP, CBC or SCIP) that will solve them. This must + * remain consistent with MPModelRequest::OptimizationProblemType + * (take particular care of the open-source version). + */ + enum OptimizationProblemType { #ifdef USE_CLP - /** Linear Programming solver using Coin CBC. */ - CLP_LINEAR_PROGRAMMING = 0, + /// Linear Programming solver using Coin CBC. + CLP_LINEAR_PROGRAMMING = 0, #endif #ifdef USE_GLPK - /** Linear Programming solver using GLPK. */ - GLPK_LINEAR_PROGRAMMING = 1, + /// Linear Programming solver using GLPK. + GLPK_LINEAR_PROGRAMMING = 1, #endif #ifdef USE_GLOP - /** Linear Programming solver using GLOP (Recommended solver). */ - GLOP_LINEAR_PROGRAMMING = 2, + /// Linear Programming solver using GLOP (Recommended solver). + GLOP_LINEAR_PROGRAMMING = 2, #endif #ifdef USE_GUROBI - /** Linear Programming solver using GUROBI. */ - GUROBI_LINEAR_PROGRAMMING = 6, + /// Linear Programming solver using GUROBI. + GUROBI_LINEAR_PROGRAMMING = 6, #endif #ifdef USE_CPLEX - /** Linear Programming solver using CPLEX. */ - CPLEX_LINEAR_PROGRAMMING = 10, + /// Linear Programming solver using CPLEX. + CPLEX_LINEAR_PROGRAMMING = 10, #endif // Integer programming problems. #ifdef USE_SCIP - /** Mixed integer Programming Solver using SCIP. (Recommended for problems - with continous variables) */ - SCIP_MIXED_INTEGER_PROGRAMMING = 3, // Recommended default value. + /// Mixed integer Programming Solver using SCIP. + SCIP_MIXED_INTEGER_PROGRAMMING = 3, // Recommended default value. #endif #ifdef USE_GLPK - /** Mixed integer Programming Solver using SCIP. */ - GLPK_MIXED_INTEGER_PROGRAMMING = 4, + /// Mixed integer Programming Solver using SCIP. + GLPK_MIXED_INTEGER_PROGRAMMING = 4, #endif #ifdef USE_CBC - /** Mixed integer Programming Solver using Coin CBC. */ - CBC_MIXED_INTEGER_PROGRAMMING = 5, + /// Mixed integer Programming Solver using Coin CBC. + CBC_MIXED_INTEGER_PROGRAMMING = 5, #endif #if defined(USE_GUROBI) - /** Mixed integer Programming Solver using GUROBI. */ - GUROBI_MIXED_INTEGER_PROGRAMMING = 7, + /// Mixed integer Programming Solver using GUROBI. + GUROBI_MIXED_INTEGER_PROGRAMMING = 7, #endif #if defined(USE_CPLEX) - /** Mixed integer Programming Solver using CPLEX. */ - CPLEX_MIXED_INTEGER_PROGRAMMING = 11, + /// Mixed integer Programming Solver using CPLEX. + CPLEX_MIXED_INTEGER_PROGRAMMING = 11, #endif #if defined(USE_BOP) - /** Linear Boolean Programming Solver. */ - BOP_INTEGER_PROGRAMMING = 12, + /// Linear Boolean Programming Solver. + BOP_INTEGER_PROGRAMMING = 12, #endif - }; + }; - /** + /** * Create a solver with the given name and underlying solver backend. */ MPSolver(const std::string& name, OptimizationProblemType problem_type); @@ -264,7 +261,7 @@ class MPSolver { return problem_type_; // Set at construction. } - /** + /** * Clears the objective (including the optimization direction), all variables * and constraints. All the other properties of the MPSolver (like the time * limit) are kept untouched. @@ -298,18 +295,18 @@ class MPSolver { */ MPVariable* MakeVar(double lb, double ub, bool integer, const std::string& name); - + /** * Creates a continuous variable. */ MPVariable* MakeNumVar(double lb, double ub, const std::string& name); - /** + /** * Creates an integer variable. */ MPVariable* MakeIntVar(double lb, double ub, const std::string& name); - /** + /** * Creates a boolean variable. */ MPVariable* MakeBoolVar(const std::string& name); @@ -331,7 +328,7 @@ class MPSolver { void MakeVarArray(int nb, double lb, double ub, bool integer, const std::string& name_prefix, std::vector* vars); - + /** * Creates an array of continuous variables. */ @@ -355,9 +352,9 @@ class MPSolver { */ int NumConstraints() const { return constraints_.size(); } - /** - * Returns the array of constraints handled by the MPSolver. - * + /** + * Returns the array of constraints handled by the MPSolver. + * * They are listed in the order in which they were created. */ const std::vector& constraints() const { return constraints_; } @@ -572,13 +569,13 @@ class MPSolver { * The response must be in OPTIMAL or FEASIBLE status. * * Returns a non-OK status if a problem arised (typically, if it wasn't used - * like it should be): + * like it should be): * - loading a solution whose variables don't correspond to the solver's - current variables + * current variables * - loading a solution with a status other than OPTIMAL / FEASIBLE. * * Note: the objective value isn't checked. You can use VerifySolution() for - * that. + * that. */ util::Status LoadSolutionFromProto( const MPSolutionResponse& response, @@ -611,6 +608,7 @@ class MPSolver { * enable multi-threading via SetSolverSpecificParametersAsString(). */ util::Status SetNumThreads(int num_threads); + /** * Returns the number of threads to be used during solve. */ @@ -621,7 +619,7 @@ class MPSolver { * * The format is solver-specific and is the same as the corresponding solver * configuration file format. Returns true if the operation was successful. - * + * * TODO(user): Currently SCIP will always return true even if the format is * wrong (you can check the log if you suspect an issue there). This seems to * be a bug in SCIP though. @@ -644,6 +642,23 @@ class MPSolver { * try to return a solution "close" to this assignment in case of multiple * optimal solutions. */ + // MOE:begin_strip + // As of 2018-08, this is only used by SCIP, BOP, Gurobi, GLIP, with various + // behaviors, and ignored by other solvers. Contact or-core-team@ for details. + // In particular, SCIP 6.0 is using the hint in the following way: + // 1. If the hint is complete (i.e., all variables have assigned values) it is + // used as the first incumbent. Consequently, if the hint is infeasible + // (any linear constraint *or* any integrality constraint is violated), + // the hint is disregarded. + // 2. If the hint is partial, SCIP creates a sub-MIP with the variables fixed + // to the values from the hint. Consequently, if the hint results in + // an immediate infeasibility, it is disregarded. Otherwise, SCIP tries + // to solve the sub-MIP by running a restricted "sub-SCIP" (i.e., no + // costly presolve, no cuts, limited heuristics, small time/node limits). + // If the sub-SCIP finds a solution it will be added as an incumbent + // (if not, nothing happens). Finally, SCIP proceeds to solve the entire + // model as usual. + // MOE:end_strip void SetHint(std::vector > hint); /** @@ -673,9 +688,9 @@ class MPSolver { const std::vector& variable_statuses, const std::vector& constraint_statuses); - /** + /** * Infinity. - * + * * You can use -MPSolver::infinity() for negative infinity. */ static double infinity() { return std::numeric_limits::infinity(); } @@ -711,7 +726,7 @@ class MPSolver { /** * Returns the number of branch-and-bound nodes evaluated during the solve. - * + * * Only available for discrete problems. */ int64 nodes() const; @@ -917,34 +932,34 @@ inline std::string AbslUnparseFlag( */ class MPObjective { public: - /** - * Clears the offset, all variables and coefficients, and the optimization - * direction. - */ - void Clear(); + /** + * Clears the offset, all variables and coefficients, and the optimization + * direction. + */ + void Clear(); - /** - * Sets the coefficient of the variable in the objective. - * - * If the variable does not belong to the solver, the function just returns, - * or crashes in non-opt mode. - */ - void SetCoefficient(const MPVariable *const var, double coeff); + /** + * Sets the coefficient of the variable in the objective. + * + * If the variable does not belong to the solver, the function just returns, + * or crashes in non-opt mode. + */ + void SetCoefficient(const MPVariable* const var, double coeff); - /** - * Gets the coefficient of a given variable in the objective - * - * It returns 0 if the variable does not appear in the objective). - */ - double GetCoefficient(const MPVariable *const var) const; + /** + * Gets the coefficient of a given variable in the objective + * + * It returns 0 if the variable does not appear in the objective). + */ + double GetCoefficient(const MPVariable* const var) const; - /** - * Returns a map from variables to their coefficients in the objective. - * - * If a variable is not present in the map, then its coefficient is zero. - */ - const absl::flat_hash_map &terms() const { - return coefficients_; + /** + * Returns a map from variables to their coefficients in the objective. + * + * If a variable is not present in the map, then its coefficient is zero. + */ + const absl::flat_hash_map& terms() const { + return coefficients_; } /** @@ -1111,7 +1126,7 @@ class MPVariable { * Sets the upper bound. */ void SetUB(double ub) { SetBounds(lb_, ub); } - + /** * Sets both the lower and upper bounds. */ @@ -1132,8 +1147,9 @@ class MPVariable { double reduced_cost() const; /** - * Advanced usage: returns the basis status of the variable in the current solution (only available for continuous problems). - * + * Advanced usage: returns the basis status of the variable in the current + * solution (only available for continuous problems). + * * @see MPSolver::BasisStatus. */ MPSolver::BasisStatus basis_status() const; @@ -1199,7 +1215,7 @@ class MPVariable { /** * The class for constraints of a Mathematical Programming (MP) model. - * + * * A constraint is represented as a linear equation or inequality. */ class MPConstraint { @@ -1230,7 +1246,7 @@ class MPConstraint { /** * Returns a map from variables to their coefficients in the constraint. - * + * * If a variable is not present in the map, then its coefficient is zero. */ const absl::flat_hash_map& terms() const { @@ -1270,7 +1286,8 @@ class MPConstraint { /** * Advanced usage: sets the constraint "laziness". * - * This is only supported for SCIP and has no effect on other solvers. + * This is only supported for SCIP and has no effect on other + * solvers. * * When \b laziness is true, the constraint is only considered by the Linear * Programming solver if its current solution violates the constraint. In this @@ -1403,162 +1420,161 @@ class MPConstraint { */ class MPSolverParameters { public: - /** - * Enumeration of parameters that take continuous values. - */ - enum DoubleParam { - /** - * Limit for relative MIP gap. - */ - RELATIVE_MIP_GAP = 0, + /** + * Enumeration of parameters that take continuous values. + */ + enum DoubleParam { + /** + * Limit for relative MIP gap. + */ + RELATIVE_MIP_GAP = 0, - /**Advanced usage: tolerance for primal feasibility of basic solutions. - * - * This does not control the integer feasibility tolerance of integer - * solutions for MIP or the tolerance used during presolve. - */ - PRIMAL_TOLERANCE = 1, - /** - * Advanced usage: tolerance for dual feasibility of basic solutions. - */ - DUAL_TOLERANCE = 2 - }; + /**Advanced usage: tolerance for primal feasibility of basic solutions. + * + * This does not control the integer feasibility tolerance of integer + * solutions for MIP or the tolerance used during presolve. + */ + PRIMAL_TOLERANCE = 1, + /** + * Advanced usage: tolerance for dual feasibility of basic solutions. + */ + DUAL_TOLERANCE = 2 + }; - /** - * Enumeration of parameters that take integer or categorical values. - */ - enum IntegerParam { - /** - * Advanced usage: presolve mode. - */ - PRESOLVE = 1000, - /** - * Algorithm to solve linear programs. - */ - LP_ALGORITHM = 1001, - /** - * Advanced usage: incrementality from one solve to the next. - */ - INCREMENTALITY = 1002, - /** - * Advanced usage: enable or disable matrix scaling. - */ - SCALING = 1003 - }; + /** + * Enumeration of parameters that take integer or categorical values. + */ + enum IntegerParam { + /** + * Advanced usage: presolve mode. + */ + PRESOLVE = 1000, + /** + * Algorithm to solve linear programs. + */ + LP_ALGORITHM = 1001, + /** + * Advanced usage: incrementality from one solve to the next. + */ + INCREMENTALITY = 1002, + /** + * Advanced usage: enable or disable matrix scaling. + */ + SCALING = 1003 + }; - /** - * For each categorical parameter, enumeration of possible values. - */ - enum PresolveValues { - PRESOLVE_OFF = 0, // Presolve is off. - PRESOLVE_ON = 1 // Presolve is on. - }; + /** + * For each categorical parameter, enumeration of possible values. + */ + enum PresolveValues { + PRESOLVE_OFF = 0, // Presolve is off. + PRESOLVE_ON = 1 // Presolve is on. + }; - /** - * LP algorithm to use. - */ - enum LpAlgorithmValues { - DUAL = 10, // Dual simplex. - PRIMAL = 11, // Primal simplex. - BARRIER = 12 // Barrier algorithm. - }; + /** + * LP algorithm to use. + */ + enum LpAlgorithmValues { + DUAL = 10, // Dual simplex. + PRIMAL = 11, // Primal simplex. + BARRIER = 12 // Barrier algorithm. + }; - /** - * Advanced usage: Incrementality options. - */ - enum IncrementalityValues { - /** - * Start solve from scratch. - */ - INCREMENTALITY_OFF = 0, + /** + * Advanced usage: Incrementality options. + */ + enum IncrementalityValues { + /** + * Start solve from scratch. + */ + INCREMENTALITY_OFF = 0, - /** - * Reuse results from previous solve as much as the underlying solver - * allows. - */ - INCREMENTALITY_ON = 1 - }; + /** + * Reuse results from previous solve as much as the underlying solver + * allows. + */ + INCREMENTALITY_ON = 1 + }; /** * Advanced usage: Scaling options. */ - enum ScalingValues { - /// Scaling is off. - SCALING_OFF = 0, - /// Scaling is on. - SCALING_ON = 1 - }; + enum ScalingValues { + /// Scaling is off. + SCALING_OFF = 0, + /// Scaling is on. + SCALING_ON = 1 + }; - // @{ - // Placeholder value to indicate that a parameter is set to - // the default value defined in the wrapper. - static const double kDefaultDoubleParamValue; - static const int kDefaultIntegerParamValue; - // @} + // @{ + // Placeholder value to indicate that a parameter is set to + // the default value defined in the wrapper. + static const double kDefaultDoubleParamValue; + static const int kDefaultIntegerParamValue; + // @} - // @{ - // Placeholder value to indicate that a parameter is unknown. - static const double kUnknownDoubleParamValue; - static const int kUnknownIntegerParamValue; - // @} + // @{ + // Placeholder value to indicate that a parameter is unknown. + static const double kUnknownDoubleParamValue; + static const int kUnknownIntegerParamValue; + // @} - // @{ - // Default values for parameters. Only parameters that define the - // properties of the solution returned need to have a default value - // (that is the same for all solvers). You can also define a default - // value for performance parameters when you are confident it is a - // good choice (example: always turn presolve on). - static const double kDefaultRelativeMipGap; - static const double kDefaultPrimalTolerance; - static const double kDefaultDualTolerance; - static const PresolveValues kDefaultPresolve; - static const IncrementalityValues kDefaultIncrementality; - // @} + // @{ + // Default values for parameters. Only parameters that define the + // properties of the solution returned need to have a default value + // (that is the same for all solvers). You can also define a default + // value for performance parameters when you are confident it is a + // good choice (example: always turn presolve on). + static const double kDefaultRelativeMipGap; + static const double kDefaultPrimalTolerance; + static const double kDefaultDualTolerance; + static const PresolveValues kDefaultPresolve; + static const IncrementalityValues kDefaultIncrementality; + // @} - /** - * The constructor sets all parameters to their default value. - */ - MPSolverParameters(); + /** + * The constructor sets all parameters to their default value. + */ + MPSolverParameters(); - /** - * Sets a double parameter to a specific value. - */ - void SetDoubleParam(MPSolverParameters::DoubleParam param, double value); - /** - * Sets a integer parameter to a specific value. - */ - void SetIntegerParam(MPSolverParameters::IntegerParam param, int value); + /** + * Sets a double parameter to a specific value. + */ + void SetDoubleParam(MPSolverParameters::DoubleParam param, double value); + /** + * Sets a integer parameter to a specific value. + */ + void SetIntegerParam(MPSolverParameters::IntegerParam param, int value); - /** - * Sets a double parameter to its default value (default value defined in - * MPSolverParameters if it exists, otherwise the default value defined in - * the underlying solver). - */ + /** + * Sets a double parameter to its default value (default value defined in + * MPSolverParameters if it exists, otherwise the default value defined in + * the underlying solver). + */ - void ResetDoubleParam(MPSolverParameters::DoubleParam param); - /** - * Sets an integer parameter to its default value (default value defined in - * MPSolverParameters if it exists, otherwise the default value defined in - * the underlying solver). - */ - void ResetIntegerParam(MPSolverParameters::IntegerParam param); - /** - * Sets all parameters to their default value. - */ - void Reset(); + void ResetDoubleParam(MPSolverParameters::DoubleParam param); + /** + * Sets an integer parameter to its default value (default value defined in + * MPSolverParameters if it exists, otherwise the default value defined in + * the underlying solver). + */ + void ResetIntegerParam(MPSolverParameters::IntegerParam param); + /** + * Sets all parameters to their default value. + */ + void Reset(); - /** - * Returns the value of a double parameter. - */ - double GetDoubleParam(MPSolverParameters::DoubleParam param) const; + /** + * Returns the value of a double parameter. + */ + double GetDoubleParam(MPSolverParameters::DoubleParam param) const; - /** - * Returns the value of an integer parameter. - */ - int GetIntegerParam(MPSolverParameters::IntegerParam param) const; + /** + * Returns the value of an integer parameter. + */ + int GetIntegerParam(MPSolverParameters::IntegerParam param) const; private: - // @{ // Parameter value for each parameter. // @see DoubleParam // @see IntegerParam @@ -1569,7 +1585,6 @@ class MPSolverParameters { int scaling_value_; int lp_algorithm_value_; int incrementality_value_; - // @} // Boolean value indicating whether each parameter is set to the // solver's default value. Only parameters for which the wrapper