Class Model
java.lang.Object
dev.yushen.wrapperapi.gurobi.solver.Model
public class Model
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description Model(java.lang.String id)Initialize a CP model. -
Method Summary
Modifier and Type Method Description DoubleVariableabs(LinearExpression lx)Initialize a variable representing the absolute value of an expression: return = ABS(lx).DoubleVariableabs(QuadraticExpression qx)Initialize a variable representing the absolute value of an expression: return = ABS(qx).DoubleVariableabs(DoubleVariable var)Initialize a variable representing the absolute value of another variable: return = ABS(var).IntegerVariableabs(IntegerVariable var)Initialize a variable representing the absolute value of another variable: return = ABS(var).voidallDifferent(Variable... vars)Post a constraint representing that given variables should have different values.BinaryVariablebinVar(java.lang.String name)Initialize a new binary (boolean) variable with given name.BinaryVariablebinVar(java.lang.String name, boolean val)Initialize an Array of binary (boolean) variables with given name and value.BinaryVariablebinVar(java.lang.String name, int val)Initialize an Array of binary (boolean) variables with given name and value.BinaryVariable[]binVarArray(java.lang.String name, int size)Initialize an Array of binary (boolean) variables with given name.DoubleVariabledoubleVar(java.lang.String name, double val)Initialize a new double (continues) variable (constant) with given name and a fixed value.DoubleVariabledoubleVar(java.lang.String name, double... bounds)Initialize a new double (continues) variable with given name and possible values for this variable.DoubleVariabledoubleVar(java.lang.String name, double lb, double ub)Initialize a new double (continues) variable with given name, lower and upper bounds.DoubleVariable[]doubleVarArray(java.lang.String name, int size, double val)Initialize an Array of double (continues) variables (constants) with given name and a fixed value.DoubleVariable[]doubleVarArray(java.lang.String name, int size, double... bounds)Initialize an Array of double (continues) variables (constants) with given name and possible values for this variable.DoubleVariable[]doubleVarArray(java.lang.String name, int size, double lb, double ub)Initialize an Array of double (continues) variables (constants) with given name, lower and upper bounds.doubleGAP()java.util.ArrayList<Constraint>getConstraints()gurobi.GRBModelgetModel()java.util.ArrayList<Variable>getVariables()voidiisWrite(java.lang.String path)Compute the IIS file in case of infeasibility.IntegerVariableintVar(java.lang.String name, int val)Initialize a new integer variable (constant) with given name and a fixed value.IntegerVariableintVar(java.lang.String name, int... bounds)Initialize a new integer variable with given name and possible values for this variable.IntegerVariableintVar(java.lang.String name, int lb, int ub)Initialize a new integer variable with given name, lower and upper bounds.IntegerVariable[]intVarArray(java.lang.String name, int size, int val)Initialize an Array of integer variables (constants) with given name and a fixed value.IntegerVariable[]intVarArray(java.lang.String name, int size, int... bounds)Initialize an Array of integer variables (constants) with given name and possible values for this variable.IntegerVariable[]intVarArray(java.lang.String name, int size, int lb, int ub)Initialize an Array of integer variables (constants) with given name, lower and upper bounds.intM()voidmax(Variable v1, Variable... vars)Post a constraint that indicates v1 to be the maximum value of all given variables vars.voidmaximize(Expression xp)Set the objective of this model to maximize the given expression.voidmaximize(Variable variable)Set the objective of this model to maximize the given expression.voidmin(Variable v1, Variable... vars)Post a constraint that indicates v1 to be the minimum value of all given variables vars.voidminimize(Expression xp)Set the objective of this model to minimize the given expression.voidminimize(Variable variable)Set the objective of this model to minimize the given expression.voidpost(double constant, char operator, LinearExpression lx)Post a constraint.voidpost(double constant, char operator, QuadraticExpression qx)Post a constraint.voidpost(Constraint c)Post a constraint.voidpost(LinearExpression lx, char operator, double constant)Post a constraint.voidpost(LinearExpression lx1, char operator, LinearExpression lx2)Post a constraint.voidpost(LinearExpression lx, char operator, QuadraticExpression qx)Post a constraint.voidpost(LinearExpression lx, char operator, Variable variable)Post a constraint.voidpost(QuadraticExpression qx, char operator, double constant)Post a constraint.voidpost(QuadraticExpression qx, char operator, LinearExpression lx)Post a constraint.voidpost(QuadraticExpression qx1, char operator, QuadraticExpression qx2)Post a constraint.voidpost(QuadraticExpression qx, char operator, Variable variable)Post a constraint.voidpost(Variable variable, char operator, LinearExpression lx)Post a constraint.voidpost(Variable variable, char operator, QuadraticExpression qx)Post a constraint.voidpost(Variable v1, char operator, Variable v2)Post a constraint.voidpostInEq(Expression xp1, Expression xp2)Post an Inequality constraint.voidpostInEq(Expression xp, Variable v)Post an Inequality constraint.voidpostInEq(Variable v, Expression xp)Post an Inequality constraint.voidpostInEq(Variable v1, Variable v2)Post an Inequality constraint.voidpostSum(Variable[] vars, char operator, double constant)Post a constraint in regard to sum over some variables.voidpostSum(Variable[] vars, char operator, Variable var1)Post a constraint in regard to sum over some variables.voidsetGAP(double GAP)Set the gap tolerance for internal calculation such as inequality.voidsetHeuristics(double heuristics)Determines the amount of time spent in MIP heuristics.voidsetM(int m)Set the big-M coefficient for internal calculation, such as inequality.voidsetMIPFocus(int focus)The MIPFocus parameter allows you to modify your high-level solution strategy, depending on your goals.voidsetMIPGap(double gap)The MIP dev.yushen.wrapperapi.gurobi.solver will terminate (with an optimal result) when the gap between the lower and upper objective bound is less than MIPGap times the absolute value of the incumbent objective value.voidsetMIPGapAbs(double gapAbs)The MIP dev.yushen.wrapperapi.gurobi.solver will terminate (with an optimal result) when the gap between the lower and upper objective bound is less than MIPGapAbs.voidsetNonConvex(int nonConvex)Sets the strategy for handling non-convex quadratic objectives or non-convex quadratic constraints.voidsetOutputFlag(int flag)Enables or disables dev.yushen.wrapperapi.gurobi.solver output.voidsetPoolSearchMode(int mode)Selects different modes for exploring the MIP search tree.voidsetPoolSolutions(int solutions)Determines how many MIP solutions are stored.voidsetTimeLimit(double time)Limits the total time expended (in seconds).voidsolve()Solve this model and find the optimum solution.LinearExpressionsum(Variable... vars)Construct an expression to represent the sum of some variables.doublesupportedGRBVersion()voidwrite(java.lang.String path)This method is the general entry point for writing optimization data to a file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Model
public Model(java.lang.String id) throws gurobi.GRBExceptionInitialize a CP model.- Parameters:
id- A name for the model.- Throws:
gurobi.GRBException- GRB Exception.
-
-
Method Details
-
intVar
Initialize a new integer variable with given name, lower and upper bounds.- Parameters:
name- The name of this variable.lb- The lower bound of this variable.ub- The upper bound of this variable.- Returns:
- The initialized
IntegerVariable. - Throws:
gurobi.GRBException- GRB Exception.
-
intVar
Initialize a new integer variable with given name and possible values for this variable.- Parameters:
name- The name of this variable.bounds- Can be an Array of integers or several integers seperated by comma to represent the possible values this variable can take.- Returns:
- The initialized
IntegerVariable. - Throws:
gurobi.GRBException- GRB Exception.
-
intVar
Initialize a new integer variable (constant) with given name and a fixed value.- Parameters:
name- The name of this variable.val- The value of this variable.- Returns:
- The initialized
IntegerVariable. - Throws:
gurobi.GRBException- GRB Exception.
-
intVarArray
public IntegerVariable[] intVarArray(java.lang.String name, int size, int lb, int ub) throws gurobi.GRBExceptionInitialize an Array of integer variables (constants) with given name, lower and upper bounds.- Parameters:
name- The name prefix of each variable.size- The size of the desired variable Array.lb- The lower bound of this variable.ub- The upper bound of this variable.- Returns:
- The initialized
IntegerVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
intVarArray
public IntegerVariable[] intVarArray(java.lang.String name, int size, int... bounds) throws gurobi.GRBExceptionInitialize an Array of integer variables (constants) with given name and possible values for this variable.- Parameters:
name- The name prefix of each variable.size- The size of the desired variable Array.bounds- Can be an Array of integers or several integers seperated by comma to represent the possible values this variable can take.- Returns:
- The initialized
IntegerVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
intVarArray
public IntegerVariable[] intVarArray(java.lang.String name, int size, int val) throws gurobi.GRBExceptionInitialize an Array of integer variables (constants) with given name and a fixed value.- Parameters:
name- The name prefix of each variable.size- The size of the desired variable Array.val- The value of this variable.- Returns:
- The initialized
IntegerVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
binVar
Initialize a new binary (boolean) variable with given name.- Parameters:
name- The name of this variable.- Returns:
- The initialized
BinaryVariable. - Throws:
gurobi.GRBException- GRB Exception.
-
binVarArray
Initialize an Array of binary (boolean) variables with given name.- Parameters:
name- The name prefix of each variable.size- The size of the desired variable Array.- Returns:
- The initialized
BinaryVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
binVar
Initialize an Array of binary (boolean) variables with given name and value.- Parameters:
name- The name prefix of each variable.val- The value of this variable.- Returns:
- The initialized
BinaryVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
binVar
Initialize an Array of binary (boolean) variables with given name and value.- Parameters:
name- The name prefix of each variable.val- The value of this variable.- Returns:
- The initialized
BinaryVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
doubleVar
public DoubleVariable doubleVar(java.lang.String name, double lb, double ub) throws gurobi.GRBExceptionInitialize a new double (continues) variable with given name, lower and upper bounds.- Parameters:
name- The name of this variable.lb- The lower bound of this variable.ub- The upper bound of this variable.- Returns:
- The initialized
DoubleVariable. - Throws:
gurobi.GRBException- GRB Exception.
-
doubleVar
public DoubleVariable doubleVar(java.lang.String name, double... bounds) throws gurobi.GRBExceptionInitialize a new double (continues) variable with given name and possible values for this variable.- Parameters:
name- The name of this variable.bounds- Can be an Array of doubles or several doubles seperated by comma to represent the possible values this variable can take.- Returns:
- The initialized
DoubleVariable. - Throws:
gurobi.GRBException- GRB Exception.
-
doubleVar
Initialize a new double (continues) variable (constant) with given name and a fixed value.- Parameters:
name- The name of this variable.val- The value of this variable- Returns:
- The initialized
DoubleVariable. - Throws:
gurobi.GRBException- GRB Exception.
-
doubleVarArray
public DoubleVariable[] doubleVarArray(java.lang.String name, int size, double lb, double ub) throws gurobi.GRBExceptionInitialize an Array of double (continues) variables (constants) with given name, lower and upper bounds.- Parameters:
name- The name prefix of each variable.size- The size of the desired variable Array.lb- The lower bound of this variable.ub- The upper bound of this variable.- Returns:
- The initialized
DoubleVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
doubleVarArray
public DoubleVariable[] doubleVarArray(java.lang.String name, int size, double... bounds) throws gurobi.GRBExceptionInitialize an Array of double (continues) variables (constants) with given name and possible values for this variable.- Parameters:
name- The name prefix of each variable.size- The size of the desired variable Array.bounds- Can be an Array of doubles or several doubles seperated by comma to represent the possible values this variable can take.- Returns:
- The initialized
DoubleVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
doubleVarArray
public DoubleVariable[] doubleVarArray(java.lang.String name, int size, double val) throws gurobi.GRBExceptionInitialize an Array of double (continues) variables (constants) with given name and a fixed value.- Parameters:
name- The name prefix of each variable.size- The size of the desired variable Array.val- The value of this variable.- Returns:
- The initialized
DoubleVariableArray. - Throws:
gurobi.GRBException- GRB Exception.
-
post
Post a constraint.- Parameters:
c- The constraint to be posted.- Throws:
gurobi.GRBException- GRB Exception.
-
postInEq
Post an Inequality constraint. Thus, v1 != v2. The margin of error is in default 0.001, and can be changed bysetGAP(double).- Parameters:
v1- A variable.v2- Another variable.- Throws:
gurobi.GRBException- GRB Exception.
-
postInEq
Post an Inequality constraint. Thus, xp1 != xp2. The margin of error is in default 0.001, and can be changed bysetGAP(double).- Parameters:
xp1- An Expression.xp2- Another Expression.- Throws:
gurobi.GRBException- GRB Exception.
-
postInEq
Post an Inequality constraint. Thus, v != xp. The margin of error is in default 0.001, and can be changed bysetGAP(double).- Parameters:
v- A Variable.xp- An Expression.- Throws:
gurobi.GRBException- GRB Exception.
-
postInEq
Post an Inequality constraint. Thus, xp != v. The margin of error is in default 0.001, and can be changed bysetGAP(double).- Parameters:
v- A Variable.xp- An Expression.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(QuadraticExpression qx1, char operator, QuadraticExpression qx2) throws gurobi.GRBExceptionPost a constraint.- Parameters:
qx1- A quadratic expression.operator- The operator: '=', '>', '<'.qx2- A quadratic expression.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(QuadraticExpression qx, char operator, LinearExpression lx) throws gurobi.GRBExceptionPost a constraint.- Parameters:
qx- A quadratic expression.operator- The operator: '=', '>', '<'.lx- A linear expression.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(QuadraticExpression qx, char operator, Variable variable) throws gurobi.GRBExceptionPost a constraint.- Parameters:
qx- A quadratic expression.operator- The operator: '=', '>', '<'.variable- A variable.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(Variable variable, char operator, QuadraticExpression qx) throws gurobi.GRBExceptionPost a constraint.- Parameters:
qx- A quadratic expression.operator- The operator: '=', '>', '<'.variable- A variable.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(QuadraticExpression qx, char operator, double constant) throws gurobi.GRBExceptionPost a constraint.- Parameters:
qx- A quadratic expression.operator- The operator: '=', '>', '<'.constant- A constant.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(double constant, char operator, QuadraticExpression qx) throws gurobi.GRBExceptionPost a constraint.- Parameters:
qx- A quadratic expression.operator- The operator: '=', '>', '<'.constant- A constant.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(LinearExpression lx, char operator, QuadraticExpression qx) throws gurobi.GRBExceptionPost a constraint.- Parameters:
qx- A quadratic expression.operator- The operator: '=', '>', '<'.lx- A linear expression.- Throws:
gurobi.GRBException- GRB Exception.
-
post
public void post(LinearExpression lx1, char operator, LinearExpression lx2) throws gurobi.GRBExceptionPost a constraint.- Parameters:
lx1- A linear expression.operator- The operator: '=', '>', '<'.lx2- A linear expression.- Throws:
gurobi.GRBException- GRB Exception.
-
post
Post a constraint.- Parameters:
lx- A linear expression.operator- The operator: '=', '>', '<'.constant- A constant.- Throws:
gurobi.GRBException- GRB Exception.
-
post
Post a constraint.- Parameters:
lx- A linear expression.operator- The operator: '=', '>', '<'.constant- A constant.- Throws:
gurobi.GRBException- GRB Exception.
-
post
Post a constraint.- Parameters:
lx- A linear expression.operator- The operator: '=', '>', '<'.variable- A variable.- Throws:
gurobi.GRBException- GRB Exception.
-
post
Post a constraint.- Parameters:
lx- A linear expression.operator- The operator: '=', '>', '<'.variable- A variable.- Throws:
gurobi.GRBException- GRB Exception.
-
post
Post a constraint.- Parameters:
v1- A variable.operator- The operator: '=', '>', '<'.v2- A variable.- Throws:
gurobi.GRBException- GRB Exception.
-
abs
Initialize a variable representing the absolute value of another variable: return = ABS(var).- Parameters:
var- A variable.- Returns:
- The variable representing the ABS(var).
- Throws:
gurobi.GRBException- GRB Exception.
-
abs
Initialize a variable representing the absolute value of another variable: return = ABS(var).- Parameters:
var- A variable.- Returns:
- The variable representing the ABS(var).
- Throws:
gurobi.GRBException- GRB Exception.
-
abs
Initialize a variable representing the absolute value of an expression: return = ABS(lx).- Parameters:
lx- A linear expression.- Returns:
- The variable representing the ABS(lx).
- Throws:
gurobi.GRBException- GRB Exception.
-
abs
Initialize a variable representing the absolute value of an expression: return = ABS(qx).- Parameters:
qx- A quadratic expression.- Returns:
- The variable representing the ABS(qx).
- Throws:
gurobi.GRBException- GRB Exception.
-
postSum
Post a constraint in regard to sum over some variables.- Parameters:
vars- An Array of some variables to be summed.operator- The operator: '=', '>', '<'.var1- The variable to be associated to the summed variables.- Throws:
gurobi.GRBException- GRB Exception.
-
postSum
Post a constraint in regard to sum over some variables.- Parameters:
vars- An Array of some variables to be summed.operator- The operator: '=', '>', '<'.constant- The constant to be associated to the summed variables.- Throws:
gurobi.GRBException- GRB Exception.
-
sum
Construct an expression to represent the sum of some variables.- Parameters:
vars- An Array of variables or several variables seperated by comma to be summed.- Returns:
- The built
LinearExpressionrepresenting the sum. - Throws:
gurobi.GRBException- GRB Exception.
-
allDifferent
Post a constraint representing that given variables should have different values. The margin of error is in default 0.001, and can be changed bysetGAP(double).- Parameters:
vars- An Array of variables or several variables seperated by comma.- Throws:
gurobi.GRBException- GRB Exception.
-
max
Post a constraint that indicates v1 to be the maximum value of all given variables vars. -
min
Post a constraint that indicates v1 to be the minimum value of all given variables vars. -
minimize
Set the objective of this model to minimize the given expression.- Parameters:
xp- TheExpressionto be minimized.- Throws:
gurobi.GRBException- GRB Exception.
-
maximize
Set the objective of this model to maximize the given expression.- Parameters:
xp- TheExpressionto be maximized.- Throws:
gurobi.GRBException- GRB Exception.
-
minimize
Set the objective of this model to minimize the given expression.- Parameters:
variable- TheVariableto be minimized.- Throws:
gurobi.GRBException- GRB Exception.
-
maximize
Set the objective of this model to maximize the given expression.- Parameters:
variable- TheVariableto be maximized.- Throws:
gurobi.GRBException- GRB Exception.
-
solve
public void solve() throws gurobi.GRBExceptionSolve this model and find the optimum solution.- Throws:
gurobi.GRBException- GRB Exception.
-
setTimeLimit
public void setTimeLimit(double time) throws gurobi.GRBExceptionLimits the total time expended (in seconds). Optimization returns with a TIME_LIMIT status if the limit is exceeded (see the Status Code section for further details).- Parameters:
time- Minimum value: 0 and Maximum value: Infinity- Throws:
gurobi.GRBException- Handled by client.
-
setMIPGapAbs
public void setMIPGapAbs(double gapAbs) throws gurobi.GRBExceptionThe MIP dev.yushen.wrapperapi.gurobi.solver will terminate (with an optimal result) when the gap between the lower and upper objective bound is less than MIPGapAbs.- Parameters:
gapAbs- Minimum value: 0 and Maximum value: Infinity- Throws:
gurobi.GRBException- Handled by client.`
-
setMIPGap
public void setMIPGap(double gap) throws gurobi.GRBExceptionThe MIP dev.yushen.wrapperapi.gurobi.solver will terminate (with an optimal result) when the gap between the lower and upper objective bound is less than MIPGap times the absolute value of the incumbent objective value. More precisely, if $z_P$ is the primal objective bound (i.e., the incumbent objective value, which is the upper bound for minimization problems), and $z_D$ is the dual objective bound (i.e., the lower bound for minimization problems), then the MIP gap is defined as $gap = \vert z_P - z_D\vert / \vert z_P\vert$. Note that if $z_P = z_D = 0$, then the gap is defined to be zero. If $z_P = 0$ and $z_D \neq 0$, the gap is defined to be infinity.For most models, $z_P$ and $z_D$ will have the same sign throughout the optimization process, and then the gap is monotonically decreasing. But if $z_P$ and $z_D$ have opposite signs, the relative gap may increase after finding a new incumbent solution, even though the absolute gap $\vert z_P - z_D\vert$ has decreased.
- Parameters:
gap- Minimum value: 0 and Maximum value: Infinity- Throws:
gurobi.GRBException- Handled by client.
-
setHeuristics
public void setHeuristics(double heuristics) throws gurobi.GRBExceptionDetermines the amount of time spent in MIP heuristics. You can think of the value as the desired fraction of total MIP runtime devoted to heuristics (so by default, we aim to spend 5% of runtime on heuristics). Larger values produce more and better feasible solutions, at a cost of slower progress in the best bound.- Parameters:
heuristics- Minimum value: 0 and Maximum value: 1- Throws:
gurobi.GRBException- Handled by client.
-
setOutputFlag
public void setOutputFlag(int flag) throws gurobi.GRBExceptionEnables or disables dev.yushen.wrapperapi.gurobi.solver output. Use LogFile and LogToConsole for finer-grain control. Setting OutputFlag to 0 is equivalent to setting LogFile to "" and LogToConsole to 0.- Parameters:
flag- Minimum value: 0 and Maximum value: 1- Throws:
gurobi.GRBException- Handled by client.
-
setMIPFocus
public void setMIPFocus(int focus) throws gurobi.GRBExceptionThe MIPFocus parameter allows you to modify your high-level solution strategy, depending on your goals. By default, the Gurobi MIP dev.yushen.wrapperapi.gurobi.solver strikes a balance between finding new feasible solutions and proving that the current solution is optimal. If you are more interested in finding feasible solutions quickly, you can select MIPFocus=1. If you believe the dev.yushen.wrapperapi.gurobi.solver is having no trouble finding good quality solutions, and wish to focus more attention on proving optimality, select MIPFocus=2. If the best objective bound is moving very slowly (or not at all), you may want to try MIPFocus=3 to focus on the bound.- Parameters:
focus- Minimum value: 0 and Maximum value: 3- Throws:
gurobi.GRBException- Handled by client.
-
setPoolSolutions
public void setPoolSolutions(int solutions) throws gurobi.GRBExceptionDetermines how many MIP solutions are stored. For the default value of PoolSearchMode, these are just the solutions that are found along the way in the process of exploring the MIP search tree. For other values of PoolSearchMode, this parameter sets a target for how many solutions to find, so larger values will impact performance.- Parameters:
solutions- Minimum value: 1 and Maximum value: 2000000000- Throws:
gurobi.GRBException- Handled by client.
-
setPoolSearchMode
public void setPoolSearchMode(int mode) throws gurobi.GRBExceptionSelects different modes for exploring the MIP search tree. With the default setting (PoolSearchMode=0), the MIP dev.yushen.wrapperapi.gurobi.solver tries to find an optimal solution to the model. It keeps other solutions found along the way, but those are incidental. By setting this parameter to a non-default value, the MIP search will continue after the optimal solution has been found in order to find additional, high-quality solutions. With a setting of 2, it will find the n best solutions, where n is determined by the value of the PoolSolutions parameter. With a setting of 1, it will try to find additional solutions, but with no guarantees about the quality of those solutions. The cost of the solve will increase with increasing values of this parameter.- Parameters:
mode- Minimum value: 0 and Maximum value: 2- Throws:
gurobi.GRBException- GRB Exception.
-
setNonConvex
public void setNonConvex(int nonConvex) throws gurobi.GRBExceptionSets the strategy for handling non-convex quadratic objectives or non-convex quadratic constraints. With setting 0, an error is reported if the original user model contains non-convex quadratic constructs. With setting 1, an error is reported if non-convex quadratic constructs could not be discarded or linearized during presolve. With setting 2, non-convex quadratic problems are solved by means of translating them into bilinear form and applying spatial branching. The default -1 setting is currently equivalent to 1, and may change in future releases to be equivalent to 2.- Parameters:
nonConvex- Minimum value: -1 and Maximum value: 2- Throws:
gurobi.GRBException- GRB Exception.
-
write
public void write(java.lang.String path) throws gurobi.GRBExceptionThis method is the general entry point for writing optimization data to a file. It can be used to write optimization models, solutions vectors, basis vectors, start vectors, or parameter settings. The type of data written is determined by the file suffix. File formats are described in the File Format section.- Parameters:
path- The path of the file. The file type is encoded in the file name suffix. Valid suffixes are .mps, .rew, .lp, or .rlp for writing the model itself, .dua or .dlp for writing the dualized model (only pure LP), .ilp for writing just the IIS associated with an infeasible model (see Model.computeIIS for further information), .sol for writing the solution selected by the SolutionNumber parameter, .mst for writing a start vector, .hnt for writing a hint file, .bas for writing an LP basis, .prm for writing modified parameter settings, .attr for writing model attributes, or .json for writing solution information in JSON format.- Throws:
gurobi.GRBException- GRB Exception.
-
iisWrite
public void iisWrite(java.lang.String path) throws gurobi.GRBExceptionCompute the IIS file in case of infeasibility.- Parameters:
path- The path of the file. Valid suffix is *.ilp.- Throws:
gurobi.GRBException- The path of the file.
-
supportedGRBVersion
public double supportedGRBVersion()- Returns:
- The supported Gurobi version. I.e. the included Gurobi library.
-
getModel
public gurobi.GRBModel getModel() -
getVariables
-
getConstraints
-
M
public int M()- Returns:
- The internal big-M.
-
setM
public void setM(int m)Set the big-M coefficient for internal calculation, such as inequality. Default M = 99999. If you can reduce the M to tighten the boundaries as much as possible to reduce additional processing time.- Parameters:
m- The new value for big-M.
-
GAP
public double GAP()- Returns:
- The internal gap tolerance.
-
setGAP
public void setGAP(double GAP)Set the gap tolerance for internal calculation such as inequality. Default GAP = 0.001.- Parameters:
GAP- The new value for GAP.
-