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
    DoubleVariable abs​(LinearExpression lx)
    Initialize a variable representing the absolute value of an expression: return = ABS(lx).
    DoubleVariable abs​(QuadraticExpression qx)
    Initialize a variable representing the absolute value of an expression: return = ABS(qx).
    DoubleVariable abs​(DoubleVariable var)
    Initialize a variable representing the absolute value of another variable: return = ABS(var).
    IntegerVariable abs​(IntegerVariable var)
    Initialize a variable representing the absolute value of another variable: return = ABS(var).
    void allDifferent​(Variable... vars)
    Post a constraint representing that given variables should have different values.
    BinaryVariable binVar​(java.lang.String name)
    Initialize a new binary (boolean) variable with given name.
    BinaryVariable binVar​(java.lang.String name, boolean val)
    Initialize an Array of binary (boolean) variables with given name and value.
    BinaryVariable binVar​(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.
    DoubleVariable doubleVar​(java.lang.String name, double val)
    Initialize a new double (continues) variable (constant) with given name and a fixed value.
    DoubleVariable doubleVar​(java.lang.String name, double... bounds)
    Initialize a new double (continues) variable with given name and possible values for this variable.
    DoubleVariable doubleVar​(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.
    double GAP()  
    java.util.ArrayList<Constraint> getConstraints()  
    gurobi.GRBModel getModel()  
    java.util.ArrayList<Variable> getVariables()  
    void iisWrite​(java.lang.String path)
    Compute the IIS file in case of infeasibility.
    IntegerVariable intVar​(java.lang.String name, int val)
    Initialize a new integer variable (constant) with given name and a fixed value.
    IntegerVariable intVar​(java.lang.String name, int... bounds)
    Initialize a new integer variable with given name and possible values for this variable.
    IntegerVariable intVar​(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.
    int M()  
    void max​(Variable v1, Variable... vars)
    Post a constraint that indicates v1 to be the maximum value of all given variables vars.
    void maximize​(Expression xp)
    Set the objective of this model to maximize the given expression.
    void maximize​(Variable variable)
    Set the objective of this model to maximize the given expression.
    void min​(Variable v1, Variable... vars)
    Post a constraint that indicates v1 to be the minimum value of all given variables vars.
    void minimize​(Expression xp)
    Set the objective of this model to minimize the given expression.
    void minimize​(Variable variable)
    Set the objective of this model to minimize the given expression.
    void post​(double constant, char operator, LinearExpression lx)
    Post a constraint.
    void post​(double constant, char operator, QuadraticExpression qx)
    Post a constraint.
    void post​(Constraint c)
    Post a constraint.
    void post​(LinearExpression lx, char operator, double constant)
    Post a constraint.
    void post​(LinearExpression lx1, char operator, LinearExpression lx2)
    Post a constraint.
    void post​(LinearExpression lx, char operator, QuadraticExpression qx)
    Post a constraint.
    void post​(LinearExpression lx, char operator, Variable variable)
    Post a constraint.
    void post​(QuadraticExpression qx, char operator, double constant)
    Post a constraint.
    void post​(QuadraticExpression qx, char operator, LinearExpression lx)
    Post a constraint.
    void post​(QuadraticExpression qx1, char operator, QuadraticExpression qx2)
    Post a constraint.
    void post​(QuadraticExpression qx, char operator, Variable variable)
    Post a constraint.
    void post​(Variable variable, char operator, LinearExpression lx)
    Post a constraint.
    void post​(Variable variable, char operator, QuadraticExpression qx)
    Post a constraint.
    void post​(Variable v1, char operator, Variable v2)
    Post a constraint.
    void postInEq​(Expression xp1, Expression xp2)
    Post an Inequality constraint.
    void postInEq​(Expression xp, Variable v)
    Post an Inequality constraint.
    void postInEq​(Variable v, Expression xp)
    Post an Inequality constraint.
    void postInEq​(Variable v1, Variable v2)
    Post an Inequality constraint.
    void postSum​(Variable[] vars, char operator, double constant)
    Post a constraint in regard to sum over some variables.
    void postSum​(Variable[] vars, char operator, Variable var1)
    Post a constraint in regard to sum over some variables.
    void setGAP​(double GAP)
    Set the gap tolerance for internal calculation such as inequality.
    void setHeuristics​(double heuristics)
    Determines the amount of time spent in MIP heuristics.
    void setM​(int m)
    Set the big-M coefficient for internal calculation, such as inequality.
    void setMIPFocus​(int focus)
    The MIPFocus parameter allows you to modify your high-level solution strategy, depending on your goals.
    void setMIPGap​(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.
    void setMIPGapAbs​(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.
    void setNonConvex​(int nonConvex)
    Sets the strategy for handling non-convex quadratic objectives or non-convex quadratic constraints.
    void setOutputFlag​(int flag)
    Enables or disables dev.yushen.wrapperapi.gurobi.solver output.
    void setPoolSearchMode​(int mode)
    Selects different modes for exploring the MIP search tree.
    void setPoolSolutions​(int solutions)
    Determines how many MIP solutions are stored.
    void setTimeLimit​(double time)
    Limits the total time expended (in seconds).
    void solve()
    Solve this model and find the optimum solution.
    LinearExpression sum​(Variable... vars)
    Construct an expression to represent the sum of some variables.
    double supportedGRBVersion()  
    void write​(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.GRBException
      Initialize a CP model.
      Parameters:
      id - A name for the model.
      Throws:
      gurobi.GRBException - GRB Exception.
  • Method Details

    • intVar

      public IntegerVariable intVar​(java.lang.String name, int lb, int ub) throws gurobi.GRBException
      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

      public IntegerVariable intVar​(java.lang.String name, int... bounds) throws gurobi.GRBException
      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

      public IntegerVariable intVar​(java.lang.String name, int val) throws gurobi.GRBException
      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.GRBException
      Initialize 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 IntegerVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • intVarArray

      public IntegerVariable[] intVarArray​(java.lang.String name, int size, int... bounds) throws gurobi.GRBException
      Initialize 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 IntegerVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • intVarArray

      public IntegerVariable[] intVarArray​(java.lang.String name, int size, int val) throws gurobi.GRBException
      Initialize 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 IntegerVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • binVar

      public BinaryVariable binVar​(java.lang.String name) throws gurobi.GRBException
      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

      public BinaryVariable[] binVarArray​(java.lang.String name, int size) throws gurobi.GRBException
      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 BinaryVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • binVar

      public BinaryVariable binVar​(java.lang.String name, int val) throws gurobi.GRBException
      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 BinaryVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • binVar

      public BinaryVariable binVar​(java.lang.String name, boolean val) throws gurobi.GRBException
      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 BinaryVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • doubleVar

      public DoubleVariable doubleVar​(java.lang.String name, double lb, double ub) throws gurobi.GRBException
      Initialize 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.GRBException
      Initialize 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

      public DoubleVariable doubleVar​(java.lang.String name, double val) throws gurobi.GRBException
      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.GRBException
      Initialize 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 DoubleVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • doubleVarArray

      public DoubleVariable[] doubleVarArray​(java.lang.String name, int size, double... bounds) throws gurobi.GRBException
      Initialize 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 DoubleVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • doubleVarArray

      public DoubleVariable[] doubleVarArray​(java.lang.String name, int size, double val) throws gurobi.GRBException
      Initialize 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 DoubleVariable Array.
      Throws:
      gurobi.GRBException - GRB Exception.
    • post

      public void post​(Constraint c) throws gurobi.GRBException
      Post a constraint.
      Parameters:
      c - The constraint to be posted.
      Throws:
      gurobi.GRBException - GRB Exception.
    • postInEq

      public void postInEq​(Variable v1, Variable v2) throws gurobi.GRBException
      Post an Inequality constraint. Thus, v1 != v2. The margin of error is in default 0.001, and can be changed by setGAP(double).
      Parameters:
      v1 - A variable.
      v2 - Another variable.
      Throws:
      gurobi.GRBException - GRB Exception.
    • postInEq

      public void postInEq​(Expression xp1, Expression xp2) throws gurobi.GRBException
      Post an Inequality constraint. Thus, xp1 != xp2. The margin of error is in default 0.001, and can be changed by setGAP(double).
      Parameters:
      xp1 - An Expression.
      xp2 - Another Expression.
      Throws:
      gurobi.GRBException - GRB Exception.
    • postInEq

      public void postInEq​(Variable v, Expression xp) throws gurobi.GRBException
      Post an Inequality constraint. Thus, v != xp. The margin of error is in default 0.001, and can be changed by setGAP(double).
      Parameters:
      v - A Variable.
      xp - An Expression.
      Throws:
      gurobi.GRBException - GRB Exception.
    • postInEq

      public void postInEq​(Expression xp, Variable v) throws gurobi.GRBException
      Post an Inequality constraint. Thus, xp != v. The margin of error is in default 0.001, and can be changed by setGAP(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.GRBException
      Post 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.GRBException
      Post 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.GRBException
      Post 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.GRBException
      Post 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.GRBException
      Post 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.GRBException
      Post 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.GRBException
      Post 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.GRBException
      Post a constraint.
      Parameters:
      lx1 - A linear expression.
      operator - The operator: '=', '>', '<'.
      lx2 - A linear expression.
      Throws:
      gurobi.GRBException - GRB Exception.
    • post

      public void post​(LinearExpression lx, char operator, double constant) throws gurobi.GRBException
      Post a constraint.
      Parameters:
      lx - A linear expression.
      operator - The operator: '=', '>', '<'.
      constant - A constant.
      Throws:
      gurobi.GRBException - GRB Exception.
    • post

      public void post​(double constant, char operator, LinearExpression lx) throws gurobi.GRBException
      Post a constraint.
      Parameters:
      lx - A linear expression.
      operator - The operator: '=', '>', '<'.
      constant - A constant.
      Throws:
      gurobi.GRBException - GRB Exception.
    • post

      public void post​(LinearExpression lx, char operator, Variable variable) throws gurobi.GRBException
      Post a constraint.
      Parameters:
      lx - A linear expression.
      operator - The operator: '=', '>', '<'.
      variable - A variable.
      Throws:
      gurobi.GRBException - GRB Exception.
    • post

      public void post​(Variable variable, char operator, LinearExpression lx) throws gurobi.GRBException
      Post a constraint.
      Parameters:
      lx - A linear expression.
      operator - The operator: '=', '>', '<'.
      variable - A variable.
      Throws:
      gurobi.GRBException - GRB Exception.
    • post

      public void post​(Variable v1, char operator, Variable v2) throws gurobi.GRBException
      Post a constraint.
      Parameters:
      v1 - A variable.
      operator - The operator: '=', '>', '<'.
      v2 - A variable.
      Throws:
      gurobi.GRBException - GRB Exception.
    • abs

      public IntegerVariable abs​(IntegerVariable var) throws gurobi.GRBException
      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

      public DoubleVariable abs​(DoubleVariable var) throws gurobi.GRBException
      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

      public DoubleVariable abs​(LinearExpression lx) throws gurobi.GRBException
      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

      public DoubleVariable abs​(QuadraticExpression qx) throws gurobi.GRBException
      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

      public void postSum​(Variable[] vars, char operator, Variable var1) throws gurobi.GRBException
      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

      public void postSum​(Variable[] vars, char operator, double constant) throws gurobi.GRBException
      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

      public LinearExpression sum​(Variable... vars) throws gurobi.GRBException
      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 LinearExpression representing the sum.
      Throws:
      gurobi.GRBException - GRB Exception.
    • allDifferent

      public void allDifferent​(Variable... vars) throws gurobi.GRBException
      Post a constraint representing that given variables should have different values. The margin of error is in default 0.001, and can be changed by setGAP(double).
      Parameters:
      vars - An Array of variables or several variables seperated by comma.
      Throws:
      gurobi.GRBException - GRB Exception.
    • max

      public void max​(Variable v1, Variable... vars) throws gurobi.GRBException
      Post a constraint that indicates v1 to be the maximum value of all given variables vars.
      Parameters:
      v1 - The variable which should be the maximum of vars.
      vars - An Array of Variables or several Variables seperated by comma.
      Throws:
      gurobi.GRBException - GRB Exception.
    • min

      public void min​(Variable v1, Variable... vars) throws gurobi.GRBException
      Post a constraint that indicates v1 to be the minimum value of all given variables vars.
      Parameters:
      v1 - The variable which should be the minimum of vars.
      vars - An Array of Variables or several Variables seperated by comma.
      Throws:
      gurobi.GRBException - GRB Exception.
    • minimize

      public void minimize​(Expression xp) throws gurobi.GRBException
      Set the objective of this model to minimize the given expression.
      Parameters:
      xp - The Expression to be minimized.
      Throws:
      gurobi.GRBException - GRB Exception.
    • maximize

      public void maximize​(Expression xp) throws gurobi.GRBException
      Set the objective of this model to maximize the given expression.
      Parameters:
      xp - The Expression to be maximized.
      Throws:
      gurobi.GRBException - GRB Exception.
    • minimize

      public void minimize​(Variable variable) throws gurobi.GRBException
      Set the objective of this model to minimize the given expression.
      Parameters:
      variable - The Variable to be minimized.
      Throws:
      gurobi.GRBException - GRB Exception.
    • maximize

      public void maximize​(Variable variable) throws gurobi.GRBException
      Set the objective of this model to maximize the given expression.
      Parameters:
      variable - The Variable to be maximized.
      Throws:
      gurobi.GRBException - GRB Exception.
    • solve

      public void solve() throws gurobi.GRBException
      Solve this model and find the optimum solution.
      Throws:
      gurobi.GRBException - GRB Exception.
    • setTimeLimit

      public void setTimeLimit​(double time) throws gurobi.GRBException
      Limits 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.GRBException
      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.
      Parameters:
      gapAbs - Minimum value: 0 and Maximum value: Infinity
      Throws:
      gurobi.GRBException - Handled by client.`
    • setMIPGap

      public void setMIPGap​(double gap) throws gurobi.GRBException
      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. 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.GRBException
      Determines 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.GRBException
      Enables 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.GRBException
      The 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.GRBException
      Determines 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.GRBException
      Selects 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.GRBException
      Sets 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.GRBException
      This 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.GRBException
      Compute 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

      public java.util.ArrayList<Variable> getVariables()
    • getConstraints

      public java.util.ArrayList<Constraint> 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.