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. 9 package com.google.ortools.linearsolver;
11 import java.lang.reflect.*;
19 private transient long swigCPtr;
20 protected transient boolean swigCMemOwn;
23 swigCMemOwn = cMemoryOwn;
28 return (obj ==
null) ? 0 : obj.swigCPtr;
31 @SuppressWarnings(
"deprecation")
32 protected
void finalize() {
36 public synchronized void delete() {
40 main_research_linear_solverJNI.delete_MPConstraint(swigCPtr);
50 return main_research_linear_solverJNI.MPConstraint_name(swigCPtr,
this);
60 main_research_linear_solverJNI.MPConstraint_setCoefficient(swigCPtr,
this,
MPVariable.getCPtr(var), var, coeff);
68 return main_research_linear_solverJNI.MPConstraint_getCoefficient(swigCPtr,
this,
MPVariable.getCPtr(var), var);
75 return main_research_linear_solverJNI.MPConstraint_lb(swigCPtr,
this);
82 return main_research_linear_solverJNI.MPConstraint_ub(swigCPtr,
this);
89 main_research_linear_solverJNI.MPConstraint_setLb(swigCPtr,
this,
lb);
96 main_research_linear_solverJNI.MPConstraint_setUb(swigCPtr,
this,
ub);
103 main_research_linear_solverJNI.MPConstraint_setBounds(swigCPtr,
this,
lb,
ub);
110 return main_research_linear_solverJNI.MPConstraint_isLazy(swigCPtr,
this);
126 main_research_linear_solverJNI.MPConstraint_setIsLazy(swigCPtr,
this, laziness);
133 return main_research_linear_solverJNI.MPConstraint_index(swigCPtr,
this);
141 return main_research_linear_solverJNI.MPConstraint_dualValue(swigCPtr,
this);
+
Go to the documentation of this file. 9 package com.google.ortools.linearsolver;
11 import java.lang.reflect.*;
19 private transient long swigCPtr;
20 protected transient boolean swigCMemOwn;
23 swigCMemOwn = cMemoryOwn;
28 return (obj ==
null) ? 0 : obj.swigCPtr;
31 @SuppressWarnings(
"deprecation")
32 protected
void finalize() {
36 public synchronized void delete() {
40 main_research_linear_solverJNI.delete_MPConstraint(swigCPtr);
50 return main_research_linear_solverJNI.MPConstraint_name(swigCPtr,
this);
60 main_research_linear_solverJNI.MPConstraint_setCoefficient(swigCPtr,
this,
MPVariable.getCPtr(var), var, coeff);
68 return main_research_linear_solverJNI.MPConstraint_getCoefficient(swigCPtr,
this,
MPVariable.getCPtr(var), var);
75 return main_research_linear_solverJNI.MPConstraint_lb(swigCPtr,
this);
82 return main_research_linear_solverJNI.MPConstraint_ub(swigCPtr,
this);
89 main_research_linear_solverJNI.MPConstraint_setLb(swigCPtr,
this,
lb);
96 main_research_linear_solverJNI.MPConstraint_setUb(swigCPtr,
this,
ub);
103 main_research_linear_solverJNI.MPConstraint_setBounds(swigCPtr,
this,
lb,
ub);
110 return main_research_linear_solverJNI.MPConstraint_isLazy(swigCPtr,
this);
127 main_research_linear_solverJNI.MPConstraint_setIsLazy(swigCPtr,
this, laziness);
134 return main_research_linear_solverJNI.MPConstraint_index(swigCPtr,
this);
142 return main_research_linear_solverJNI.MPConstraint_dualValue(swigCPtr,
this);
-
+
-
+
-
+
-
+
-
+
-
+
-
Go to the documentation of this file. 9 package com.google.ortools.linearsolver;
11 import java.lang.reflect.*;
18 private transient long swigCPtr;
19 protected transient boolean swigCMemOwn;
21 protected MPSolver(
long cPtr,
boolean cMemoryOwn) {
22 swigCMemOwn = cMemoryOwn;
26 protected static long getCPtr(
MPSolver obj) {
27 return (obj ==
null) ? 0 : obj.swigCPtr;
30 @SuppressWarnings(
"deprecation")
31 protected
void finalize() {
35 public synchronized void delete() {
39 main_research_linear_solverJNI.delete_MPSolver(swigCPtr);
47 for (
int i = 0; i < count; ++i) {
48 array[i] =
makeVar(lb, ub, integer,
"");
56 for (
int i = 0; i < count; ++i) {
57 array[i] =
makeVar(lb, ub, integer, var_name + i);
90 this(main_research_linear_solverJNI.new_MPSolver(name, problem_type.swigValue()),
true);
98 return main_research_linear_solverJNI.MPSolver_supportsProblemType(problem_type.swigValue());
107 main_research_linear_solverJNI.MPSolver_clear(swigCPtr,
this);
114 return main_research_linear_solverJNI.MPSolver_numVariables(swigCPtr,
this);
122 return main_research_linear_solverJNI.MPSolver_variables(swigCPtr,
this);
131 long cPtr = main_research_linear_solverJNI.MPSolver_lookupVariableOrNull(swigCPtr,
this, var_name);
132 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
143 long cPtr = main_research_linear_solverJNI.MPSolver_makeVar(swigCPtr,
this, lb, ub, integer, name);
144 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
151 long cPtr = main_research_linear_solverJNI.MPSolver_makeNumVar(swigCPtr,
this, lb, ub, name);
152 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
159 long cPtr = main_research_linear_solverJNI.MPSolver_makeIntVar(swigCPtr,
this, lb, ub, name);
160 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
167 long cPtr = main_research_linear_solverJNI.MPSolver_makeBoolVar(swigCPtr,
this, name);
168 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
175 return main_research_linear_solverJNI.MPSolver_numConstraints(swigCPtr,
this);
184 return main_research_linear_solverJNI.MPSolver_constraints(swigCPtr,
this);
195 long cPtr = main_research_linear_solverJNI.MPSolver_lookupConstraintOrNull(swigCPtr,
this, constraint_name);
196 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
208 long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_0(swigCPtr,
this, lb, ub);
209 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
216 long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_1(swigCPtr,
this);
217 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
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);
232 long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_3(swigCPtr,
this, name);
233 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
240 long cPtr = main_research_linear_solverJNI.MPSolver_objective(swigCPtr,
this);
241 return (cPtr == 0) ? null :
new MPObjective(cPtr,
false);
265 return main_research_linear_solverJNI.MPSolver_computeConstraintActivities(swigCPtr,
this);
287 return main_research_linear_solverJNI.MPSolver_verifySolution(swigCPtr,
this, tolerance, log_errors);
299 main_research_linear_solverJNI.MPSolver_reset(swigCPtr,
this);
311 return main_research_linear_solverJNI.MPSolver_interruptSolve(swigCPtr,
this);
346 return new SWIGTYPE_p_util__Status(main_research_linear_solverJNI.MPSolver_loadSolutionFromProto__SWIG_0(swigCPtr,
this, response.toByteArray(), tolerance),
true);
381 return new SWIGTYPE_p_util__Status(main_research_linear_solverJNI.MPSolver_loadSolutionFromProto__SWIG_1(swigCPtr,
this, response.toByteArray()),
true);
395 return main_research_linear_solverJNI.MPSolver_setSolverSpecificParametersAsString(swigCPtr,
this, parameters);
404 return main_research_linear_solverJNI.MPSolver_infinity();
411 main_research_linear_solverJNI.MPSolver_enableOutput(swigCPtr,
this);
418 main_research_linear_solverJNI.MPSolver_suppressOutput(swigCPtr,
this);
425 return main_research_linear_solverJNI.MPSolver_iterations(swigCPtr,
this);
434 return main_research_linear_solverJNI.MPSolver_nodes(swigCPtr,
this);
462 return main_research_linear_solverJNI.MPSolver_computeExactConditionNumber(swigCPtr,
this);
466 main_research_linear_solverJNI.MPSolver_setTimeLimit(swigCPtr,
this, time_limit_milliseconds);
470 return main_research_linear_solverJNI.MPSolver_wallTime(swigCPtr,
this);
474 return main_research_linear_solverJNI.MPSolver_loadModelFromProto(swigCPtr,
this, input_model.toByteArray());
478 return main_research_linear_solverJNI.MPSolver_loadModelFromProtoWithUniqueNamesOrDie(swigCPtr,
this, input_model.toByteArray());
482 byte[] buf = main_research_linear_solverJNI.MPSolver_exportModelToProto(swigCPtr,
this);
483 if (buf ==
null || buf.length == 0) {
488 }
catch (
com.
google.protobuf.InvalidProtocolBufferException e) {
489 throw new RuntimeException(
490 "Unable to parse com.google.ortools.linearsolver.MPModelProto protocol message.");
495 byte[] buf = main_research_linear_solverJNI.MPSolver_createSolutionResponseProto(swigCPtr,
this);
496 if (buf ==
null || buf.length == 0) {
501 }
catch (
com.
google.protobuf.InvalidProtocolBufferException e) {
502 throw new RuntimeException(
503 "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
508 byte[] buf = main_research_linear_solverJNI.MPSolver_solveWithProto(model_request.toByteArray());
509 if (buf ==
null || buf.length == 0) {
514 }
catch (
com.
google.protobuf.InvalidProtocolBufferException e) {
515 throw new RuntimeException(
516 "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
521 return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_0(swigCPtr,
this,
MPModelExportOptions.getCPtr(options), options);
525 return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_1(swigCPtr,
this);
529 return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_0(swigCPtr,
this,
MPModelExportOptions.getCPtr(options), options);
533 return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_1(swigCPtr,
this);
540 main_research_linear_solverJNI.MPSolver_setHint(swigCPtr,
this,
variables, values);
547 return main_research_linear_solverJNI.MPSolver_setNumThreads(swigCPtr,
this, num_theads);
580 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
581 return swigValues[swigValue];
583 if (swigEnum.swigValue == swigValue)
588 @SuppressWarnings(
"unused")
590 this.swigValue = SwigNext.next++;
593 @SuppressWarnings(
"unused")
594 private OptimizationProblemType(
int swigValue) {
595 this.swigValue = swigValue;
596 SwigNext.next = swigValue+1;
599 @SuppressWarnings(
"unused")
600 private OptimizationProblemType(OptimizationProblemType swigEnum) {
601 this.swigValue = swigEnum.swigValue;
602 SwigNext.next = this.swigValue+1;
605 private final int swigValue;
607 private static class SwigNext {
608 private static int next = 0;
642 NOT_SOLVED(main_research_linear_solverJNI.MPSolver_NOT_SOLVED_get());
650 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
651 return swigValues[swigValue];
653 if (swigEnum.swigValue == swigValue)
655 throw new IllegalArgumentException(
"No enum " +
ResultStatus.class +
" with value " + swigValue);
658 @SuppressWarnings(
"unused")
660 this.swigValue = SwigNext.next++;
663 @SuppressWarnings(
"unused")
664 private ResultStatus(
int swigValue) {
665 this.swigValue = swigValue;
666 SwigNext.next = swigValue+1;
669 @SuppressWarnings(
"unused")
670 private ResultStatus(ResultStatus swigEnum) {
671 this.swigValue = swigEnum.swigValue;
672 SwigNext.next = this.swigValue+1;
675 private final int swigValue;
677 private static class SwigNext {
678 private static int next = 0;
687 FREE(main_research_linear_solverJNI.MPSolver_FREE_get()),
699 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
700 return swigValues[swigValue];
702 if (swigEnum.swigValue == swigValue)
704 throw new IllegalArgumentException(
"No enum " +
BasisStatus.class +
" with value " + swigValue);
707 @SuppressWarnings(
"unused")
709 this.swigValue = SwigNext.next++;
712 @SuppressWarnings(
"unused")
713 private BasisStatus(
int swigValue) {
714 this.swigValue = swigValue;
715 SwigNext.next = swigValue+1;
718 @SuppressWarnings(
"unused")
719 private BasisStatus(BasisStatus swigEnum) {
720 this.swigValue = swigEnum.swigValue;
721 SwigNext.next = this.swigValue+1;
724 private final int swigValue;
726 private static class SwigNext {
727 private static int next = 0;
-
-
-
-
+
Go to the documentation of this file. 9 package com.google.ortools.linearsolver;
11 import java.lang.reflect.*;
18 private transient long swigCPtr;
19 protected transient boolean swigCMemOwn;
21 protected MPSolver(
long cPtr,
boolean cMemoryOwn) {
22 swigCMemOwn = cMemoryOwn;
26 protected static long getCPtr(
MPSolver obj) {
27 return (obj ==
null) ? 0 : obj.swigCPtr;
30 @SuppressWarnings(
"deprecation")
31 protected
void finalize() {
35 public synchronized void delete() {
39 main_research_linear_solverJNI.delete_MPSolver(swigCPtr);
50 for (
int i = 0; i < count; ++i) {
51 array[i] =
makeVar(lb, ub, integer,
"");
62 for (
int i = 0; i < count; ++i) {
63 array[i] =
makeVar(lb, ub, integer, var_name + i);
96 this(main_research_linear_solverJNI.new_MPSolver(name, problem_type.swigValue()),
true);
104 return main_research_linear_solverJNI.MPSolver_supportsProblemType(problem_type.swigValue());
113 main_research_linear_solverJNI.MPSolver_clear(swigCPtr,
this);
120 return main_research_linear_solverJNI.MPSolver_numVariables(swigCPtr,
this);
128 return main_research_linear_solverJNI.MPSolver_variables(swigCPtr,
this);
137 long cPtr = main_research_linear_solverJNI.MPSolver_lookupVariableOrNull(swigCPtr,
this, var_name);
138 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
149 long cPtr = main_research_linear_solverJNI.MPSolver_makeVar(swigCPtr,
this, lb, ub, integer, name);
150 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
157 long cPtr = main_research_linear_solverJNI.MPSolver_makeNumVar(swigCPtr,
this, lb, ub, name);
158 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
165 long cPtr = main_research_linear_solverJNI.MPSolver_makeIntVar(swigCPtr,
this, lb, ub, name);
166 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
173 long cPtr = main_research_linear_solverJNI.MPSolver_makeBoolVar(swigCPtr,
this, name);
174 return (cPtr == 0) ? null :
new MPVariable(cPtr,
false);
181 return main_research_linear_solverJNI.MPSolver_numConstraints(swigCPtr,
this);
190 return main_research_linear_solverJNI.MPSolver_constraints(swigCPtr,
this);
201 long cPtr = main_research_linear_solverJNI.MPSolver_lookupConstraintOrNull(swigCPtr,
this, constraint_name);
202 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
214 long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_0(swigCPtr,
this, lb, ub);
215 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
222 long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_1(swigCPtr,
this);
223 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
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);
238 long cPtr = main_research_linear_solverJNI.MPSolver_makeConstraint__SWIG_3(swigCPtr,
this, name);
239 return (cPtr == 0) ? null :
new MPConstraint(cPtr,
false);
246 long cPtr = main_research_linear_solverJNI.MPSolver_objective(swigCPtr,
this);
247 return (cPtr == 0) ? null :
new MPObjective(cPtr,
false);
271 return main_research_linear_solverJNI.MPSolver_computeConstraintActivities(swigCPtr,
this);
293 return main_research_linear_solverJNI.MPSolver_verifySolution(swigCPtr,
this, tolerance, log_errors);
305 main_research_linear_solverJNI.MPSolver_reset(swigCPtr,
this);
317 return main_research_linear_solverJNI.MPSolver_interruptSolve(swigCPtr,
this);
331 return main_research_linear_solverJNI.MPSolver_setSolverSpecificParametersAsString(swigCPtr,
this, parameters);
340 return main_research_linear_solverJNI.MPSolver_infinity();
347 main_research_linear_solverJNI.MPSolver_enableOutput(swigCPtr,
this);
354 main_research_linear_solverJNI.MPSolver_suppressOutput(swigCPtr,
this);
361 return main_research_linear_solverJNI.MPSolver_iterations(swigCPtr,
this);
370 return main_research_linear_solverJNI.MPSolver_nodes(swigCPtr,
this);
398 return main_research_linear_solverJNI.MPSolver_computeExactConditionNumber(swigCPtr,
this);
402 main_research_linear_solverJNI.MPSolver_setTimeLimit(swigCPtr,
this, time_limit_milliseconds);
406 return main_research_linear_solverJNI.MPSolver_wallTime(swigCPtr,
this);
414 return main_research_linear_solverJNI.MPSolver_loadModelFromProto(swigCPtr,
this, input_model.toByteArray());
418 return main_research_linear_solverJNI.MPSolver_loadModelFromProtoWithUniqueNamesOrDie(swigCPtr,
this, input_model.toByteArray());
425 byte[] buf = main_research_linear_solverJNI.MPSolver_exportModelToProto(swigCPtr,
this);
426 if (buf ==
null || buf.length == 0) {
431 }
catch (
com.
google.protobuf.InvalidProtocolBufferException e) {
432 throw new RuntimeException(
433 "Unable to parse com.google.ortools.linearsolver.MPModelProto protocol message.");
441 byte[] buf = main_research_linear_solverJNI.MPSolver_createSolutionResponseProto(swigCPtr,
this);
442 if (buf ==
null || buf.length == 0) {
447 }
catch (
com.
google.protobuf.InvalidProtocolBufferException e) {
448 throw new RuntimeException(
449 "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
485 return main_research_linear_solverJNI.MPSolver_loadSolutionFromProto(swigCPtr,
this, response.toByteArray());
492 byte[] buf = main_research_linear_solverJNI.MPSolver_solveWithProto(model_request.toByteArray());
493 if (buf ==
null || buf.length == 0) {
498 }
catch (
com.
google.protobuf.InvalidProtocolBufferException e) {
499 throw new RuntimeException(
500 "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
508 return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_0(swigCPtr,
this,
MPModelExportOptions.getCPtr(options), options);
515 return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_1(swigCPtr,
this);
522 return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_0(swigCPtr,
this,
MPModelExportOptions.getCPtr(options), options);
529 return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_1(swigCPtr,
this);
546 main_research_linear_solverJNI.MPSolver_setHint(swigCPtr,
this,
variables, values);
553 return main_research_linear_solverJNI.MPSolver_setNumThreads(swigCPtr,
this, num_theads);
586 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
587 return swigValues[swigValue];
589 if (swigEnum.swigValue == swigValue)
594 @SuppressWarnings(
"unused")
596 this.swigValue = SwigNext.next++;
599 @SuppressWarnings(
"unused")
600 private OptimizationProblemType(
int swigValue) {
601 this.swigValue = swigValue;
602 SwigNext.next = swigValue+1;
605 @SuppressWarnings(
"unused")
606 private OptimizationProblemType(OptimizationProblemType swigEnum) {
607 this.swigValue = swigEnum.swigValue;
608 SwigNext.next = this.swigValue+1;
611 private final int swigValue;
613 private static class SwigNext {
614 private static int next = 0;
648 NOT_SOLVED(main_research_linear_solverJNI.MPSolver_NOT_SOLVED_get());
656 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
657 return swigValues[swigValue];
659 if (swigEnum.swigValue == swigValue)
661 throw new IllegalArgumentException(
"No enum " +
ResultStatus.class +
" with value " + swigValue);
664 @SuppressWarnings(
"unused")
666 this.swigValue = SwigNext.next++;
669 @SuppressWarnings(
"unused")
670 private ResultStatus(
int swigValue) {
671 this.swigValue = swigValue;
672 SwigNext.next = swigValue+1;
675 @SuppressWarnings(
"unused")
676 private ResultStatus(ResultStatus swigEnum) {
677 this.swigValue = swigEnum.swigValue;
678 SwigNext.next = this.swigValue+1;
681 private final int swigValue;
683 private static class SwigNext {
684 private static int next = 0;
693 FREE(main_research_linear_solverJNI.MPSolver_FREE_get()),
705 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
706 return swigValues[swigValue];
708 if (swigEnum.swigValue == swigValue)
710 throw new IllegalArgumentException(
"No enum " +
BasisStatus.class +
" with value " + swigValue);
713 @SuppressWarnings(
"unused")
715 this.swigValue = SwigNext.next++;
718 @SuppressWarnings(
"unused")
719 private BasisStatus(
int swigValue) {
720 this.swigValue = swigValue;
721 SwigNext.next = swigValue+1;
724 @SuppressWarnings(
"unused")
725 private BasisStatus(BasisStatus swigEnum) {
726 this.swigValue = swigEnum.swigValue;
727 SwigNext.next = this.swigValue+1;
730 private final int swigValue;
732 private static class SwigNext {
733 private static int next = 0;
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
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. 9 package com.google.ortools.linearsolver;
11 import java.lang.reflect.*;
17 private transient long swigCPtr;
18 protected transient boolean swigCMemOwn;
21 swigCMemOwn = cMemoryOwn;
25 protected static long getCPtr(
MPVariable obj) {
26 return (obj ==
null) ? 0 : obj.swigCPtr;
29 @SuppressWarnings(
"deprecation")
30 protected
void finalize() {
34 public synchronized void delete() {
38 main_research_linear_solverJNI.delete_MPVariable(swigCPtr);
48 return main_research_linear_solverJNI.MPVariable_name(swigCPtr,
this);
55 main_research_linear_solverJNI.MPVariable_setInteger(swigCPtr,
this, integer);
66 return main_research_linear_solverJNI.MPVariable_solutionValue(swigCPtr,
this);
73 return main_research_linear_solverJNI.MPVariable_index(swigCPtr,
this);
80 return main_research_linear_solverJNI.MPVariable_lb(swigCPtr,
this);
87 return main_research_linear_solverJNI.MPVariable_ub(swigCPtr,
this);
94 main_research_linear_solverJNI.MPVariable_setLb(swigCPtr,
this,
lb);
101 main_research_linear_solverJNI.MPVariable_setUb(swigCPtr,
this,
ub);
108 main_research_linear_solverJNI.MPVariable_setBounds(swigCPtr,
this,
lb,
ub);
116 return main_research_linear_solverJNI.MPVariable_reducedCost(swigCPtr,
this);
+
Go to the documentation of this file. 9 package com.google.ortools.linearsolver;
11 import java.lang.reflect.*;
17 private transient long swigCPtr;
18 protected transient boolean swigCMemOwn;
21 swigCMemOwn = cMemoryOwn;
25 protected static long getCPtr(
MPVariable obj) {
26 return (obj ==
null) ? 0 : obj.swigCPtr;
29 @SuppressWarnings(
"deprecation")
30 protected
void finalize() {
34 public synchronized void delete() {
38 main_research_linear_solverJNI.delete_MPVariable(swigCPtr);
48 return main_research_linear_solverJNI.MPVariable_name(swigCPtr,
this);
55 main_research_linear_solverJNI.MPVariable_setInteger(swigCPtr,
this, integer);
66 return main_research_linear_solverJNI.MPVariable_solutionValue(swigCPtr,
this);
73 return main_research_linear_solverJNI.MPVariable_index(swigCPtr,
this);
80 return main_research_linear_solverJNI.MPVariable_lb(swigCPtr,
this);
87 return main_research_linear_solverJNI.MPVariable_ub(swigCPtr,
this);
94 main_research_linear_solverJNI.MPVariable_setLb(swigCPtr,
this,
lb);
101 main_research_linear_solverJNI.MPVariable_setUb(swigCPtr,
this,
ub);
108 main_research_linear_solverJNI.MPVariable_setBounds(swigCPtr,
this,
lb,
ub);
116 return main_research_linear_solverJNI.MPVariable_reducedCost(swigCPtr,
this);
-
+
-
+
-
+
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.MPSolver | inline |
| loadModelFromProto(com.google.ortools.linearsolver.MPModelProto input_model) | com.google.ortools.linearsolver.MPSolver | inline |
| loadModelFromProtoWithUniqueNamesOrDie(com.google.ortools.linearsolver.MPModelProto input_model) | com.google.ortools.linearsolver.MPSolver | inline |
- | loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response, double tolerance) | com.google.ortools.linearsolver.MPSolver | inline |
- | loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response) | com.google.ortools.linearsolver.MPSolver | inline |
- | lookupConstraintOrNull(String constraint_name) | com.google.ortools.linearsolver.MPSolver | inline |
- | lookupVariableOrNull(String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeBoolVar(String name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeBoolVarArray(int count) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeBoolVarArray(int count, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeConstraint(double lb, double ub) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeConstraint() | com.google.ortools.linearsolver.MPSolver | inline |
- | makeConstraint(double lb, double ub, String name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeConstraint(String name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeIntVar(double lb, double ub, String name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeIntVarArray(int count, double lb, double ub) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeIntVarArray(int count, double lb, double ub, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeNumVar(double lb, double ub, String name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeNumVarArray(int count, double lb, double ub) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeNumVarArray(int count, double lb, double ub, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeVar(double lb, double ub, boolean integer, String name) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeVarArray(int count, double lb, double ub, boolean integer) | com.google.ortools.linearsolver.MPSolver | inline |
- | makeVarArray(int count, double lb, double ub, boolean integer, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
- | MPSolver(long cPtr, boolean cMemoryOwn) | com.google.ortools.linearsolver.MPSolver | inlineprotected |
- | MPSolver(String name, MPSolver.OptimizationProblemType problem_type) | com.google.ortools.linearsolver.MPSolver | inline |
- | nodes() | com.google.ortools.linearsolver.MPSolver | inline |
- | numConstraints() | com.google.ortools.linearsolver.MPSolver | inline |
- | numVariables() | com.google.ortools.linearsolver.MPSolver | inline |
- | objective() | com.google.ortools.linearsolver.MPSolver | inline |
- | reset() | com.google.ortools.linearsolver.MPSolver | inline |
- | setHint(MPVariable[] variables, double[] values) | com.google.ortools.linearsolver.MPSolver | inline |
- | setNumThreads(int num_theads) | com.google.ortools.linearsolver.MPSolver | inline |
- | setSolverSpecificParametersAsString(String parameters) | com.google.ortools.linearsolver.MPSolver | inline |
- | setTimeLimit(long time_limit_milliseconds) | com.google.ortools.linearsolver.MPSolver | inline |
- | solve() | com.google.ortools.linearsolver.MPSolver | inline |
- | solve(MPSolverParameters param) | com.google.ortools.linearsolver.MPSolver | inline |
- | solveWithProto(com.google.ortools.linearsolver.MPModelRequest model_request) | com.google.ortools.linearsolver.MPSolver | inlinestatic |
- | supportsProblemType(MPSolver.OptimizationProblemType problem_type) | com.google.ortools.linearsolver.MPSolver | inlinestatic |
- | suppressOutput() | com.google.ortools.linearsolver.MPSolver | inline |
- | variables() | com.google.ortools.linearsolver.MPSolver | inline |
- | verifySolution(double tolerance, boolean log_errors) | com.google.ortools.linearsolver.MPSolver | inline |
- | wallTime() | com.google.ortools.linearsolver.MPSolver | inline |
+ | loadSolutionFromProto(com.google.ortools.linearsolver.MPSolutionResponse response) | com.google.ortools.linearsolver.MPSolver | inline |
+ | lookupConstraintOrNull(String constraint_name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | lookupVariableOrNull(String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeBoolVar(String name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeBoolVarArray(int count) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeBoolVarArray(int count, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeConstraint(double lb, double ub) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeConstraint() | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeConstraint(double lb, double ub, String name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeConstraint(String name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeIntVar(double lb, double ub, String name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeIntVarArray(int count, double lb, double ub) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeIntVarArray(int count, double lb, double ub, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeNumVar(double lb, double ub, String name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeNumVarArray(int count, double lb, double ub) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeNumVarArray(int count, double lb, double ub, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeVar(double lb, double ub, boolean integer, String name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeVarArray(int count, double lb, double ub, boolean integer) | com.google.ortools.linearsolver.MPSolver | inline |
+ | makeVarArray(int count, double lb, double ub, boolean integer, String var_name) | com.google.ortools.linearsolver.MPSolver | inline |
+ | MPSolver(long cPtr, boolean cMemoryOwn) | com.google.ortools.linearsolver.MPSolver | inlineprotected |
+ | MPSolver(String name, MPSolver.OptimizationProblemType problem_type) | com.google.ortools.linearsolver.MPSolver | inline |
+ | nodes() | com.google.ortools.linearsolver.MPSolver | inline |
+ | numConstraints() | com.google.ortools.linearsolver.MPSolver | inline |
+ | numVariables() | com.google.ortools.linearsolver.MPSolver | inline |
+ | objective() | com.google.ortools.linearsolver.MPSolver | inline |
+ | reset() | com.google.ortools.linearsolver.MPSolver | inline |
+ | setHint(MPVariable[] variables, double[] values) | com.google.ortools.linearsolver.MPSolver | inline |
+ | setNumThreads(int num_theads) | com.google.ortools.linearsolver.MPSolver | inline |
+ | setSolverSpecificParametersAsString(String parameters) | com.google.ortools.linearsolver.MPSolver | inline |
+ | setTimeLimit(long time_limit_milliseconds) | com.google.ortools.linearsolver.MPSolver | inline |
+ | solve() | com.google.ortools.linearsolver.MPSolver | inline |
+ | solve(MPSolverParameters param) | com.google.ortools.linearsolver.MPSolver | inline |
+ | solveWithProto(com.google.ortools.linearsolver.MPModelRequest model_request) | com.google.ortools.linearsolver.MPSolver | inlinestatic |
+ | supportsProblemType(MPSolver.OptimizationProblemType problem_type) | com.google.ortools.linearsolver.MPSolver | inlinestatic |
+ | suppressOutput() | com.google.ortools.linearsolver.MPSolver | inline |
+ | variables() | com.google.ortools.linearsolver.MPSolver | inline |
+ | verifySolution(double tolerance, boolean log_errors) | com.google.ortools.linearsolver.MPSolver | inline |
+ | wallTime() | com.google.ortools.linearsolver.MPSolver | inline |
@@ -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
@@ -592,7 +603,9 @@ Protected Member Functions
@@ -620,7 +633,9 @@ Protected Member Functions
@@ -647,7 +662,9 @@ Protected Member Functions
@@ -674,7 +691,9 @@ Protected Member Functions
@@ -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
-
-◆ loadSolutionFromProto() [1/2]
+
+◆ loadSolutionFromProto()
@@ -840,68 +862,7 @@ Protected Member Functions
- |
-
-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:
-
-
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]
-
-
-
-
-
-
-
-
- | SWIGTYPE_p_util__Status com.google.ortools.linearsolver.MPSolver.loadSolutionFromProto |
+ boolean com.google.ortools.linearsolver.MPSolver.loadSolutionFromProto |
( |
com.google.ortools.linearsolver.MPSolutionResponse |
response | ) |
@@ -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
@@ -1102,7 +1063,7 @@ Protected Member Functions |
@@ -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
@@ -1393,7 +1354,7 @@ Protected Member Functions
@@ -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
@@ -1533,7 +1494,7 @@ Protected Member Functions
@@ -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
@@ -1696,7 +1659,9 @@ Protected Member Functions
@@ -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
@@ -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
@@ -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
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...
|
| |
-
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
@@ -123,7 +123,7 @@ Public Attributes
@@ -140,7 +140,7 @@ Public Attributes
@@ -156,7 +156,7 @@ Public Attributes
@@ -172,7 +172,7 @@ Public Attributes
@@ -188,7 +188,7 @@ Public Attributes
@@ -204,7 +204,7 @@ Public Attributes
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
@@ -128,7 +128,7 @@ Public Attributes
@@ -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
@@ -134,7 +134,7 @@ Public Attributes
@@ -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