gurobi
Class GRBModel

java.lang.Object
  extended by gurobi.GRBModel

public class GRBModel
extends java.lang.Object

Gurobi model object. Commonly used methods include addVar (adds a new decision variable to the model), addConstr (adds a new constraint to the model), optimize (optimizes the current model), and get (retrieves the value of an attribute).

While the Java garbage collector will eventually collect an unused GRBModel object, the vast majority of the memory associated with a model is stored outside of the Java heap. As a result, the garbage collector can't see this memory usage, and thus it can't take this quantity into account when deciding whether collection is necessary. We recommend that you call GRBModel.dispose when you are done using a model.


Constructor Summary
GRBModel(GRBEnv env)
          Model constructor.
GRBModel(GRBEnv env, java.lang.String filename)
          Read a model from a file.
GRBModel(GRBModel model)
          Create a copy of an existing model.
 
Method Summary
 GRBConstr addConstr(double lhs, char sense, GRBLinExpr rhsExpr, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr addConstr(double lhs, char sense, GRBVar rhsVar, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr addConstr(GRBLinExpr lhsExpr, char sense, double rhs, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr addConstr(GRBLinExpr lhsExpr, char sense, GRBLinExpr rhsExpr, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr addConstr(GRBLinExpr lhsExpr, char sense, GRBVar rhsVar, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr addConstr(GRBVar lhsVar, char sense, double rhs, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr addConstr(GRBVar lhsVar, char sense, GRBLinExpr rhsExpr, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr addConstr(GRBVar lhsVar, char sense, GRBVar rhsVar, java.lang.String name)
          Add a single linear constraint to a model.
 GRBConstr[] addConstrs(GRBLinExpr[] lhsExprs, char[] senses, double[] rhss, java.lang.String[] names)
          Add new linear constraints to a model.
 GRBConstr[] addConstrs(GRBLinExpr[] lhsExprs, char[] senses, double[] rhss, java.lang.String[] names, int start, int len)
          Add new linear constraints to a model.
 GRBConstr[] addConstrs(int count)
          Add count new linear constraints to a model.
 GRBGenConstr addGenConstrAbs(GRBVar resvar, GRBVar argvar, java.lang.String name)
          Add a new general constraint of type GRB.GENCONSTR_ABS to a model.
 GRBGenConstr addGenConstrAnd(GRBVar resvar, GRBVar[] vars, java.lang.String name)
          Add a new general constraint of type GRB.GENCONSTR_AND to a model.
 GRBGenConstr addGenConstrIndicator(GRBVar binvar, int binval, GRBLinExpr expr, char sense, double rhs, java.lang.String name)
          Add a new general constraint of type GRB.GENCONSTR_INDICATOR to a model.
 GRBGenConstr addGenConstrMax(GRBVar resvar, GRBVar[] vars, double constant, java.lang.String name)
          Add a new general constraint of type GRB.GENCONSTR_MAX to a model.
 GRBGenConstr addGenConstrMin(GRBVar resvar, GRBVar[] vars, double constant, java.lang.String name)
          Add a new general constraint of type GRB.GENCONSTR_MIN to a model.
 GRBGenConstr addGenConstrOr(GRBVar resvar, GRBVar[] vars, java.lang.String name)
          Add a new general constraint of type GRB.GENCONSTR_OR to a model.
 GRBQConstr addQConstr(double lhs, char sense, GRBQuadExpr rhsExpr, java.lang.String name)
          Add a quadratic constraint to a model.
 GRBQConstr addQConstr(GRBLinExpr lhsExpr, char sense, GRBQuadExpr rhsExpr, java.lang.String name)
          Add a quadratic constraint to a model.
 GRBQConstr addQConstr(GRBQuadExpr lhsExpr, char sense, double rhs, java.lang.String name)
          Add a quadratic constraint to a model.
 GRBQConstr addQConstr(GRBQuadExpr lhsExpr, char sense, GRBLinExpr rhsExpr, java.lang.String name)
          Add a quadratic constraint to a model.
 GRBQConstr addQConstr(GRBQuadExpr lhsExpr, char sense, GRBQuadExpr rhsExpr, java.lang.String name)
          Add a quadratic constraint to a model.
 GRBQConstr addQConstr(GRBQuadExpr lhsExpr, char sense, GRBVar rhsVar, java.lang.String name)
          Add a quadratic constraint to a model.
 GRBQConstr addQConstr(GRBVar lhsVar, char sense, GRBQuadExpr rhsExpr, java.lang.String name)
          Add a quadratic constraint to a model.
 GRBConstr addRange(GRBLinExpr expr, double lower, double upper, java.lang.String name)
          Add a single range constraint to a model.
 GRBConstr[] addRanges(GRBLinExpr[] exprs, double[] lower, double[] upper, java.lang.String[] names)
          Add new range constraints to a model.
 gurobi.GRBSOS addSOS(GRBVar[] vars, double[] weights, int type)
          Add an SOS constraint to the model.
 GRBVar addVar(double lb, double ub, double obj, char type, GRBColumn col, java.lang.String name)
          Add a variable to a model.
 GRBVar addVar(double lb, double ub, double obj, char type, GRBConstr[] constrs, double[] coeffs, java.lang.String name)
          Add a variable to a model, and the associated non-zero coefficients.
 GRBVar addVar(double lb, double ub, double obj, char type, java.lang.String name)
          Add a variable to a model; non-zero entries will be added later.
 GRBVar[] addVars(double[] lb, double[] ub, double[] obj, char[] type, java.lang.String[] names)
          Add new decision variables to a model.
 GRBVar[] addVars(double[] lb, double[] ub, double[] obj, char[] type, java.lang.String[] names, GRBColumn[] cols)
          Add new decision variables to a model.
 GRBVar[] addVars(double[] lb, double[] ub, double[] obj, char[] type, java.lang.String[] names, int start, int len)
          Add new decision variables to a model.
 GRBVar[] addVars(int count, char type)
          Add count new decision variables to a model.
 void BasisHead(int[] bhead)
           
 int BinvColj(int col, int[] xind, double[] xval)
           
 int Binvi(int i, int[] xind, double[] xval)
           
 int Binvj(int j, int[] xind, double[] xval)
           
 int BinvRowi(int i, int[] xind, double[] xval)
           
 int BSolve(int blen, int[] bind, double[] bval, int[] xind, double[] xval)
           
 void check()
           
 void chgCoeff(GRBConstr constr, GRBVar var, double newval)
          Change one coefficient in the model.
 void chgCoeffs(GRBConstr[] constrs, GRBVar[] vars, double[] newvals)
          Change a list of coefficients in the model.
 void computeIIS()
          Compute an Irreducible Inconsistent Subsystem (IIS).
 void discardConcurrentEnvs()
          Discard concurrent environments for a model.
 void discardMultiobjEnvs()
          \discardmultiobjenvsdesc
 void dispose()
          Release the resources associated with a GRBModel object.
 GRBModel feasibility()
           
 double feasRelax(int relaxobjtype, boolean minrelax, boolean vrelax, boolean crelax)
          Simplified method for creating a feasibility relaxation model.
 double feasRelax(int relaxobjtype, boolean minrelax, GRBVar[] vars, double[] lbpen, double[] ubpen, GRBConstr[] constrs, double[] rhspen)
          Create a feasibility relaxation model.
protected  void finalize()
           
 GRBModel fixedModel()
          Create the fixed model associated with a MIP model.
 int FSolve(int blen, int[] bind, double[] bval, int[] xind, double[] xval)
           
 char[] get(GRB.CharAttr attr, GRBConstr[] constrs)
          Query a char-valued constraint attribute for an array of constraints.
 char[][] get(GRB.CharAttr attr, GRBConstr[][] constrs)
          Query a char-valued constraint attribute for a two-dimensional array of constraints.
 char[][][] get(GRB.CharAttr attr, GRBConstr[][][] constrs)
          Query a char-valued constraint attribute for a three-dimensional array of constraints.
 char[] get(GRB.CharAttr attr, GRBConstr[] constrs, int start, int len)
          Query a char-valued constraint attribute for a sub-array of constraints.
 char[] get(GRB.CharAttr attr, GRBQConstr[] qconstrs)
          Query a char-valued quadratic constraint attribute for an array of quadratic constraints.
 char[][] get(GRB.CharAttr attr, GRBQConstr[][] qconstrs)
          Query a char-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.
 char[][][] get(GRB.CharAttr attr, GRBQConstr[][][] qconstrs)
          Query a char-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.
 char[] get(GRB.CharAttr attr, GRBQConstr[] qconstrs, int start, int len)
          Query a char-valued quadratic constraint attribute for a sub-array of quadratic constraints.
 char[] get(GRB.CharAttr attr, GRBVar[] vars)
          Query a char-valued variable attribute for an array of variables.
 char[][] get(GRB.CharAttr attr, GRBVar[][] vars)
          Query a char-valued variable attribute for a two-dimensional array of variables.
 char[][][] get(GRB.CharAttr attr, GRBVar[][][] vars)
          Query a char-valued variable attribute for a three-dimensional array of variables.
 char[] get(GRB.CharAttr attr, GRBVar[] vars, int start, int len)
          Query a char-valued variable attribute for a sub-array of variables.
 double get(GRB.DoubleAttr attr)
          Query the value of a double-valued model attribute.
 double[] get(GRB.DoubleAttr attr, GRBConstr[] constrs)
          Query a double-valued constraint attribute for an array of constraints.
 double[][] get(GRB.DoubleAttr attr, GRBConstr[][] constrs)
          Query a double-valued constraint attribute for a two-dimensional array of constraints.
 double[][][] get(GRB.DoubleAttr attr, GRBConstr[][][] constrs)
          Query a double-valued constraint attribute for a three-dimensional array of constraints.
 double[] get(GRB.DoubleAttr attr, GRBConstr[] constrs, int start, int len)
          Query a double-valued constraint attribute for a sub-array of constraints.
 double[] get(GRB.DoubleAttr attr, GRBQConstr[] qconstrs)
          Query a double-valued quadratic constraint attribute for an array of quadratic constraints.
 double[][] get(GRB.DoubleAttr attr, GRBQConstr[][] qconstrs)
          Query a double-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.
 double[][][] get(GRB.DoubleAttr attr, GRBQConstr[][][] qconstrs)
          Query a double-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.
 double[] get(GRB.DoubleAttr attr, GRBQConstr[] qconstrs, int start, int len)
          Query a double-valued quadratic constraint attribute for a sub-array of quadratic constraints.
 double[] get(GRB.DoubleAttr attr, GRBVar[] vars)
          Query a double-valued variable attribute for an array of variables.
 double[][] get(GRB.DoubleAttr attr, GRBVar[][] vars)
          Query a double-valued variable attribute for a two-dimensional array of variables.
 double[][][] get(GRB.DoubleAttr attr, GRBVar[][][] vars)
          Query a double-valued variable attribute for a three-dimensional array of variables.
 double[] get(GRB.DoubleAttr attr, GRBVar[] vars, int start, int len)
          Query a double-valued variable attribute for a sub-array of variables.
 double get(GRB.DoubleParam param)
          Query the value of a double-valued parameter.
 int get(GRB.IntAttr attr)
          Query the value of an int-valued model attribute.
 int[] get(GRB.IntAttr attr, GRBConstr[] constrs)
          Query an int-valued constraint attribute for an array of constraints.
 int[][] get(GRB.IntAttr attr, GRBConstr[][] constrs)
          Query an int-valued constraint attribute for a two-dimensional array of constraints.
 int[][][] get(GRB.IntAttr attr, GRBConstr[][][] constrs)
          Query an int-valued constraint attribute for a three-dimensional array of constraints.
 int[] get(GRB.IntAttr attr, GRBConstr[] constrs, int start, int len)
          Query an int-valued constraint attribute for a sub-array of constraints.
 int[] get(GRB.IntAttr attr, GRBGenConstr[] genconstrs)
          Query an int-valued general constraint attribute for an array of general constraints.
 int[][] get(GRB.IntAttr attr, GRBGenConstr[][] genconstrs)
          Query an int-valued general constraint attribute for a two-dimensional array of general constraints.
 int[][][] get(GRB.IntAttr attr, GRBGenConstr[][][] genconstrs)
          Query an int-valued general constraint attribute for a three- dimensional array of general constraints.
 int[] get(GRB.IntAttr attr, GRBGenConstr[] genconstrs, int start, int len)
          Query an int-valued general constraint attribute for a sub-array of general constraints.
 int[] get(GRB.IntAttr attr, GRBQConstr[] qconstrs)
          Query an int-valued quadratic constraint attribute for an array of quadratic constraints.
 int[][] get(GRB.IntAttr attr, GRBQConstr[][] qconstrs)
          Query an int-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.
 int[][][] get(GRB.IntAttr attr, GRBQConstr[][][] qconstrs)
          Query an int-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.
 int[] get(GRB.IntAttr attr, GRBQConstr[] qconstrs, int start, int len)
          Query an int-valued quadratic constraint attribute for a sub-array of quadratic constraints.
 int[] get(GRB.IntAttr attr, GRBVar[] vars)
          Query an int-valued variable attribute for an array of variables.
 int[][] get(GRB.IntAttr attr, GRBVar[][] vars)
          Query an int-valued variable attribute for a two-dimensional array of variables.
 int[][][] get(GRB.IntAttr attr, GRBVar[][][] vars)
          Query an int-valued variable attribute for a three-dimensional array of variables.
 int[] get(GRB.IntAttr attr, GRBVar[] vars, int start, int len)
          Query an int-valued variable attribute for a sub-array of variables.
 int get(GRB.IntParam param)
          Query the value of an int-valued parameter.
 java.lang.String get(GRB.StringAttr attr)
          Query the value of a string-valued model attribute.
 java.lang.String[] get(GRB.StringAttr attr, GRBConstr[] constrs)
          Query a String-valued constraint attribute for an array of constraints.
 java.lang.String[][] get(GRB.StringAttr attr, GRBConstr[][] constrs)
          Query a String-valued constraint attribute for a two-dimensional array of constraints.
 java.lang.String[][][] get(GRB.StringAttr attr, GRBConstr[][][] constrs)
          Query a String-valued constraint attribute for a three-dimensional array of constraints.
 java.lang.String[] get(GRB.StringAttr attr, GRBConstr[] constrs, int start, int len)
          Query a String-valued constraint attribute for a sub-array of constraints.
 java.lang.String[] get(GRB.StringAttr attr, GRBGenConstr[] genconstrs)
          Query a String-valued general constraint attribute for an array of general constraints.
 java.lang.String[][] get(GRB.StringAttr attr, GRBGenConstr[][] genconstrs)
          Query a String-valued constraint attribute for a two-dimensional array of general constraints.
 java.lang.String[][][] get(GRB.StringAttr attr, GRBGenConstr[][][] genconstrs)
          Query a String-valued constraint attribute for a three-dimensional array of general constraints.
 java.lang.String[] get(GRB.StringAttr attr, GRBGenConstr[] genconstrs, int start, int len)
          Query a String-valued general constraint attribute for a sub-array of constraints.
 java.lang.String[] get(GRB.StringAttr attr, GRBQConstr[] qconstrs)
          Query a String-valued quadratic constraint attribute for an array of quadratic constraints.
 java.lang.String[][] get(GRB.StringAttr attr, GRBQConstr[][] qconstrs)
          Query a String-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.
 java.lang.String[][][] get(GRB.StringAttr attr, GRBQConstr[][][] qconstrs)
          Query a String-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.
 java.lang.String[] get(GRB.StringAttr attr, GRBQConstr[] qconstrs, int start, int len)
          Query a String-valued quadratic constraint attribute for a sub-array of quadratic constraints.
 java.lang.String[] get(GRB.StringAttr attr, GRBVar[] vars)
          Query a String-valued variable attribute for an array of variables.
 java.lang.String[][] get(GRB.StringAttr attr, GRBVar[][] vars)
          Query a String-valued variable attribute for a two-dimensional array of variables.
 java.lang.String[][][] get(GRB.StringAttr attr, GRBVar[][][] vars)
          Query a String-valued variable attribute for a three-dimensional array of variables.
 java.lang.String[] get(GRB.StringAttr attr, GRBVar[] vars, int start, int len)
          Query a String-valued variable attribute for a sub-array of variables.
 java.lang.String get(GRB.StringParam param)
          Query the value of a string-valued parameter.
 double getCoeff(GRBConstr constr, GRBVar var)
          Query the coefficient of variable var in linear constraint constr (note that the result can be zero).
 GRBColumn getCol(GRBVar var)
          Retrieve the list of constraints in which a variable participates, and the associated coefficients.
 GRBEnv getConcurrentEnv(int num)
          Create/retrieve a concurrent environment for a model.
 GRBConstr getConstr(int i)
           
 GRBConstr getConstrByName(java.lang.String name)
          Retrieve a linear constraint from its name.
 GRBConstr[] getConstrs()
          Retrieve an array of all linear constraints in the model.
 GRBEnv getEnv()
          Query the environment associated with the model.
 void getGenConstrAbs(GRBGenConstr genc, GRBVar[] resvar, GRBVar[] argvar)
          Any combination of the following two arguments can be null.
 void getGenConstrAnd(GRBGenConstr genc, GRBVar[] resvar, GRBVar[] vars, int[] len)
          Any combination of the following four arguments can be null.
 void getGenConstrIndicator(GRBGenConstr genc, GRBVar[] binvar, int[] binval, GRBLinExpr[] expr, char[] sense, double[] rhs)
          Any combination of the following five arguments can be null.
 void getGenConstrMax(GRBGenConstr genc, GRBVar[] resvar, GRBVar[] vars, int[] len, double[] constant)
          Any combination of the following four arguments can be null.
 void getGenConstrMin(GRBGenConstr genc, GRBVar[] resvar, GRBVar[] vars, int[] len, double[] constant)
          Any combination of the following four arguments can be null.
 void getGenConstrOr(GRBGenConstr genc, GRBVar[] resvar, GRBVar[] vars, int[] len)
          Any combination of the following four arguments can be null.
 GRBGenConstr[] getGenConstrs()
          Retrieve an array of all general constraints in the model.
 GRBEnv getMultiobjEnv(int num)
          \getmultiobjenvdesc
 GRBExpr getObjective()
          Retrieve the optimization objective.
 GRBLinExpr getObjective(int index)
          Retrieve an alternative optimization objective.
 int getPWLObj(GRBVar var, double[] x, double[] y)
          Retrieve the piecewise-linear objective function for a variable.
 GRBQConstr[] getQConstrs()
          Retrieve an array of all quadratic constraints in the model.
 GRBQuadExpr getQCRow(GRBQConstr qc)
          Retrieve the left-hand side expression from a quadratic constraint.
 GRBLinExpr getRow(GRBConstr constr)
          Retrieve a list of variables that participate in a constraint, and the associated coefficients.
 int getSOS(gurobi.GRBSOS sos, GRBVar[] vars, double[] weights, int[] type)
          Retrieve the list of variables that participate in an SOS constraint, and the associated coefficients.
 gurobi.GRBSOS[] getSOSs()
          Retrieve an array of all SOS constraints in the model.
 void getTuneResult(int i)
          Use this method to retrieve the results of a previous tune call.
 GRBVar getVar(int i)
           
 GRBVar getVarByName(java.lang.String name)
          Retrieve a variable from its name.
 GRBVar[] getVars()
          Retrieve an array of all variables in the model.
 GRBModel linearize()
           
 void optimize()
          Optimize the model.
 void optimizeasync()
          Optimize a model asynchronously.
 GRBModel presolve()
          Perform presolve on a model.
 void read(java.lang.String filename)
          This method is the general entry point for importing data from a file into a model.
 GRBModel relax()
           
 void remove(GRBConstr constr)
          Remove a linear constraint from the model.
 void remove(GRBGenConstr genconstr)
          Remove a general constraint from the model.
 void remove(GRBQConstr qconstr)
          Remove a quadratic constraint from the model.
 void remove(gurobi.GRBSOS sos)
          Remove an SOS constraint from the model.
 void remove(GRBVar var)
          Remove a variable from the model.
 void reset()
          Reset the model to an unsolved state, discarding any previously computed solution information.
 void reset(int clearall)
          Reset the model to an unsolved state, discarding any previously computed solution information.
 void set(GRB.CharAttr attr, GRBConstr[][][] constrs, char[][][] newvals)
          Set a char-valued constraint attribute for a three-dimensional array of constraints.
 void set(GRB.CharAttr attr, GRBConstr[][] constrs, char[][] newvals)
          Set a char-valued constraint attribute for a two-dimensional array of constraints.
 void set(GRB.CharAttr attr, GRBConstr[] constrs, char[] newvals)
          Set a char-valued constraint attribute for an array of constraints.
 void set(GRB.CharAttr attr, GRBConstr[] constrs, char[] newvals, int start, int len)
          Set a char-valued constraint attribute for a sub-array of constraints.
 void set(GRB.CharAttr attr, GRBQConstr[][][] qconstrs, char[][][] newvals)
          Set a char-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.
 void set(GRB.CharAttr attr, GRBQConstr[][] qconstrs, char[][] newvals)
          Set a char-valued quadratic constraint attribute for a two-dimensional array of quadratic constraints.
 void set(GRB.CharAttr attr, GRBQConstr[] qconstrs, char[] newvals)
          Set a char-valued quadratic constraint attribute for an array of quadratic constraints.
 void set(GRB.CharAttr attr, GRBQConstr[] qconstrs, char[] newvals, int start, int len)
          Set a char-valued quadratic constraint attribute for a sub-array of quadratic constraints.
 void set(GRB.CharAttr attr, GRBVar[][][] vars, char[][][] newvals)
          Set a char-valued variable attribute for a three-dimensional array of variables.
 void set(GRB.CharAttr attr, GRBVar[][] vars, char[][] newvals)
          Set a char-valued variable attribute for a two-dimensional array of variables.
 void set(GRB.CharAttr attr, GRBVar[] vars, char[] newvals)
          Set a char-valued variable attribute for an array of variables.
 void set(GRB.CharAttr attr, GRBVar[] vars, char[] newvals, int start, int len)
          Set a char-valued variable attribute for a sub-array of variables.
 void set(GRB.DoubleAttr attr, double newval)
          Set the value of a double-valued model attribute.
 void set(GRB.DoubleAttr attr, GRBConstr[][][] constrs, double[][][] newvals)
          Set a double-valued constraint attribute for a three-dimensional array of constraints.
 void set(GRB.DoubleAttr attr, GRBConstr[][] constrs, double[][] newvals)
          Set a double-valued constraint attribute for a two-dimensional array of constraints.
 void set(GRB.DoubleAttr attr, GRBConstr[] constrs, double[] newvals)
          Set a double-valued constraint attribute for an array of constraints.
 void set(GRB.DoubleAttr attr, GRBConstr[] constrs, double[] newvals, int start, int len)
          Set a double-valued constraint attribute for a sub-array of constraints.
 void set(GRB.DoubleAttr attr, GRBQConstr[][][] qconstrs, double[][][] newvals)
          Set a double-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.
 void set(GRB.DoubleAttr attr, GRBQConstr[][] qconstrs, double[][] newvals)
          Set a double-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.
 void set(GRB.DoubleAttr attr, GRBQConstr[] qconstrs, double[] newvals)
          Set a double-valued quadratic constraint attribute for an array of quadratic constraints.
 void set(GRB.DoubleAttr attr, GRBQConstr[] qconstrs, double[] newvals, int start, int len)
          Set a double-valued quadratic constraint attribute for a sub-array of quadratic constraints.
 void set(GRB.DoubleAttr attr, GRBVar[][][] vars, double[][][] newvals)
          Set a double-valued variable attribute for a three-dimensional array of variables.
 void set(GRB.DoubleAttr attr, GRBVar[][] vars, double[][] newvals)
          Set a double-valued variable attribute for a two-dimensional array of variables.
 void set(GRB.DoubleAttr attr, GRBVar[] vars, double[] newvals)
          Set a double-valued variable attribute for an array of variables.
 void set(GRB.DoubleAttr attr, GRBVar[] vars, double[] newvals, int start, int len)
          Set a double-valued variable attribute for a sub-array of variables.
 void set(GRB.DoubleParam param, double newval)
          Set the value of a double-valued parameter.
 void set(GRB.IntAttr attr, GRBConstr[][][] constrs, int[][][] newvals)
          Set an int-valued constraint attribute for a three-dimensional array of constraints.
 void set(GRB.IntAttr attr, GRBConstr[][] constrs, int[][] newvals)
          Set an int-valued constraint attribute for a two-dimensional array of constraints.
 void set(GRB.IntAttr attr, GRBConstr[] constrs, int[] newvals)
          Set an int-valued constraint attribute for an array of constraints.
 void set(GRB.IntAttr attr, GRBConstr[] constrs, int[] newvals, int start, int len)
          Set an int-valued constraint attribute for a sub-array of constraints.
 void set(GRB.IntAttr attr, GRBVar[][][] vars, int[][][] newvals)
          Set an int-valued variable attribute for a three-dimensional array of variables.
 void set(GRB.IntAttr attr, GRBVar[][] vars, int[][] newvals)
          Set an int-valued variable attribute for a two-dimensional array of variables.
 void set(GRB.IntAttr attr, GRBVar[] vars, int[] newvals)
          Set an int-valued variable attribute for an array of variables.
 void set(GRB.IntAttr attr, GRBVar[] vars, int[] newvals, int start, int len)
          Set an int-valued variable attribute for a sub-array of variables.
 void set(GRB.IntAttr attr, int newval)
          Set the value of an int-valued model attribute.
 void set(GRB.IntParam param, int newval)
          Set the value of an int-valued parameter.
 void set(GRB.StringAttr attr, GRBConstr[][][] constrs, java.lang.String[][][] newvals)
          Set a String-valued constraint attribute for a three-dimensional array of constraints.
 void set(GRB.StringAttr attr, GRBConstr[][] constrs, java.lang.String[][] newvals)
          Set a String-valued constraint attribute for a two-dimensional array of constraints.
 void set(GRB.StringAttr attr, GRBConstr[] constrs, java.lang.String[] newvals)
          Set a String-valued constraint attribute for an array of constraints.
 void set(GRB.StringAttr attr, GRBConstr[] constrs, java.lang.String[] newvals, int start, int len)
          Set a String-valued constraint attribute for a sub-array of constraints.
 void set(GRB.StringAttr attr, GRBGenConstr[][][] genconstrs, java.lang.String[][][] newvals)
          Set a String-valued general constraint attribute for a three- dimensional array of general constraints.
 void set(GRB.StringAttr attr, GRBGenConstr[][] genconstrs, java.lang.String[][] newvals)
          Set a String-valued general constraint attribute for a two-dimensional array of general constraints.
 void set(GRB.StringAttr attr, GRBGenConstr[] genconstrs, java.lang.String[] newvals)
          Set a String-valued general constraint attribute for an array of general constraints.
 void set(GRB.StringAttr attr, GRBGenConstr[] genconstrs, java.lang.String[] newvals, int start, int len)
          Set a String-valued general constraint attribute for a sub-array of general constraints.
 void set(GRB.StringAttr attr, GRBQConstr[][][] qconstrs, java.lang.String[][][] newvals)
          Set a String-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.
 void set(GRB.StringAttr attr, GRBQConstr[][] qconstrs, java.lang.String[][] newvals)
          Set a String-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.
 void set(GRB.StringAttr attr, GRBQConstr[] qconstrs, java.lang.String[] newvals)
          Set a String-valued quadratic constraint attribute for an array of quadratic constraints.
 void set(GRB.StringAttr attr, GRBQConstr[] qconstrs, java.lang.String[] newvals, int start, int len)
          Set a String-valued quadratic constraint attribute for a sub-array of quadratic constraints.
 void set(GRB.StringAttr attr, GRBVar[][][] vars, java.lang.String[][][] newvals)
          Set a String-valued variable attribute for a three-dimensional array of variables.
 void set(GRB.StringAttr attr, GRBVar[][] vars, java.lang.String[][] newvals)
          Set a String-valued variable attribute for a two-dimensional array of variables.
 void set(GRB.StringAttr attr, GRBVar[] vars, java.lang.String[] newvals)
          Set a String-valued variable attribute for an array of variables.
 void set(GRB.StringAttr attr, GRBVar[] vars, java.lang.String[] newvals, int start, int len)
          Set a String-valued variable attribute for a sub-array of variables.
 void set(GRB.StringAttr attr, java.lang.String newval)
          Set the value of a String-valued model attribute.
 void set(GRB.StringParam param, java.lang.String newval)
          Set the value of a string-valued parameter.
 void set(java.lang.String param, java.lang.String newval)
          Set the value of any parameter using strings alone.
 void setCallback(GRBCallback cb)
          Set the callback object for a model.
 void setObjective(GRBExpr expr)
          Set the model objective.
 void setObjective(GRBExpr expr, int sense)
          Set the model objective, and the objective sense (GRB.MINIMIZE for minimization, GRB.MAXIMIZE for maximization).
 void setObjectiveN(GRBLinExpr expr, int index, int priority, double weight, double abstol, double reltol, java.lang.String name)
          Set an alternative optimization objective equal to a linear expression.
 void setPWLObj(GRBVar var, double[] x, double[] y)
          Set the piecewise-linear objective function for a variable.
 void sync()
          Wait for a previous asynchronous optimization call to complete.
 void terminate()
          Generate a request to terminate the current optimization.
 void tune()
          Perform an automated search for parameter settings that improve performance.
 void update()
          Process any pending model modifications.
 void write(java.lang.String filename)
          \GRBwriteFilenameArgument{GRBModel.computeIIS}{javamethod:GRBModel.com puteIIS}
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GRBModel

public GRBModel(GRBEnv env)
         throws GRBException
Model constructor.

Parameters:
env - Environment for new model.
Throws:
GRBException

GRBModel

public GRBModel(GRBEnv env,
                java.lang.String filename)
         throws GRBException
Read a model from a file. Note that the type of the file is encoded in the file name suffix. Valid suffixes are .mps, .rew, .lp, .rlp, .ilp, or .opb. The files can be compressed, so additional suffixes of .zip, .gz, .bz2, or .7z are accepted.

Parameters:
env - Environment for new model.
filename - Name of the file containing the model.
Throws:
GRBException

GRBModel

public GRBModel(GRBModel model)
         throws GRBException
Create a copy of an existing model. Note that due to the lazy update approach in Gurobi, you have to call update before copying it.

Parameters:
model - Model to copy.
Throws:
GRBException
Method Detail

dispose

public void dispose()
Release the resources associated with a GRBModel object. While the Java garbage collector will eventually reclaim these resources, we recommend that you call the dispose method when you are done using a model.

You should not attempt to use a GRBModel object after calling dispose on it.


finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

read

public void read(java.lang.String filename)
          throws GRBException
This method is the general entry point for importing data from a file into a model. It can be used to read basis files for continuous models, start vectors for MIP models, or parameter settings. The type of data read is determined by the file suffix. File formats are described in the File Formats section of the Reference Manual.

Note that this is not the method to use if you want to read a new model from a file. For that, use the GRBModel constructor. One variant of the constructor takes the name of the file that contains the new model as its argument.

Parameters:
filename - Name of the file to read. The suffix on the file must be either .bas (for an LP basis), .mst or .sol (for a MIP start), .hnt (for MIP hints), .ord (for a priority order), or .prm (for a parameter file). The suffix may optionally be followed by .zip, .gz, .bz2, or .7z.
Throws:
GRBException

write

public void write(java.lang.String filename)
           throws GRBException
\GRBwriteFilenameArgument{GRBModel.computeIIS}{javamethod:GRBModel.com puteIIS}

Parameters:
filename -
Throws:
GRBException

sync

public void sync()
          throws GRBException
Wait for a previous asynchronous optimization call to complete.

Calling optimizeasync returns control to the calling routine immediately. The caller can perform other computations while optimization proceeds, and can check on the progress of the optimization by querying various model attributes. The sync call forces the calling program to wait until the asynchronous optimization call completes. You must call sync before the corresponding model object is deleted.

The sync call throws an exception if the optimization itself ran into any problems. In other words, exceptions thrown by this method are those that optimize itself would have thrown, had the original method not been asynchronous.

Note that you need to call sync even if you know that the asynchronous optimization has already completed.

Throws:
GRBException

relax

public GRBModel relax()
               throws GRBException
Throws:
GRBException

fixedModel

public GRBModel fixedModel()
                    throws GRBException
Create the fixed model associated with a MIP model. The MIP model must have a solution loaded (e.g., after a call to the optimize method). In the fixed model, each integer variable is fixed to the value that variable takes in the MIP solution.

Throws:
GRBException

presolve

public GRBModel presolve()
                  throws GRBException
Perform presolve on a model.

Throws:
GRBException

feasibility

public GRBModel feasibility()
                     throws GRBException
Throws:
GRBException

linearize

public GRBModel linearize()
                   throws GRBException
Throws:
GRBException

feasRelax

public double feasRelax(int relaxobjtype,
                        boolean minrelax,
                        boolean vrelax,
                        boolean crelax)
                 throws GRBException
Simplified method for creating a feasibility relaxation model.

Parameters:
relaxobjtype - The cost function used when finding the minimum cost relaxation.
minrelax - The type of feasibility relaxation to perform.
vrelax - Indicates whether variable bounds can be relaxed (with a cost of 1.0 for any violations.
crelax - Indicates whether linear constraints can be relaxed (with a cost of 1.0 for any violations.
Returns:
Zero if minrelax is false. If minrelax is true, the return value is the objective value for the relaxation performed. If the value is less than 0, it indicates that the method failed to create the feasibility relaxation.
Throws:
GRBException

feasRelax

public double feasRelax(int relaxobjtype,
                        boolean minrelax,
                        GRBVar[] vars,
                        double[] lbpen,
                        double[] ubpen,
                        GRBConstr[] constrs,
                        double[] rhspen)
                 throws GRBException
Create a feasibility relaxation model.

Parameters:
relaxobjtype - The cost function used when finding the minimum cost relaxation.
minrelax - The type of feasibility relaxation to perform.
vars - Variables whose bounds are allowed to be violated.
lbpen - Penalty for violating a variable lower bound. One entry for each variable in argument vars.
ubpen - Penalty for violating a variable upper bound. One entry for each variable in argument vars.
constrs - Linear constraints that are allowed to be violated.
rhspen - Penalty for violating a linear constraint. One entry for each variable in argument constr.
Returns:
Zero if minrelax is false. If minrelax is true, the return value is the objective value for the relaxation performed. If the value is less than 0, it indicates that the method failed to create the feasibility relaxation.
Throws:
GRBException

getVar

public GRBVar getVar(int i)

getVars

public GRBVar[] getVars()
Retrieve an array of all variables in the model.

Returns:
All variables in the model.

getVarByName

public GRBVar getVarByName(java.lang.String name)
                    throws GRBException
Retrieve a variable from its name. If multiple variables have the same name, this method chooses one arbitrarily. Returns null if no variable has that name.

Parameters:
name - The name of the desired variable.
Returns:
The requested variable.
Throws:
GRBException

getConstr

public GRBConstr getConstr(int i)

getConstrs

public GRBConstr[] getConstrs()
Retrieve an array of all linear constraints in the model.

Returns:
All linear constraints in the model.

getConstrByName

public GRBConstr getConstrByName(java.lang.String name)
                          throws GRBException
Retrieve a linear constraint from its name. If multiple linear constraints have the same name, this method chooses one arbitrarily. Returns null if no constraint has that name.

Parameters:
name - The name of the desired linear constraint.
Returns:
The requested linear constraint.
Throws:
GRBException

getSOSs

public gurobi.GRBSOS[] getSOSs()
Retrieve an array of all SOS constraints in the model.

Returns:
All SOS constraints in the model.

getQConstrs

public GRBQConstr[] getQConstrs()
Retrieve an array of all quadratic constraints in the model.

Returns:
All quadratic constraints in the model.

getGenConstrs

public GRBGenConstr[] getGenConstrs()
Retrieve an array of all general constraints in the model.

Returns:
All general constraints in the model.

getObjective

public GRBExpr getObjective()
                     throws GRBException
Retrieve the optimization objective.

Note that the constant and linear portions of the objective can also be retrieved using the ObjCon and Obj attributes.

Returns:
The model objective.
Throws:
GRBException

getObjective

public GRBLinExpr getObjective(int index)
                        throws GRBException
Retrieve an alternative optimization objective. Alternative objectives will always be linear. You can also use this routine to retrieve the primary objective (using index = 0), but you will get an exception if the primary objective contains quadratic terms.

Please refer to the discussion of Multiple Objectives for more information on the use of alternative objectives.

Note that alterative objectives can also be retrieved using the ObjNCon and ObjN attributes.

Parameters:
index - The index for the requested alternative objective.
Returns:
The requested alternative objective.
Throws:
GRBException

getPWLObj

public int getPWLObj(GRBVar var,
                     double[] x,
                     double[] y)
              throws GRBException
Retrieve the piecewise-linear objective function for a variable. The return value gives the number of points that define the function, and the x and y arguments give the coordinates of the points, respectively. The x and y arguments must be large enough to hold the result. Call this method with null values for x and y if you just want the number of points.

Refer to the description of setPWLObj for additional information on what the values in x and y mean.

Parameters:
var - The variable whose objective function is being retrieved.
x - The x values for the points that define the piecewise-linear function. These will always be in non-decreasing order.
y - The y values for the points that define the piecewise-linear function.
Returns:
The number of points that define the piecewise-linear objective function.
Throws:
GRBException

setObjective

public void setObjective(GRBExpr expr)
                  throws GRBException
Set the model objective. The sense of the objective is determined by the value of the ModelSense attribute.

Parameters:
expr - New model objective.
Throws:
GRBException

setObjective

public void setObjective(GRBExpr expr,
                         int sense)
                  throws GRBException
Set the model objective, and the objective sense (GRB.MINIMIZE for minimization, GRB.MAXIMIZE for maximization).

Parameters:
expr - New model objective.
sense - New optimization sense (GRB.MINIMIZE for minimization, GRB.MAXIMIZE for maximization).
Throws:
GRBException

setObjectiveN

public void setObjectiveN(GRBLinExpr expr,
                          int index,
                          int priority,
                          double weight,
                          double abstol,
                          double reltol,
                          java.lang.String name)
                   throws GRBException
Set an alternative optimization objective equal to a linear expression.

Please refer to the discussion of Multiple Objectives for more information on the use of alternative objectives.

Note that you can also modify an alternative objective using the ObjN variable attribute. If you wish to mix and match these two approaches, please note that this method replaces the entire existing objective, while the ObjN attribute can be used to modify individual terms.

Parameters:
expr - New alternative objective.
index - Index for new objective. If you use an index of 0, this routine will change the primary optimization objective.
priority - Priority for the alternative objective. This initializes the ObjNPriority attribute for this objective.
weight - Weight for the alternative objective. This initializes the ObjNWeight attribute for this objective.
abstol - Absolute tolerance for the alternative objective. This initializes the ObjNAbsTol attribute for this objective.
reltol - Relative tolerance for the alternative objective. This initializes the ObjNRelTol attribute for this objective.
name - Name of the alternative objective. This initializes the ObjNName attribute for this objective.
Throws:
GRBException

setPWLObj

public void setPWLObj(GRBVar var,
                      double[] x,
                      double[] y)
               throws GRBException
Set the piecewise-linear objective function for a variable.

Parameters:
var - The variable whose objective function is being set.
x - The x values for the points that define the piecewise-linear function. Must be in non-decreasing order.
y - The y values for the points that define the piecewise-linear function.
Throws:
GRBException

optimize

public void optimize()
              throws GRBException
Optimize the model. The algorithm used for the optimization depends on the model type (simplex or barrier for a continuous model; branch-and- cut for a MIP model). Upon successful completion, this method will populate the solution related attributes of the model. See the Attributes section in the Reference Manual for more information on attributes.

Please consult the Variables and Constraints section in the Reference Manual for a discussion of some of the practical issues associated with solving a precisely defined mathematical model using finite- precision floating-point arithmetic.

Note that this method will process all pending model modifications.

Throws:
GRBException

optimizeasync

public void optimizeasync()
                   throws GRBException
Optimize a model asynchronously. This routine returns immediately. Your program can perform other computations while optimization proceeds in the background. To check the state of the asynchronous optimization, query the Status attribute for the model. A value of IN_PROGRESS indicates that the optimization has not yet completed. When you are done with your foreground tasks, you must call sync to sync your foreground program with the asynchronous optimization task.

Note that the set of Gurobi calls that you are allowed to make while optimization is running in the background is severely limited. Specifically, you can only perform attribute queries, and only for a few attributes (listed below). Any other calls on the running model, or on any other models that were built within the same Gurobi environment, will fail with error code OPTIMIZATION_IN_PROGRESS.

Note that there are no such restrictions on models built in other environments. Thus, for example, you could create multiple environments, and then have a single foreground program launch multiple simultaneous asynchronous optimizations, each in its own environment.

As already noted, you are allowed to query the value of the Status attribute while an asynchronous optimization is in progress. The other attributes that can be queried are: ObjVal, ObjBound, IterCount, NodeCount, and BarIterCount. In each case, the returned value reflects progress in the optimization to that point. Any attempt to query the value of an attribute not on this list will return an OPTIMIZATION_IN_PROGRESS error.

Throws:
GRBException

computeIIS

public void computeIIS()
                throws GRBException
Compute an Irreducible Inconsistent Subsystem (IIS). An IIS is a subset of the constraints and variable bounds with the following properties:

Note that an infeasible model may have multiple IISs. The one returned by Gurobi is not necessarily the one with minimum cardinality; there may exist others with fewer constraints or bounds.

If an IIS computation is interrupted before completion, Gurobi will return the smallest IIS found to that point.

This method populates the IISCONSTR, IISQCONSTR, and IISGENCONSTR constraint attributes, the IISSOS SOS attribute, and the IISLB, and IISUB variable attributes. You can also obtain information about the results of the IIS computation by writing a .ilp format file (see GRBModel.write). This file contains only the IIS from the original model.

Note that this method can be used to compute IISs for both continuous and MIP models.

Throws:
GRBException

tune

public void tune()
          throws GRBException
Perform an automated search for parameter settings that improve performance. Upon completion, this method stores the best parameter sets it found. The number of stored parameter sets can be determined by querying the value of the TuneResultCount attribute. The actual settings can be retrieved using getTuneResult

Please refer to the Parameter Tuning section in the Reference Manual for details on the tuning tool.

Throws:
GRBException

getTuneResult

public void getTuneResult(int i)
                   throws GRBException
Use this method to retrieve the results of a previous tune call. Calling this method with argument n causes tuned parameter set n to be copied into the model. Parameter sets are stored in order of decreasing quality, with parameter set 0 being the best. The number of available sets is stored in attribute TuneResultCount.

Once you have retrieved a tuning result, you can call optimize to use these parameter settings to optimize the model, or write to write the changed parameters to a .prm file.

Please refer to the Parameter Tuning section in the Reference Manual for details on the tuning tool.

Parameters:
i - The index of the tuning result to retrieve. The best result is available as index 0. The number of stored results is available in attribute TuneResultCount.
Throws:
GRBException

reset

public void reset()
           throws GRBException
Reset the model to an unsolved state, discarding any previously computed solution information.

Throws:
GRBException

reset

public void reset(int clearall)
           throws GRBException
Reset the model to an unsolved state, discarding any previously computed solution information.

Parameters:
clearall - Should additional information such as MIP starts, variable hints, branching priorities, lazy flags, and partition information be cleared?
Throws:
GRBException

check

public void check()
           throws GRBException
Throws:
GRBException

terminate

public void terminate()
Generate a request to terminate the current optimization. This method can be called at any time during an optimization.


update

public void update()
            throws GRBException
Process any pending model modifications.

Throws:
GRBException

addVar

public GRBVar addVar(double lb,
                     double ub,
                     double obj,
                     char type,
                     java.lang.String name)
              throws GRBException
Add a variable to a model; non-zero entries will be added later.

Parameters:
lb - Lower bound for new variable.
ub - Upper bound for new variable.
obj - Objective coefficient for new variable.
type - Variable type for new variable (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT).
name - Name for new variable.
Returns:
New variable object.
Throws:
GRBException

addVar

public GRBVar addVar(double lb,
                     double ub,
                     double obj,
                     char type,
                     GRBConstr[] constrs,
                     double[] coeffs,
                     java.lang.String name)
              throws GRBException
Add a variable to a model, and the associated non-zero coefficients.

Parameters:
lb - Lower bound for new variable.
ub - Upper bound for new variable.
obj - Objective coefficient for new variable.
type - Variable type for new variable (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT).
constrs - Array of constraints in which the variable participates.
coeffs - Array of coefficients for each constraint in which the variable participates. The lengths of the constrs and coeffs arrays must be identical.
name - Name for new variable.
Returns:
New variable object.
Throws:
GRBException

addVar

public GRBVar addVar(double lb,
                     double ub,
                     double obj,
                     char type,
                     GRBColumn col,
                     java.lang.String name)
              throws GRBException
Add a variable to a model. This signature allows you to specify the set of constraints to which the new variable belongs using a GRBColumn object.

Parameters:
lb - Lower bound for new variable.
ub - Upper bound for new variable.
obj - Objective coefficient for new variable.
type - Variable type for new variable (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT).
col - GRBColumn object for specifying a set of constraints to which new variable belongs.
name - Name for new variable.
Returns:
New variable object.
Throws:
GRBException

addVars

public GRBVar[] addVars(int count,
                        char type)
                 throws GRBException
Add count new decision variables to a model. All associated attributes take their default values, except the variable type, which is specified as an argument.

Parameters:
count - Number of variables to add.
type - Variable type for new variables (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT).
Returns:
Array of new variable objects.
Throws:
GRBException

addVars

public GRBVar[] addVars(double[] lb,
                        double[] ub,
                        double[] obj,
                        char[] type,
                        java.lang.String[] names)
                 throws GRBException
Add new decision variables to a model. The number of added variables is determined by the length of the input arrays (which must be consistent across all arguments).

Parameters:
lb - Lower bounds for new variables. Can be null, in which case the variables get lower bounds of 0.0.
ub - Upper bounds for new variables. Can be null, in which case the variables get infinite upper bounds.
obj - Objective coefficients for new variables. Can be null, in which case the variables get objective coefficients of 0.0.
type - Variable types for new variables (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT). Can be null, in which case the variables are assumed to be continuous.
names - Names for new variables. Can be null, in which case all variables are given default names.
Returns:
Array of new variable objects.
Throws:
GRBException

addVars

public GRBVar[] addVars(double[] lb,
                        double[] ub,
                        double[] obj,
                        char[] type,
                        java.lang.String[] names,
                        int start,
                        int len)
                 throws GRBException
Add new decision variables to a model. This signature allows you to use arrays to hold the various variable attributes (lower bound, upper bound, etc.), without forcing you to add a variable for each entry in the array. The start and len arguments allow you to specify which variables to add.

Parameters:
lb - Lower bounds for new variables. Can be null, in which case the variables get lower bounds of 0.0.
ub - Upper bounds for new variables. Can be null, in which case the variables get infinite upper bounds.
obj - Objective coefficients for new variables. Can be null, in which case the variables get objective coefficients of 0.0.
type - Variable types for new variables (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT). Can be null, in which case the variables are assumed to be continuous.
names - Names for new variables. Can be null, in which case all variables are given default names.
start - The first variable in the list to add.
len - The number of variables to add.
Returns:
Array of new variable objects.
Throws:
GRBException

addVars

public GRBVar[] addVars(double[] lb,
                        double[] ub,
                        double[] obj,
                        char[] type,
                        java.lang.String[] names,
                        GRBColumn[] cols)
                 throws GRBException
Add new decision variables to a model. This signature allows you to specify the list of constraints to which each new variable belongs using an array of GRBColumn objects.

Parameters:
lb - Lower bounds for new variables. Can be null, in which case the variables get lower bounds of 0.0.
ub - Upper bounds for new variables. Can be null, in which case the variables get infinite upper bounds.
obj - Objective coefficients for new variables. Can be null, in which case the variables get objective coefficients of 0.0.
type - Variable types for new variables (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT). Can be null, in which case the variables are assumed to be continuous.
names - Names for new variables. Can be null, in which case all variables are given default names.
cols - GRBColumn objects for specifying a set of constraints to which each new column belongs.
Returns:
Array of new variable objects.
Throws:
GRBException

addConstr

public GRBConstr addConstr(GRBLinExpr lhsExpr,
                           char sense,
                           GRBLinExpr rhsExpr,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhsExpr - Left-hand side expression for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side expression for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstr

public GRBConstr addConstr(GRBLinExpr lhsExpr,
                           char sense,
                           GRBVar rhsVar,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhsExpr - Left-hand side expression for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhsVar - Right-hand side variable for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstr

public GRBConstr addConstr(GRBVar lhsVar,
                           char sense,
                           GRBLinExpr rhsExpr,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhsVar - Left-hand side variable for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side expression for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstr

public GRBConstr addConstr(GRBVar lhsVar,
                           char sense,
                           GRBVar rhsVar,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhsVar - Left-hand side variable for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhsVar - Right-hand side variable for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstr

public GRBConstr addConstr(GRBVar lhsVar,
                           char sense,
                           double rhs,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhsVar - Left-hand side variable for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhs - Right-hand side value for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstr

public GRBConstr addConstr(double lhs,
                           char sense,
                           GRBVar rhsVar,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhs - Left-hand side value for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhsVar - Right-hand side variable for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstr

public GRBConstr addConstr(GRBLinExpr lhsExpr,
                           char sense,
                           double rhs,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhsExpr - Left-hand side expression for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhs - Right-hand side value for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstr

public GRBConstr addConstr(double lhs,
                           char sense,
                           GRBLinExpr rhsExpr,
                           java.lang.String name)
                    throws GRBException
Add a single linear constraint to a model.

Parameters:
lhs - Left-hand side value for new linear constraint.
sense - Sense for new linear constraint (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side expression for new linear constraint.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addRange

public GRBConstr addRange(GRBLinExpr expr,
                          double lower,
                          double upper,
                          java.lang.String name)
                   throws GRBException
Add a single range constraint to a model. A range constraint states that the value of the input expression must be between the specified lower and upper bounds in any solution.

Note that range constraints are stored internally as equality constraints. We add an extra variable to the model to capture the range information. Thus, the Sense attribute on a range constraint will always be GRB.EQUAL.

Parameters:
expr - Linear expression for new range constraint.
lower - Lower bound for linear expression.
upper - Upper bound for linear expression.
name - Name for new constraint.
Returns:
New constraint object.
Throws:
GRBException

addConstrs

public GRBConstr[] addConstrs(int count)
                       throws GRBException
Add count new linear constraints to a model. The new constraints are all of the form 0 <= 0.

Parameters:
count - Number of constraints to add.
Returns:
Array of new constraint objects.
Throws:
GRBException

addConstrs

public GRBConstr[] addConstrs(GRBLinExpr[] lhsExprs,
                              char[] senses,
                              double[] rhss,
                              java.lang.String[] names)
                       throws GRBException
Add new linear constraints to a model. The number of added constraints is determined by the length of the input arrays (which must be consistent across all arguments).

Parameters:
lhsExprs - Left-hand side expressions for the new linear constraints.
senses - Senses for new linear constraints (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhss - Right-hand side values for the new linear constraints.
names - Names for new constraints.
Returns:
Array of new constraint objects.
Throws:
GRBException

addConstrs

public GRBConstr[] addConstrs(GRBLinExpr[] lhsExprs,
                              char[] senses,
                              double[] rhss,
                              java.lang.String[] names,
                              int start,
                              int len)
                       throws GRBException
Add new linear constraints to a model. This signature allows you to use arrays to hold the various constraint attributes (left-hand side, sense, etc.), without forcing you to add one constraint for each entry in the array. The start and len arguments allow you to specify which constraints to add.

Parameters:
lhsExprs - Left-hand side expressions for the new linear constraints.
senses - Senses for new linear constraints (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL).
rhss - Right-hand side values for the new linear constraints.
names - Names for new constraints.
start - The first constraint in the list to add.
len - The number of constraints to add.
Returns:
Array of new constraint objects.
Throws:
GRBException

addRanges

public GRBConstr[] addRanges(GRBLinExpr[] exprs,
                             double[] lower,
                             double[] upper,
                             java.lang.String[] names)
                      throws GRBException
Add new range constraints to a model. A range constraint states that the value of the input expression must be between the specified lower and upper bounds in any solution.

Parameters:
exprs - Linear expressions for the new range constraints.
lower - Lower bounds for linear expressions.
upper - Upper bounds for linear expressions.
names - Names for new range constraints.
Returns:
Array of new constraint objects.
Throws:
GRBException

addQConstr

public GRBQConstr addQConstr(GRBQuadExpr lhsExpr,
                             char sense,
                             GRBQuadExpr rhsExpr,
                             java.lang.String name)
                      throws GRBException
Add a quadratic constraint to a model.

Parameters:
lhsExpr - Left-hand side quadratic expression for new quadratic constraint.
sense - Sense for new quadratic constraint (GRB.LESS_EQUAL or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side quadratic expression for new quadratic constraint.
name - Name for new constraint.
Returns:
New quadratic constraint object.
Throws:
GRBException

addQConstr

public GRBQConstr addQConstr(GRBQuadExpr lhsExpr,
                             char sense,
                             GRBLinExpr rhsExpr,
                             java.lang.String name)
                      throws GRBException
Add a quadratic constraint to a model.

Parameters:
lhsExpr - Left-hand side quadratic expression for new quadratic constraint.
sense - Sense for new quadratic constraint (GRB.LESS_EQUAL or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side linear expression for new quadratic constraint.
name - Name for new constraint.
Returns:
New quadratic constraint object.
Throws:
GRBException

addQConstr

public GRBQConstr addQConstr(GRBLinExpr lhsExpr,
                             char sense,
                             GRBQuadExpr rhsExpr,
                             java.lang.String name)
                      throws GRBException
Add a quadratic constraint to a model.

Parameters:
lhsExpr - Left-hand side linear expression for new quadratic constraint.
sense - Sense for new quadratic constraint (GRB.LESS_EQUAL or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side quadratic expression for new quadratic constraint.
name - Name for new constraint.
Returns:
New quadratic constraint object.
Throws:
GRBException

addQConstr

public GRBQConstr addQConstr(GRBQuadExpr lhsExpr,
                             char sense,
                             GRBVar rhsVar,
                             java.lang.String name)
                      throws GRBException
Add a quadratic constraint to a model.

Parameters:
lhsExpr - Left-hand side quadratic expression for new quadratic constraint.
sense - Sense for new quadratic constraint (GRB.LESS_EQUAL or GRB.GREATER_EQUAL).
rhsVar - Right-hand side variable for new quadratic constraint.
name - Name for new constraint.
Returns:
New quadratic constraint object.
Throws:
GRBException

addQConstr

public GRBQConstr addQConstr(GRBVar lhsVar,
                             char sense,
                             GRBQuadExpr rhsExpr,
                             java.lang.String name)
                      throws GRBException
Add a quadratic constraint to a model.

Parameters:
lhsVar - Left-hand side variable for new quadratic constraint.
sense - Sense for new quadratic constraint (GRB.LESS_EQUAL or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side quadratic expression for new quadratic constraint.
name - Name for new constraint.
Returns:
New quadratic constraint object.
Throws:
GRBException

addQConstr

public GRBQConstr addQConstr(GRBQuadExpr lhsExpr,
                             char sense,
                             double rhs,
                             java.lang.String name)
                      throws GRBException
Add a quadratic constraint to a model.

Parameters:
lhsExpr - Left-hand side quadratic expression for new quadratic constraint.
sense - Sense for new quadratic constraint (GRB.LESS_EQUAL or GRB.GREATER_EQUAL).
rhs - Right-hand side value for new quadratic constraint.
name - Name for new constraint.
Returns:
New quadratic constraint object.
Throws:
GRBException

addQConstr

public GRBQConstr addQConstr(double lhs,
                             char sense,
                             GRBQuadExpr rhsExpr,
                             java.lang.String name)
                      throws GRBException
Add a quadratic constraint to a model.

Parameters:
lhs - Left-hand side value for new quadratic constraint.
sense - Sense for new quadratic constraint (GRB.LESS_EQUAL or GRB.GREATER_EQUAL).
rhsExpr - Right-hand side quadratic expression for new quadratic constraint.
name - Name for new constraint.
Returns:
New quadratic constraint object.
Throws:
GRBException

addGenConstrMax

public GRBGenConstr addGenConstrMax(GRBVar resvar,
                                    GRBVar[] vars,
                                    double constant,
                                    java.lang.String name)
                             throws GRBException
Add a new general constraint of type GRB.GENCONSTR_MAX to a model.

Parameters:
resvar - The resultant variable of the new constraint.
vars - Array of variables that are the operands of the new constraint.
constant - The additional constant operand of the new constraint.
name - Name for the new general constraint.
Returns:
New general constraint.
Throws:
GRBException

addGenConstrMin

public GRBGenConstr addGenConstrMin(GRBVar resvar,
                                    GRBVar[] vars,
                                    double constant,
                                    java.lang.String name)
                             throws GRBException
Add a new general constraint of type GRB.GENCONSTR_MIN to a model.

Parameters:
resvar - The resultant variable of the new constraint.
vars - Array of variables that are the operands of the new constraint.
constant - The additional constant operand of the new constraint.
name - Name for the new general constraint.
Returns:
New general constraint.
Throws:
GRBException

addGenConstrAbs

public GRBGenConstr addGenConstrAbs(GRBVar resvar,
                                    GRBVar argvar,
                                    java.lang.String name)
                             throws GRBException
Add a new general constraint of type GRB.GENCONSTR_ABS to a model.

Parameters:
resvar - The resultant variable of the new constraint.
argvar - The argument variable of the new constraint.
name - Name for the new general constraint.
Returns:
New general constraint.
Throws:
GRBException

addGenConstrAnd

public GRBGenConstr addGenConstrAnd(GRBVar resvar,
                                    GRBVar[] vars,
                                    java.lang.String name)
                             throws GRBException
Add a new general constraint of type GRB.GENCONSTR_AND to a model.

Note that all variables participating in such a constraint will be forced to be binary; independently of how they were created.

Parameters:
resvar - The resultant variable of the new constraint.
vars - Array of variables that are the operands of the new constraint.
name - Name for the new general constraint.
Returns:
New general constraint.
Throws:
GRBException

addGenConstrOr

public GRBGenConstr addGenConstrOr(GRBVar resvar,
                                   GRBVar[] vars,
                                   java.lang.String name)
                            throws GRBException
Add a new general constraint of type GRB.GENCONSTR_OR to a model.

Note that all variables participating in such a constraint will be forced to be binary; independently of how they were created.

Parameters:
resvar - The resultant variable of the new constraint.
vars - Array of variables that are the operands of the new constraint.
name - Name for the new general constraint.
Returns:
New general constraint.
Throws:
GRBException

addGenConstrIndicator

public GRBGenConstr addGenConstrIndicator(GRBVar binvar,
                                          int binval,
                                          GRBLinExpr expr,
                                          char sense,
                                          double rhs,
                                          java.lang.String name)
                                   throws GRBException
Add a new general constraint of type GRB.GENCONSTR_INDICATOR to a model.

Note that the indicator variable z of a constraint will be forced to be binary; independently of how it was created.

Parameters:
binvar - The binary indicator variable.
binval - The value for the binary indicator variable that would force the linear constraint to be satisfied (0 or 1).
expr - Left-hand side expression for the linear constraint triggered by the indicator.
sense - Sense for the linear constraint. Options are GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL.
rhs - Right-hand-side value for the linear constraint.
name - Name for the new general constraint.
Returns:
New general constraint.
Throws:
GRBException

remove

public void remove(GRBVar var)
            throws GRBException
Remove a variable from the model.

Parameters:
var - The variable to remove.
Throws:
GRBException

remove

public void remove(GRBConstr constr)
            throws GRBException
Remove a linear constraint from the model.

Parameters:
constr - The linear constraint to remove.
Throws:
GRBException

chgCoeff

public void chgCoeff(GRBConstr constr,
                     GRBVar var,
                     double newval)
              throws GRBException
Change one coefficient in the model. The desired change is captured using a GRBVar object, a GRBConstr object, and a desired coefficient for the specified variable in the specified constraint. If you make multiple changes to the same coefficient, the last one will be applied.

Parameters:
constr - Constraint for coefficient to be changed.
var - Variable for coefficient to be changed.
newval - Desired new value for coefficient.
Throws:
GRBException

chgCoeffs

public void chgCoeffs(GRBConstr[] constrs,
                      GRBVar[] vars,
                      double[] newvals)
               throws GRBException
Change a list of coefficients in the model. Each desired change is captured using a GRBVar object, a GRBConstr object, and a desired coefficient for the specified variable in the specified constraint. The entries in the input arrays each correspond to a single desired coefficient change. The lengths of the input arrays must all be the same. If you make multiple changes to the same coefficient, the last one will be applied.

Parameters:
constrs - Constraints for coefficients to be changed.
vars - Variables for coefficients to be changed.
newvals - Desired new values for coefficients.
Throws:
GRBException

getCoeff

public double getCoeff(GRBConstr constr,
                       GRBVar var)
                throws GRBException
Query the coefficient of variable var in linear constraint constr (note that the result can be zero).

Parameters:
constr - The requested constraint.
var - The requested variable.
Returns:
The current value of the requested coefficient.
Throws:
GRBException

getCol

public GRBColumn getCol(GRBVar var)
                 throws GRBException
Retrieve the list of constraints in which a variable participates, and the associated coefficients. The result is returned as a GRBColumn object.

Parameters:
var - The variable of interest.
Returns:
A GRBColumn object that captures the set of constraints in which the variable participates.
Throws:
GRBException

getRow

public GRBLinExpr getRow(GRBConstr constr)
                  throws GRBException
Retrieve a list of variables that participate in a constraint, and the associated coefficients. The result is returned as a GRBLinExpr object.

Parameters:
constr - The constraint of interest.
Returns:
A GRBLinExpr object that captures the set of variables that participate in the constraint.
Throws:
GRBException

addSOS

public gurobi.GRBSOS addSOS(GRBVar[] vars,
                            double[] weights,
                            int type)
                     throws GRBException
Add an SOS constraint to the model. Please refer to the SOS Constraints section in the Reference Manual for additional details.

Parameters:
vars - Array of variables that participate in the SOS constraint.
weights - Weights for the variables in the SOS constraint.
type - SOS type (can be GRB.SOS_TYPE1 or GRB.SOS_TYPE2).
Returns:
New SOS constraint.
Throws:
GRBException

getSOS

public int getSOS(gurobi.GRBSOS sos,
                  GRBVar[] vars,
                  double[] weights,
                  int[] type)
           throws GRBException
Retrieve the list of variables that participate in an SOS constraint, and the associated coefficients. The return value is the length of this list. Note that the argument arrays must be long enough to accomodate the result. Call the method with null array arguments to determine the appropriate array lengths.

Parameters:
sos - The SOS set of interest.
vars - A list of variables that participate in sos. Can be null.
weights - The SOS weights for each participating variable. Can be null.
type - The type of the SOS set (either GRB.SOS_TYPE1 or GRB.SOS_TYPE2) is returned in type[0].
Returns:
The number of entries placed in the output arrays. Note that you should consult the return value to determine the length of the result; the arrays sizes won't necessarily match the result size.
Throws:
GRBException

getGenConstrMax

public void getGenConstrMax(GRBGenConstr genc,
                            GRBVar[] resvar,
                            GRBVar[] vars,
                            int[] len,
                            double[] constant)
                     throws GRBException
Any combination of the following four arguments can be null.

Parameters:
genc - The index of the general constraint.
resvar - Store the resultant variable of the constraint at resvar[0].
vars - Array to store the operand variables of the constraint.
len - Store the number of operand variables of the constraint at len[0].
constant - Store the additional constant operand of the constraint at constant[0].
Throws:
GRBException

getGenConstrMin

public void getGenConstrMin(GRBGenConstr genc,
                            GRBVar[] resvar,
                            GRBVar[] vars,
                            int[] len,
                            double[] constant)
                     throws GRBException
Any combination of the following four arguments can be null.

Parameters:
genc - The index of the general constraint.
resvar - Store the resultant variable of the constraint at resvar[0].
vars - Array to store the operand variables of the constraint.
len - Store the number of operand variables of the constraint at len[0].
constant - Store the additional constant operand of the constraint at constant[0].
Throws:
GRBException

getGenConstrAbs

public void getGenConstrAbs(GRBGenConstr genc,
                            GRBVar[] resvar,
                            GRBVar[] argvar)
                     throws GRBException
Any combination of the following two arguments can be null.

Parameters:
genc - The index of the general constraint.
resvar - Store the resultant variable of the constraint at resvar[0].
argvar - Store the argument variable of the constraint at resvar[0].
Throws:
GRBException

getGenConstrAnd

public void getGenConstrAnd(GRBGenConstr genc,
                            GRBVar[] resvar,
                            GRBVar[] vars,
                            int[] len)
                     throws GRBException
Any combination of the following four arguments can be null.

Parameters:
genc - The index of the general constraint.
resvar - Store the resultant variable of the constraint at resvar[0].
vars - Array to store the operand variables of the constraint.
len - Store the number of operand variables of the constraint at len[0].
Throws:
GRBException

getGenConstrOr

public void getGenConstrOr(GRBGenConstr genc,
                           GRBVar[] resvar,
                           GRBVar[] vars,
                           int[] len)
                    throws GRBException
Any combination of the following four arguments can be null.

Parameters:
genc - The index of the general constraint.
resvar - Store the resultant variable of the constraint at resvar[0].
vars - Array to store the operand variables of the constraint.
len - Store the number of operand variables of the constraint at len[0].
Throws:
GRBException

getGenConstrIndicator

public void getGenConstrIndicator(GRBGenConstr genc,
                                  GRBVar[] binvar,
                                  int[] binval,
                                  GRBLinExpr[] expr,
                                  char[] sense,
                                  double[] rhs)
                           throws GRBException
Any combination of the following five arguments can be null.

Parameters:
genc - The index of the general constraint.
binvar - Store the binary indicator variable of the constraint at binvar[0].
binval - Store the value that the indicator variable has to take in order to trigger the linear constraint at binval[0].
expr - Create a GRBLinExpr object to store the left-hand- side expression of the linear constraint that is triggered by the indicator at expr[0].
sense - Store the sense for the linear constraint at sense[0]. Options are GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL.
rhs - Store the right-hand-side value for the linear constraint at rhs[0].
Throws:
GRBException

getQCRow

public GRBQuadExpr getQCRow(GRBQConstr qc)
                     throws GRBException
Retrieve the left-hand side expression from a quadratic constraint. The result is returned as a GRBQuadExpr object.

Parameters:
qc - The quadratic constraint of interest.
Returns:
A GRBQuadExpr object that captures the left-hand side of the quadratic constraint.
Throws:
GRBException

remove

public void remove(gurobi.GRBSOS sos)
            throws GRBException
Remove an SOS constraint from the model.

Parameters:
sos - The SOS constraint to remove.
Throws:
GRBException

remove

public void remove(GRBQConstr qconstr)
            throws GRBException
Remove a quadratic constraint from the model.

Parameters:
qconstr - The quadratic constraint to remove.
Throws:
GRBException

remove

public void remove(GRBGenConstr genconstr)
            throws GRBException
Remove a general constraint from the model.

Parameters:
genconstr - The general constraint to remove.
Throws:
GRBException

getEnv

public GRBEnv getEnv()
              throws GRBException
Query the environment associated with the model. Note that each model makes its own copy of the environment when it is created. To change parameters for a model, for example, you should use this method to obtain the appropriate environment object.

Returns:
The environment for the model.
Throws:
GRBException

getConcurrentEnv

public GRBEnv getConcurrentEnv(int num)
                        throws GRBException
Create/retrieve a concurrent environment for a model.

This method provides fine-grained control over the concurrent optimizer. By creating your own concurrent environments and setting appropriate parameters on these environments (e.g., the Method parameter), you can control exactly which strategies the concurrent optimizer employs. For example, if you create two concurrent environments, and set Method to primal simplex for one and dual simplex for the other, subsequent concurrent optimizer runs will use the two simplex algorithms rather than the default choices.

Note that you must create contiguously numbered concurrent environments, starting with num=0. For example, if you want three concurrent environments, they must be numbered 0, 1, and 2.

Once you create concurrent environments, they will be used for every subsequent concurrent optimization on that model. Use discardConcurrentEnvs to revert back to default concurrent optimizer behavior.

Parameters:
num - The concurrent environment number.
Returns:
The concurrent environment for the model.
Throws:
GRBException

discardConcurrentEnvs

public void discardConcurrentEnvs()
                           throws GRBException
Discard concurrent environments for a model.

The concurrent environments created by getConcurrentEnv will be used by every subsequent call to the concurrent optimizer until the concurrent environments are discarded.

Use getMultiobjEnv to create a multi- objective environment.

Throws:
GRBException

getMultiobjEnv

public GRBEnv getMultiobjEnv(int num)
                      throws GRBException
\getmultiobjenvdesc

Use discardMultiobjEnvs to discard multi-objective environments and return to standard behavior.

Parameters:
num - The objective index.
Returns:
The multi-objective environment for the model.
Throws:
GRBException

discardMultiobjEnvs

public void discardMultiobjEnvs()
                         throws GRBException
\discardmultiobjenvsdesc

Use getMultiobjEnv to create a multi- objective environments.

Throws:
GRBException

get

public int get(GRB.IntParam param)
        throws GRBException
Query the value of an int-valued parameter.

Parameters:
param - The parameter being queried.
Returns:
The current value of the requested parameter.
Throws:
GRBException

get

public double get(GRB.DoubleParam param)
           throws GRBException
Query the value of a double-valued parameter.

Parameters:
param - The parameter being queried.
Returns:
The current value of the requested parameter.
Throws:
GRBException

get

public java.lang.String get(GRB.StringParam param)
                     throws GRBException
Query the value of a string-valued parameter.

Parameters:
param - The parameter being queried.
Returns:
The current value of the requested parameter.
Throws:
GRBException

set

public void set(GRB.IntParam param,
                int newval)
         throws GRBException
Set the value of an int-valued parameter.

The difference between setting a parameter on a model and setting it on an environment (i.e., through GRBEnv.set) is that the former modifies the parameter for a single model, while the latter modifies the parameter for every model that is subsequently built using that environment (and leaves the parameter unchanged for models that were previously built using that environment).

Parameters:
param - The parameter being modified.
newval - The desired new value for the parameter.
Throws:
GRBException

set

public void set(GRB.DoubleParam param,
                double newval)
         throws GRBException
Set the value of a double-valued parameter.

The difference between setting a parameter on a model and setting it on an environment (i.e., through GRBEnv.set) is that the former modifies the parameter for a single model, while the latter modifies the parameter for every model that is subsequently built using that environment (and leaves the parameter unchanged for models that were previously built using that environment).

Parameters:
param - The parameter being modified.
newval - The desired new value for the parameter.
Throws:
GRBException

set

public void set(GRB.StringParam param,
                java.lang.String newval)
         throws GRBException
Set the value of a string-valued parameter.

The difference between setting a parameter on a model and setting it on an environment (i.e., through GRBEnv.set) is that the former modifies the parameter for a single model, while the latter modifies the parameter for every model that is subsequently built using that environment (and leaves the parameter unchanged for models that were previously built using that environment).

Parameters:
param - The parameter being modified.
newval - The desired new value for the parameter.
Throws:
GRBException

set

public void set(java.lang.String param,
                java.lang.String newval)
         throws GRBException
Set the value of any parameter using strings alone.

The difference between setting a parameter on a model and setting it on an environment (i.e., through GRBEnv.set) is that the former modifies the parameter for a single model, while the latter modifies the parameter for every model that is subsequently built using that environment (and leaves the parameter unchanged for models that were previously built using that environment).

Parameters:
param - The name of the parameter being modified.
newval - The desired new value for the parameter.
Throws:
GRBException

get

public int get(GRB.IntAttr attr)
        throws GRBException
Query the value of an int-valued model attribute.

Parameters:
attr - The attribute being queried.
Returns:
The current value of the requested attribute.
Throws:
GRBException

get

public double get(GRB.DoubleAttr attr)
           throws GRBException
Query the value of a double-valued model attribute.

Parameters:
attr - The attribute being queried.
Returns:
The current value of the requested attribute.
Throws:
GRBException

get

public java.lang.String get(GRB.StringAttr attr)
                     throws GRBException
Query the value of a string-valued model attribute.

Parameters:
attr - The attribute being queried.
Returns:
The current value of the requested attribute.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                int newval)
         throws GRBException
Set the value of an int-valued model attribute.

Parameters:
attr - The attribute being modified.
newval - The desired new value for the attribute.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                double newval)
         throws GRBException
Set the value of a double-valued model attribute.

Parameters:
attr - The attribute being modified.
newval - The desired new value for the attribute.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                java.lang.String newval)
         throws GRBException
Set the value of a String-valued model attribute.

Parameters:
attr - The attribute being modified.
newval - The desired new value for the attribute.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBVar[] vars)
          throws GRBException
Query an int-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being queried.
vars - The variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public char[] get(GRB.CharAttr attr,
                  GRBVar[] vars)
           throws GRBException
Query a char-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being queried.
vars - The variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public double[] get(GRB.DoubleAttr attr,
                    GRBVar[] vars)
             throws GRBException
Query a double-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being queried.
vars - The variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBVar[] vars)
                       throws GRBException
Query a String-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being queried.
vars - The variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBVar[] vars,
                 int start,
                 int len)
          throws GRBException
Query an int-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being queried.
vars - A one-dimensional array of variables whose attribute values are being queried.
start - The index of the first variable of interest in the list.
len - The number of variables.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public char[] get(GRB.CharAttr attr,
                  GRBVar[] vars,
                  int start,
                  int len)
           throws GRBException
Query a char-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being queried.
vars - A one-dimensional array of variables whose attribute values are being queried.
start - The index of the first variable of interest in the list.
len - The number of variables.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public double[] get(GRB.DoubleAttr attr,
                    GRBVar[] vars,
                    int start,
                    int len)
             throws GRBException
Query a double-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being queried.
vars - A one-dimensional array of variables whose attribute values are being queried.
start - The index of the first variable of interest in the list.
len - The number of variables.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBVar[] vars,
                              int start,
                              int len)
                       throws GRBException
Query a String-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being queried.
vars - A one-dimensional array of variables whose attribute values are being queried.
start - The index of the first variable of interest in the list.
len - The number of variables.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public int[][] get(GRB.IntAttr attr,
                   GRBVar[][] vars)
            throws GRBException
Query an int-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A two-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public char[][] get(GRB.CharAttr attr,
                    GRBVar[][] vars)
             throws GRBException
Query a char-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A two-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public double[][] get(GRB.DoubleAttr attr,
                      GRBVar[][] vars)
               throws GRBException
Query a double-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A two-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public java.lang.String[][] get(GRB.StringAttr attr,
                                GRBVar[][] vars)
                         throws GRBException
Query a String-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A two-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public int[][][] get(GRB.IntAttr attr,
                     GRBVar[][][] vars)
              throws GRBException
Query an int-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A three-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public char[][][] get(GRB.CharAttr attr,
                      GRBVar[][][] vars)
               throws GRBException
Query a char-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A three-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public double[][][] get(GRB.DoubleAttr attr,
                        GRBVar[][][] vars)
                 throws GRBException
Query a double-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A three-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public java.lang.String[][][] get(GRB.StringAttr attr,
                                  GRBVar[][][] vars)
                           throws GRBException
Query a String-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being queried.
vars - A three-dimensional array of variables whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input variable.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBConstr[] constrs)
          throws GRBException
Query an int-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being queried.
constrs - The constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public char[] get(GRB.CharAttr attr,
                  GRBConstr[] constrs)
           throws GRBException
Query a char-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being queried.
constrs - The constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public double[] get(GRB.DoubleAttr attr,
                    GRBConstr[] constrs)
             throws GRBException
Query a double-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being queried.
constrs - The constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBConstr[] constrs)
                       throws GRBException
Query a String-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being queried.
constrs - The constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBConstr[] constrs,
                 int start,
                 int len)
          throws GRBException
Query an int-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A one-dimensional array of constraints whose attribute values are being queried.
start - The index of the first constraint of interest in the list.
len - The number of constraints.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public char[] get(GRB.CharAttr attr,
                  GRBConstr[] constrs,
                  int start,
                  int len)
           throws GRBException
Query a char-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A one-dimensional array of constraints whose attribute values are being queried.
start - The index of the first constraint of interest in the list.
len - The number of constraints.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public double[] get(GRB.DoubleAttr attr,
                    GRBConstr[] constrs,
                    int start,
                    int len)
             throws GRBException
Query a double-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A one-dimensional array of constraints whose attribute values are being queried.
start - The first constraint of interest in the list.
len - The number of constraints.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBConstr[] constrs,
                              int start,
                              int len)
                       throws GRBException
Query a String-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A one-dimensional array of constraints whose attribute values are being queried.
start - The index of the first constraint of interest in the list.
len - The number of constraints.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public int[][] get(GRB.IntAttr attr,
                   GRBConstr[][] constrs)
            throws GRBException
Query an int-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A two-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public char[][] get(GRB.CharAttr attr,
                    GRBConstr[][] constrs)
             throws GRBException
Query a char-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A two-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public double[][] get(GRB.DoubleAttr attr,
                      GRBConstr[][] constrs)
               throws GRBException
Query a double-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A two-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public java.lang.String[][] get(GRB.StringAttr attr,
                                GRBConstr[][] constrs)
                         throws GRBException
Query a String-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A two-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public int[][][] get(GRB.IntAttr attr,
                     GRBConstr[][][] constrs)
              throws GRBException
Query an int-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A three-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public char[][][] get(GRB.CharAttr attr,
                      GRBConstr[][][] constrs)
               throws GRBException
Query a char-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A three-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public double[][][] get(GRB.DoubleAttr attr,
                        GRBConstr[][][] constrs)
                 throws GRBException
Query a double-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A three-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public java.lang.String[][][] get(GRB.StringAttr attr,
                                  GRBConstr[][][] constrs)
                           throws GRBException
Query a String-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being queried.
constrs - A three-dimensional array of constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input constraint.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBQConstr[] qconstrs)
          throws GRBException
Query an int-valued quadratic constraint attribute for an array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - The quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public char[] get(GRB.CharAttr attr,
                  GRBQConstr[] qconstrs)
           throws GRBException
Query a char-valued quadratic constraint attribute for an array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - The quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public double[] get(GRB.DoubleAttr attr,
                    GRBQConstr[] qconstrs)
             throws GRBException
Query a double-valued quadratic constraint attribute for an array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - The quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBQConstr[] qconstrs)
                       throws GRBException
Query a String-valued quadratic constraint attribute for an array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - The quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBQConstr[] qconstrs,
                 int start,
                 int len)
          throws GRBException
Query an int-valued quadratic constraint attribute for a sub-array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A one-dimensional array of quadratic constraints whose attribute values are being queried.
start - The index of the first quadratic constraint of interest in the list.
len - The number of quadratic constraints.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public char[] get(GRB.CharAttr attr,
                  GRBQConstr[] qconstrs,
                  int start,
                  int len)
           throws GRBException
Query a char-valued quadratic constraint attribute for a sub-array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A one-dimensional array of quadratic constraints whose attribute values are being queried.
start - The index of the first quadratic constraint of interest in the list.
len - The number of quadratic constraints.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public double[] get(GRB.DoubleAttr attr,
                    GRBQConstr[] qconstrs,
                    int start,
                    int len)
             throws GRBException
Query a double-valued quadratic constraint attribute for a sub-array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A one-dimensional array of quadratic constraints whose attribute values are being queried.
start - The first quadratic constraint of interest in the list.
len - The number of quadratic constraints.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBQConstr[] qconstrs,
                              int start,
                              int len)
                       throws GRBException
Query a String-valued quadratic constraint attribute for a sub-array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A one-dimensional array of quadratic constraints whose attribute values are being queried.
start - The index of the first quadratic constraint of interest in the list.
len - The number of quadratic constraints.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public int[][] get(GRB.IntAttr attr,
                   GRBQConstr[][] qconstrs)
            throws GRBException
Query an int-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A two-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public char[][] get(GRB.CharAttr attr,
                    GRBQConstr[][] qconstrs)
             throws GRBException
Query a char-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A two-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public double[][] get(GRB.DoubleAttr attr,
                      GRBQConstr[][] qconstrs)
               throws GRBException
Query a double-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A two-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public java.lang.String[][] get(GRB.StringAttr attr,
                                GRBQConstr[][] qconstrs)
                         throws GRBException
Query a String-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A two-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public int[][][] get(GRB.IntAttr attr,
                     GRBQConstr[][][] qconstrs)
              throws GRBException
Query an int-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A three-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public char[][][] get(GRB.CharAttr attr,
                      GRBQConstr[][][] qconstrs)
               throws GRBException
Query a char-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A three-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public double[][][] get(GRB.DoubleAttr attr,
                        GRBQConstr[][][] qconstrs)
                 throws GRBException
Query a double-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A three-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public java.lang.String[][][] get(GRB.StringAttr attr,
                                  GRBQConstr[][][] qconstrs)
                           throws GRBException
Query a String-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being queried.
qconstrs - A three-dimensional array of quadratic constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input quadratic constraint.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBGenConstr[] genconstrs)
          throws GRBException
Query an int-valued general constraint attribute for an array of general constraints.

Parameters:
attr - The attribute being queried.
genconstrs - The general constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBGenConstr[] genconstrs)
                       throws GRBException
Query a String-valued general constraint attribute for an array of general constraints.

Parameters:
attr - The attribute being queried.
genconstrs - The general constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

get

public int[] get(GRB.IntAttr attr,
                 GRBGenConstr[] genconstrs,
                 int start,
                 int len)
          throws GRBException
Query an int-valued general constraint attribute for a sub-array of general constraints.

Parameters:
attr - The attribute being queried.
genconstrs - A one-dimensional array of general constraints whose attribute values are being queried.
start - The index of the first general constraint of interest in the list.
len - The number of general constraints.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

get

public java.lang.String[] get(GRB.StringAttr attr,
                              GRBGenConstr[] genconstrs,
                              int start,
                              int len)
                       throws GRBException
Query a String-valued general constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being queried.
genconstrs - A one-dimensional array of general constraints whose attribute values are being queried.
start - The index of the first general constraint of interest in the list.
len - The number of general constraints.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

get

public int[][] get(GRB.IntAttr attr,
                   GRBGenConstr[][] genconstrs)
            throws GRBException
Query an int-valued general constraint attribute for a two-dimensional array of general constraints.

Parameters:
attr - The attribute being queried.
genconstrs - A two-dimensional array of general constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

get

public java.lang.String[][] get(GRB.StringAttr attr,
                                GRBGenConstr[][] genconstrs)
                         throws GRBException
Query a String-valued constraint attribute for a two-dimensional array of general constraints.

Parameters:
attr - The attribute being queried.
genconstrs - A two-dimensional array of general constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

get

public int[][][] get(GRB.IntAttr attr,
                     GRBGenConstr[][][] genconstrs)
              throws GRBException
Query an int-valued general constraint attribute for a three- dimensional array of general constraints.

Parameters:
attr - The attribute being queried.
genconstrs - A three-dimensional array of general constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

get

public java.lang.String[][][] get(GRB.StringAttr attr,
                                  GRBGenConstr[][][] genconstrs)
                           throws GRBException
Query a String-valued constraint attribute for a three-dimensional array of general constraints.

Parameters:
attr - The attribute being queried.
genconstrs - A three-dimensional array of general constraints whose attribute values are being queried.
Returns:
The current values of the requested attribute for each input general constraint.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBVar[] vars,
                int[] newvals)
         throws GRBException
Set an int-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being modified.
vars - The variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBVar[] vars,
                char[] newvals)
         throws GRBException
Set a char-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being modified.
vars - The variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBVar[] vars,
                double[] newvals)
         throws GRBException
Set a double-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being modified.
vars - The variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBVar[] vars,
                java.lang.String[] newvals)
         throws GRBException
Set a String-valued variable attribute for an array of variables.

Parameters:
attr - The attribute being modified.
vars - The variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBVar[] vars,
                int[] newvals,
                int start,
                int len)
         throws GRBException
