Java Reference

Java Reference

MPSolver.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.1
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 
326  public boolean setSolverSpecificParametersAsString(String parameters) {
327  return main_research_linear_solverJNI.MPSolver_setSolverSpecificParametersAsString(swigCPtr, this, parameters);
328  }
329 
341  public void SetStartingLpBasis(SWIGTYPE_p_std__vectorT_operations_research__MPSolver__BasisStatus_t variable_statuses, SWIGTYPE_p_std__vectorT_operations_research__MPSolver__BasisStatus_t constraint_statuses) {
342  main_research_linear_solverJNI.MPSolver_SetStartingLpBasis(swigCPtr, this, SWIGTYPE_p_std__vectorT_operations_research__MPSolver__BasisStatus_t.getCPtr(variable_statuses), SWIGTYPE_p_std__vectorT_operations_research__MPSolver__BasisStatus_t.getCPtr(constraint_statuses));
343  }
344 
350  public static double infinity() {
351  return main_research_linear_solverJNI.MPSolver_infinity();
352  }
353 
357  public void enableOutput() {
358  main_research_linear_solverJNI.MPSolver_enableOutput(swigCPtr, this);
359  }
360 
364  public void suppressOutput() {
365  main_research_linear_solverJNI.MPSolver_suppressOutput(swigCPtr, this);
366  }
367 
371  public long iterations() {
372  return main_research_linear_solverJNI.MPSolver_iterations(swigCPtr, this);
373  }
374 
380  public long nodes() {
381  return main_research_linear_solverJNI.MPSolver_nodes(swigCPtr, this);
382  }
383 
408  public double computeExactConditionNumber() {
409  return main_research_linear_solverJNI.MPSolver_computeExactConditionNumber(swigCPtr, this);
410  }
411 
412  public void setTimeLimit(long time_limit_milliseconds) {
413  main_research_linear_solverJNI.MPSolver_setTimeLimit(swigCPtr, this, time_limit_milliseconds);
414  }
415 
416  public long wallTime() {
417  return main_research_linear_solverJNI.MPSolver_wallTime(swigCPtr, this);
418  }
419 
425  return main_research_linear_solverJNI.MPSolver_loadModelFromProto(swigCPtr, this, input_model.toByteArray());
426  }
427 
429  return main_research_linear_solverJNI.MPSolver_loadModelFromProtoWithUniqueNamesOrDie(swigCPtr, this, input_model.toByteArray());
430  }
431 
436  byte[] buf = main_research_linear_solverJNI.MPSolver_exportModelToProto(swigCPtr, this);
437  if (buf == null || buf.length == 0) {
438  return null;
439  }
440  try {
442  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
443  throw new RuntimeException(
444  "Unable to parse com.google.ortools.linearsolver.MPModelProto protocol message.");
445  }
446 }
447 
452  byte[] buf = main_research_linear_solverJNI.MPSolver_createSolutionResponseProto(swigCPtr, this);
453  if (buf == null || buf.length == 0) {
454  return null;
455  }
456  try {
458  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
459  throw new RuntimeException(
460  "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
461  }
462 }
463 
496  return main_research_linear_solverJNI.MPSolver_loadSolutionFromProto(swigCPtr, this, response.toByteArray());
497  }
498 
503  byte[] buf = main_research_linear_solverJNI.MPSolver_solveWithProto(model_request.toByteArray());
504  if (buf == null || buf.length == 0) {
505  return null;
506  }
507  try {
509  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
510  throw new RuntimeException(
511  "Unable to parse com.google.ortools.linearsolver.MPSolutionResponse protocol message.");
512  }
513 }
514 
519  return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_0(swigCPtr, this, MPModelExportOptions.getCPtr(options), options);
520  }
521 
525  public String exportModelAsLpFormat() {
526  return main_research_linear_solverJNI.MPSolver_exportModelAsLpFormat__SWIG_1(swigCPtr, this);
527  }
528 
533  return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_0(swigCPtr, this, MPModelExportOptions.getCPtr(options), options);
534  }
535 
539  public String exportModelAsMpsFormat() {
540  return main_research_linear_solverJNI.MPSolver_exportModelAsMpsFormat__SWIG_1(swigCPtr, this);
541  }
542 
556  public void setHint(MPVariable[] variables, double[] values) {
557  main_research_linear_solverJNI.MPSolver_setHint(swigCPtr, this, variables, values);
558  }
559 
563  public boolean setNumThreads(int num_theads) {
564  return main_research_linear_solverJNI.MPSolver_setNumThreads(swigCPtr, this, num_theads);
565  }
566 
577  CLP_LINEAR_PROGRAMMING(main_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get()),
581  GLOP_LINEAR_PROGRAMMING(main_research_linear_solverJNI.MPSolver_GLOP_LINEAR_PROGRAMMING_get()),
585  CBC_MIXED_INTEGER_PROGRAMMING(main_research_linear_solverJNI.MPSolver_CBC_MIXED_INTEGER_PROGRAMMING_get()),
589  BOP_INTEGER_PROGRAMMING(main_research_linear_solverJNI.MPSolver_BOP_INTEGER_PROGRAMMING_get()),
593  SAT_INTEGER_PROGRAMMING(main_research_linear_solverJNI.MPSolver_SAT_INTEGER_PROGRAMMING_get());
594 
595  public final int swigValue() {
596  return swigValue;
597  }
598 
599  public static OptimizationProblemType swigToEnum(int swigValue) {
600  OptimizationProblemType[] swigValues = OptimizationProblemType.class.getEnumConstants();
601  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
602  return swigValues[swigValue];
603  for (OptimizationProblemType swigEnum : swigValues)
604  if (swigEnum.swigValue == swigValue)
605  return swigEnum;
606  throw new IllegalArgumentException("No enum " + OptimizationProblemType.class + " with value " + swigValue);
607  }
608 
609  @SuppressWarnings("unused")
610  private OptimizationProblemType() {
611  this.swigValue = SwigNext.next++;
612  }
613 
614  @SuppressWarnings("unused")
615  private OptimizationProblemType(int swigValue) {
616  this.swigValue = swigValue;
617  SwigNext.next = swigValue+1;
618  }
619 
620  @SuppressWarnings("unused")
621  private OptimizationProblemType(OptimizationProblemType swigEnum) {
622  this.swigValue = swigEnum.swigValue;
623  SwigNext.next = this.swigValue+1;
624  }
625 
626  private final int swigValue;
627 
628  private static class SwigNext {
629  private static int next = 0;
630  }
631  }
632 
639  public enum ResultStatus {
663  NOT_SOLVED(main_research_linear_solverJNI.MPSolver_NOT_SOLVED_get());
664 
665  public final int swigValue() {
666  return swigValue;
667  }
668 
669  public static ResultStatus swigToEnum(int swigValue) {
670  ResultStatus[] swigValues = ResultStatus.class.getEnumConstants();
671  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
672  return swigValues[swigValue];
673  for (ResultStatus swigEnum : swigValues)
674  if (swigEnum.swigValue == swigValue)
675  return swigEnum;
676  throw new IllegalArgumentException("No enum " + ResultStatus.class + " with value " + swigValue);
677  }
678 
679  @SuppressWarnings("unused")
680  private ResultStatus() {
681  this.swigValue = SwigNext.next++;
682  }
683 
684  @SuppressWarnings("unused")
685  private ResultStatus(int swigValue) {
686  this.swigValue = swigValue;
687  SwigNext.next = swigValue+1;
688  }
689 
690  @SuppressWarnings("unused")
691  private ResultStatus(ResultStatus swigEnum) {
692  this.swigValue = swigEnum.swigValue;
693  SwigNext.next = this.swigValue+1;
694  }
695 
696  private final int swigValue;
697 
698  private static class SwigNext {
699  private static int next = 0;
700  }
701  }
702 
707  public enum BasisStatus {
708  FREE(main_research_linear_solverJNI.MPSolver_FREE_get()),
709  AT_LOWER_BOUND,
710  AT_UPPER_BOUND,
711  FIXED_VALUE,
712  BASIC;
713 
714  public final int swigValue() {
715  return swigValue;
716  }
717 
718  public static BasisStatus swigToEnum(int swigValue) {
719  BasisStatus[] swigValues = BasisStatus.class.getEnumConstants();
720  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
721  return swigValues[swigValue];
722  for (BasisStatus swigEnum : swigValues)
723  if (swigEnum.swigValue == swigValue)
724  return swigEnum;
725  throw new IllegalArgumentException("No enum " + BasisStatus.class + " with value " + swigValue);
726  }
727 
728  @SuppressWarnings("unused")
729  private BasisStatus() {
730  this.swigValue = SwigNext.next++;
731  }
732 
733  @SuppressWarnings("unused")
734  private BasisStatus(int swigValue) {
735  this.swigValue = swigValue;
736  SwigNext.next = swigValue+1;
737  }
738 
739  @SuppressWarnings("unused")
740  private BasisStatus(BasisStatus swigEnum) {
741  this.swigValue = swigEnum.swigValue;
742  SwigNext.next = this.swigValue+1;
743  }
744 
745  private final int swigValue;
746 
747  private static class SwigNext {
748  private static int next = 0;
749  }
750  }
751 
752 }
boolean interruptSolve()
Interrupts the Solve() execution to terminate processing if possible.
Definition: MPSolver.java:316
final int swigValue()
Definition: MPSolver.java:714
MPObjective objective()
Returns the mutable objective object.
Definition: MPSolver.java:245
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
void enableOutput()
Enables solver logging.
Definition: MPSolver.java:357
UNBOUNDED
proven unbounded.
Definition: MPSolver.java:655
MPVariable lookupVariableOrNull(String var_name)
Looks up a variable by name, and returns nullptr if it does not exist.
Definition: MPSolver.java:136
String exportModelAsLpFormat()
Export the loaded model in LP format.
Definition: MPSolver.java:525
com.google.ortools.linearsolver.MPSolutionResponse createSolutionResponseProto()
Fills the solution found to a response proto and returns it.
Definition: MPSolver.java:451
MPVariable[] makeVarArray(int count, double lb, double ub, boolean integer)
Creates and returns an array of variables.
Definition: MPSolver.java:48
This class stores parameter settings for LP and MIP solvers.
GLOP_LINEAR_PROGRAMMING
Linear Programming solver using GLOP (Recommended solver).
Definition: MPSolver.java:581
Protobuf type.
CLP_LINEAR_PROGRAMMING
Linear Programming solver using Coin CBC.
Definition: MPSolver.java:577
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:424
void setHint(MPVariable[] variables, double[] values)
Sets a hint for solution.
Definition: MPSolver.java:556
boolean setSolverSpecificParametersAsString(String parameters)
Advanced usage: pass solver specific parameters in text format.
Definition: MPSolver.java:326
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:502
MPVariable makeNumVar(double lb, double ub, String name)
Creates a continuous variable.
Definition: MPSolver.java:156
MPConstraint makeConstraint(double lb, double ub, String name)
Creates a named constraint with given bounds.
Definition: MPSolver.java:229
INFEASIBLE
proven infeasible.
Definition: MPSolver.java:651
MPConstraint[] constraints()
Returns the array of constraints handled by the MPSolver.
Definition: MPSolver.java:189
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:707
static com.google.ortools.linearsolver.MPSolutionResponse parseFrom(java.nio.ByteBuffer data)
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:718
FEASIBLE
feasible, or stopped by limit.
Definition: MPSolver.java:647
MPVariable[] makeIntVarArray(int count, double lb, double ub)
Definition: MPSolver.java:76
boolean verifySolution(double tolerance, boolean log_errors)
Advanced usage: Verifies the correctness of the solution.
Definition: MPSolver.java:292
BOP_INTEGER_PROGRAMMING
Linear Boolean Programming Solver.
Definition: MPSolver.java:589
MPSolver(long cPtr, boolean cMemoryOwn)
Definition: MPSolver.java:21
MPVariable[] makeNumVarArray(int count, double lb, double ub)
Definition: MPSolver.java:68
double[] computeConstraintActivities()
Advanced usage: compute the "activities" of all constraints, which are the sums of their linear term...
Definition: MPSolver.java:270
void reset()
Advanced usage: resets extracted model to solve from scratch.
Definition: MPSolver.java:304
FREE
Definition: MPSolver.java:708
NOT_SOLVED
not been solved yet.
Definition: MPSolver.java:663
The status of solving the problem.
Definition: MPSolver.java:639
static double infinity()
Infinity.
Definition: MPSolver.java:350
String exportModelAsMpsFormat()
Export the loaded model in MPS format.
Definition: MPSolver.java:539
MPVariable makeBoolVar(String name)
Creates a boolean variable.
Definition: MPSolver.java:172
boolean setNumThreads(int num_theads)
Sets the number of threads to be used by the solver.
Definition: MPSolver.java:563
The class for constraints of a Mathematical Programming (MP) model.
MPConstraint makeConstraint(double lb, double ub)
Creates a linear constraint with given bounds.
Definition: MPSolver.java:213
void setTimeLimit(long time_limit_milliseconds)
Definition: MPSolver.java:412
long wallTime()
Definition: MPSolver.java:416
long iterations()
Returns the number of simplex iterations.
Definition: MPSolver.java:371
static OptimizationProblemType swigToEnum(int swigValue)
Definition: MPSolver.java:599
MPConstraint makeConstraint()
Creates a constraint with -infinity and +infinity bounds.
Definition: MPSolver.java:221
MPVariable[] makeNumVarArray(int count, double lb, double ub, String var_name)
Definition: MPSolver.java:72
String loadModelFromProtoWithUniqueNamesOrDie(com.google.ortools.linearsolver.MPModelProto input_model)
Definition: MPSolver.java:428
static ResultStatus swigToEnum(int swigValue)
Definition: MPSolver.java:669
final int swigValue()
Definition: MPSolver.java:595
MPVariable makeIntVar(double lb, double ub, String name)
Creates an integer variable.
Definition: MPSolver.java:164
The type of problems (LP or MIP) that will be solved and the underlying solver (GLOP,...
Definition: MPSolver.java:573
CBC_MIXED_INTEGER_PROGRAMMING
Mixed integer Programming Solver using Coin CBC.
Definition: MPSolver.java:585
OPTIMAL
optimal.
Definition: MPSolver.java:643
long nodes()
Returns the number of branch-and-bound nodes evaluated during the solve.
Definition: MPSolver.java:380
void clear()
Clears the objective (including the optimization direction), all variables and constraints.
Definition: MPSolver.java:112
String exportModelAsLpFormat(MPModelExportOptions options)
Export the loaded model in LP format.
Definition: MPSolver.java:518
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
MPVariable[] makeBoolVarArray(int count)
Definition: MPSolver.java:84
void suppressOutput()
Suppresses solver logging.
Definition: MPSolver.java:364
A class to express a linear objective.
MPVariable[] variables()
Returns the array of variables handled by the MPSolver.
Definition: MPSolver.java:127
MPVariable[] makeBoolVarArray(int count, String var_name)
Definition: MPSolver.java:88
com.google.ortools.linearsolver.MPModelProto exportModelToProto()
Export the loaded model to proto and returns it.
Definition: MPSolver.java:435
MPSolver(String name, MPSolver.OptimizationProblemType problem_type)
Create a solver with the given name and underlying solver backend.
Definition: MPSolver.java:95
String exportModelAsMpsFormat(MPModelExportOptions options)
Export the loaded model in MPS format.
Definition: MPSolver.java:532
MPConstraint makeConstraint(String name)
Creates a named constraint with -infinity and +infinity bounds.
Definition: MPSolver.java:237
int numVariables()
Returns the number of variables.
Definition: MPSolver.java:119
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
static com.google.ortools.linearsolver.MPModelProto parseFrom(java.nio.ByteBuffer data)
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[] makeIntVarArray(int count, double lb, double ub, String var_name)
Definition: MPSolver.java:80
final int swigValue()
Definition: MPSolver.java:665
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:495
MPSolver.ResultStatus solve(MPSolverParameters param)
Solves the problem using the specified parameter values.
Definition: MPSolver.java:260
Export options.
MPConstraint lookupConstraintOrNull(String constraint_name)
Looks up a constraint by name, and returns nullptr if it does not exist.
Definition: MPSolver.java:200
double computeExactConditionNumber()
Advanced usage: computes the exact condition number of the current scaled basis: L1norm(B) * L1norm(...
Definition: MPSolver.java:408
int numConstraints()
Returns the number of constraints.
Definition: MPSolver.java:180
MPSolver.ResultStatus solve()
Solves the problem using default parameter values.
Definition: MPSolver.java:253
ABNORMAL
abnormal, i.e., error of some kind.
Definition: MPSolver.java:659
void SetStartingLpBasis(SWIGTYPE_p_std__vectorT_operations_research__MPSolver__BasisStatus_t variable_statuses, SWIGTYPE_p_std__vectorT_operations_research__MPSolver__BasisStatus_t constraint_statuses)
Advanced usage: Incrementality.
Definition: MPSolver.java:341
This mathematical programming (MP) solver class is the main class though which users build and solve...
Definition: MPSolver.java:17
SAT_INTEGER_PROGRAMMING
SAT based solver (requires only integer and Boolean variables).
Definition: MPSolver.java:593