Set an int-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being modified.
vars - A one-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
start - The index of the first variable of interest in the list.
len - The number of variables.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBVar[] vars,
                char[] newvals,
                int start,
                int len)
         throws GRBException
Set a char-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being modified.
vars - A one-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
start - The index of the first variable of interest in the list.
len - The number of variables.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBVar[] vars,
                double[] newvals,
                int start,
                int len)
         throws GRBException
Set a double-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being modified.
vars - A one-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
start - The index of the first variable of interest in the list.
len - The number of variables.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBVar[] vars,
                java.lang.String[] newvals,
                int start,
                int len)
         throws GRBException
Set a String-valued variable attribute for a sub-array of variables.

Parameters:
attr - The attribute being modified.
vars - A one-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
start - The index of the first variable of interest in the list.
len - The number of variables.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBVar[][] vars,
                int[][] newvals)
         throws GRBException
Set an int-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A two-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBVar[][] vars,
                char[][] newvals)
         throws GRBException
Set a char-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A two-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBVar[][] vars,
                double[][] newvals)
         throws GRBException
Set a double-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A two-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBVar[][] vars,
                java.lang.String[][] newvals)
         throws GRBException
Set a String-valued variable attribute for a two-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A two-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBVar[][][] vars,
                int[][][] newvals)
         throws GRBException
Set an int-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A three-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBVar[][][] vars,
                char[][][] newvals)
         throws GRBException
Set a char-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A three-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBVar[][][] vars,
                double[][][] newvals)
         throws GRBException
Set a double-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A three-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBVar[][][] vars,
                java.lang.String[][][] newvals)
         throws GRBException
Set a String-valued variable attribute for a three-dimensional array of variables.

Parameters:
attr - The attribute being modified.
vars - A three-dimensional array of variables whose attribute values are being modified.
newvals - The desired new values for the attribute for each input variable.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBConstr[] constrs,
                int[] newvals)
         throws GRBException
Set an int-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being modified.
constrs - The constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBConstr[] constrs,
                char[] newvals)
         throws GRBException
Set a char-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being modified.
constrs - The constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBConstr[] constrs,
                double[] newvals)
         throws GRBException
Set a double-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being modified.
constrs - The constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBConstr[] constrs,
                java.lang.String[] newvals)
         throws GRBException
Set a String-valued constraint attribute for an array of constraints.

Parameters:
attr - The attribute being modified.
constrs - The constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBConstr[] constrs,
                int[] newvals,
                int start,
                int len)
         throws GRBException
Set an int-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A one-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
start - The index of the first constraint of interest in the list.
len - The number of constraints.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBConstr[] constrs,
                char[] newvals,
                int start,
                int len)
         throws GRBException
Set a char-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A one-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
start - The index of the first constraint of interest in the list.
len - The number of constraints.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBConstr[] constrs,
                double[] newvals,
                int start,
                int len)
         throws GRBException
Set a double-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A one-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
start - The first constraint of interest in the list.
len - The number of constraints.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBConstr[] constrs,
                java.lang.String[] newvals,
                int start,
                int len)
         throws GRBException
Set a String-valued constraint attribute for a sub-array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A one-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
start - The index of the first constraint of interest in the list.
len - The number of constraints.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBConstr[][] constrs,
                int[][] newvals)
         throws GRBException
Set an int-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A two-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBConstr[][] constrs,
                char[][] newvals)
         throws GRBException
Set a char-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A two-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBConstr[][] constrs,
                double[][] newvals)
         throws GRBException
Set a double-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A two-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBConstr[][] constrs,
                java.lang.String[][] newvals)
         throws GRBException
Set a String-valued constraint attribute for a two-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A two-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.IntAttr attr,
                GRBConstr[][][] constrs,
                int[][][] newvals)
         throws GRBException
Set an int-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A three-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBConstr[][][] constrs,
                char[][][] newvals)
         throws GRBException
Set a char-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A three-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBConstr[][][] constrs,
                double[][][] newvals)
         throws GRBException
Set a double-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A three-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBConstr[][][] constrs,
                java.lang.String[][][] newvals)
         throws GRBException
Set a String-valued constraint attribute for a three-dimensional array of constraints.

Parameters:
attr - The attribute being modified.
constrs - A three-dimensional array of constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input constraint.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBQConstr[] qconstrs,
                char[] newvals)
         throws GRBException
Set a char-valued quadratic constraint attribute for an array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - The quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBQConstr[] qconstrs,
                double[] newvals)
         throws GRBException
Set a double-valued quadratic constraint attribute for an array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - The quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBQConstr[] qconstrs,
                java.lang.String[] newvals)
         throws GRBException
Set a String-valued quadratic constraint attribute for an array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - The quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBQConstr[] qconstrs,
                char[] newvals,
                int start,
                int len)
         throws GRBException
Set a char-valued quadratic constraint attribute for a sub-array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A one-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
start - The index of the first quadratic constraint of interest in the list.
len - The number of quadratic constraints.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBQConstr[] qconstrs,
                double[] newvals,
                int start,
                int len)
         throws GRBException
Set a double-valued quadratic constraint attribute for a sub-array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A one-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
start - The first quadratic constraint of interest in the list.
len - The number of quadratic constraints.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBQConstr[] qconstrs,
                java.lang.String[] newvals,
                int start,
                int len)
         throws GRBException
Set a String-valued quadratic constraint attribute for a sub-array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A one-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
start - The index of the first quadratic constraint of interest in the list.
len - The number of quadratic constraints.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBQConstr[][] qconstrs,
                char[][] newvals)
         throws GRBException
Set a char-valued quadratic constraint attribute for a two-dimensional array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A two-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBQConstr[][] qconstrs,
                double[][] newvals)
         throws GRBException
Set a double-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A two-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBQConstr[][] qconstrs,
                java.lang.String[][] newvals)
         throws GRBException
Set a String-valued quadratic constraint attribute for a two- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A two-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.CharAttr attr,
                GRBQConstr[][][] qconstrs,
                char[][][] newvals)
         throws GRBException
Set a char-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A three-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.DoubleAttr attr,
                GRBQConstr[][][] qconstrs,
                double[][][] newvals)
         throws GRBException
Set a double-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A three-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBQConstr[][][] qconstrs,
                java.lang.String[][][] newvals)
         throws GRBException
Set a String-valued quadratic constraint attribute for a three- dimensional array of quadratic constraints.

Parameters:
attr - The attribute being modified.
qconstrs - A three-dimensional array of quadratic constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input quadratic constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBGenConstr[] genconstrs,
                java.lang.String[] newvals)
         throws GRBException
Set a String-valued general constraint attribute for an array of general constraints.

Parameters:
attr - The attribute being modified.
genconstrs - The general constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input general constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBGenConstr[] genconstrs,
                java.lang.String[] newvals,
                int start,
                int len)
         throws GRBException
Set a String-valued general constraint attribute for a sub-array of general constraints.

Parameters:
attr - The attribute being modified.
genconstrs - A one-dimensional array of general constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input general constraint.
start - The index of the first general constraint of interest in the list.
len - The number of general constraints.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBGenConstr[][] genconstrs,
                java.lang.String[][] newvals)
         throws GRBException
Set a String-valued general constraint attribute for a two-dimensional array of general constraints.

Parameters:
attr - The attribute being modified.
genconstrs - A two-dimensional array of general constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input general constraint.
Throws:
GRBException

set

public void set(GRB.StringAttr attr,
                GRBGenConstr[][][] genconstrs,
                java.lang.String[][][] newvals)
         throws GRBException
Set a String-valued general constraint attribute for a three- dimensional array of general constraints.

Parameters:
attr - The attribute being modified.
genconstrs - A three-dimensional array of general constraints whose attribute values are being modified.
newvals - The desired new values for the attribute for each input general constraint.
Throws:
GRBException

setCallback

public void setCallback(GRBCallback cb)
Set the callback object for a model. The callback() method on this object will be called periodically from the Gurobi solver. You will have the opportunity to obtain more detailed information about the state of the optimization from this callback. See the documentation for GRBCallback for additional information.

Note that a model can only have a single callback method, so this call will replace an existing callback.

Parameters:
cb - New callback object. To disable a previously set callback, call this method with a {\ttfamily null} argument.

FSolve

public int FSolve(int blen,
                  int[] bind,
                  double[] bval,
                  int[] xind,
                  double[] xval)
           throws GRBException
Throws:
GRBException

BinvColj

public int BinvColj(int col,
                    int[] xind,
                    double[] xval)
             throws GRBException
Throws:
GRBException

Binvj

public int Binvj(int j,
                 int[] xind,
                 double[] xval)
          throws GRBException
Throws:
GRBException

BSolve

public int BSolve(int blen,
                  int[] bind,
                  double[] bval,
                  int[] xind,
                  double[] xval)
           throws GRBException
Throws:
GRBException

Binvi

public int Binvi(int i,
                 int[] xind,
                 double[] xval)
          throws GRBException
Throws:
GRBException

BinvRowi

public int BinvRowi(int i,
                    int[] xind,
                    double[] xval)
             throws GRBException
Throws:
GRBException

BasisHead

public void BasisHead(int[] bhead)
               throws GRBException
Throws:
GRBException