The following list contains the set of constants needed by the Gurobi
.NET interface. You would refer to them using a GRB. prefix
(e.g., GRB.Status.OPTIMAL).
// Model status codes (after call to optimize())
/// <summary>
/// Optimization status codes
/// </summary>
public class Status
{
/// <summary>
/// Model is loaded, but no solution information is available.
/// </summary>
public const int LOADED = 1;
/// <summary>
/// Model was solved to optimality (subject to tolerances) and an optimal
/// solution is available.
/// </summary>
public const int OPTIMAL = 2;
/// <summary>
/// Model was proven to be infeasible.
/// </summary>
public const int INFEASIBLE = 3;
/// <summary>
/// Model was proven to be either infeasible or unbounded.
/// </summary>
public const int INF_OR_UNBD = 4;
/// <summary>
/// Model was proven to be unbounded.
/// </summary>
public const int UNBOUNDED = 5;
/// <summary>
/// Optimal objective was proven to be worse than the value specified
/// in the Cutoff parameter.
/// </summary>
public const int CUTOFF = 6;
/// <summary>
/// Optimization terminated because the total number of simplex
/// iterations performed exceeded the limit specified in the IterationLimit
/// parameter.
/// </summary>
public const int ITERATION_LIMIT = 7;
/// <summary>
/// Optimization terminated because the total number of branch-and-cut
/// nodes explored exceeded the limit specified in the NodeLimit
/// parameter.
/// </summary>
public const int NODE_LIMIT = 8;
/// <summary>
/// Optimization terminated because the total elapsed time
/// exceeded the limit specified in the TimeLimit parameter.
/// </summary>
public const int TIME_LIMIT = 9;
/// <summary>
/// Optimization terminated because the number of solutions found
/// reached the value specified in the SolutionLimit parameter.
/// </summary>
public const int SOLUTION_LIMIT = 10;
/// <summary>
/// Optimization was terminated by the user.
/// </summary>
public const int INTERRUPTED = 11;
/// <summary>
/// Optimization was terminated due to unrecoverable numerical
/// difficulties.
/// </summary>
public const int NUMERIC = 12;
/// <summary>
/// Optimization terminated with a sub-optimal solution.
/// </summary>
public const int SUBOPTIMAL = 13;
/// <summary>
/// Optimization is still in progress.
/// </summary>
public const int INPROGRESS = 14;
/// <summary>
/// User specified objective limit (a bound on either the best objective
/// or the best bound), and that limit has been reached.
/// </summary>
public const int USER_OBJ_LIMIT = 15;
/// <summary>
/// Optimization terminated because the total elapsed work
/// exceeded the limit specified in the WorkLimit parameter.
/// </summary>
public const int WORK_LIMIT = 16;
/// <summary>
/// Optimization terminated because the total amount of allocated
/// memory exceeded the limit specified in the SoftMemLimit parameter.
/// </summary>
public const int MEM_LIMIT = 17;
}
/// <summary>
/// Batch status codes
/// </summary>
public class BatchStatus
{
/// <summary>
/// Batch object was created, but is not ready to be scheduled.
/// See the Batch Optimization section of the manual for more details.
/// </summary>
public const int CREATED = 1;
/// <summary>
/// The Batch object has been completely specified, and now is waiting
/// for a job to finish processing the request.
/// See the Batch Optimization section of the manual for more details.
/// </summary>
public const int SUBMITTED = 2;
/// <summary>
/// Batch processing was aborted by the user.
/// See the Batch Optimization section of the manual for more details.
/// </summary>
public const int ABORTED = 3;
/// <summary>
/// Batch processing failed.
/// See the Batch Optimization section of the manual for more details.
/// </summary>
public const int FAILED = 4;
/// <summary>
/// A Batch Job successfully processed the Batch request.
/// See the Batch Optimization section of the manual for more details.
/// </summary>
public const int COMPLETED = 5;
}
// Constraint senses
/// <summary>
/// Less or equal constraint sense.
/// </summary>
public const char LESS_EQUAL = '<';
/// <summary>
/// Greater or equal constraint sense.
/// </summary>
public const char GREATER_EQUAL = '>';
/// <summary>
/// Equal constraint sense.
/// </summary>
public const char EQUAL = '=';
// Variable types
/// <summary>
/// Continuous variable.
/// </summary>
public const char CONTINUOUS = 'C';
/// <summary>
/// Binary variable.
/// </summary>
public const char BINARY = 'B';
/// <summary>
/// Integer variable.
/// </summary>
public const char INTEGER = 'I';
/// <summary>
/// Semi-continuous variable.
/// </summary>
public const char SEMICONT = 'S';
/// <summary>
/// Semi-integer variable.
/// </summary>
public const char SEMIINT = 'N';
// Objective sense
/// <summary>
/// Minimization objective.
/// </summary>
public const int MINIMIZE = 1;
/// <summary>
/// Maximization objective.
/// </summary>
public const int MAXIMIZE = -1;
// SOS types
/// <summary>
/// SOS of type 1.
/// </summary>
public const int SOS_TYPE1 = 1;
/// <summary>
/// SOS of type 2.
/// </summary>
public const int SOS_TYPE2 = 2;
// General constraint types
/// <summary>
/// General constraint maximum.
/// </summary>
public const int GENCONSTR_MAX = 0;
/// <summary>
/// General constraint minimum.
/// </summary>
public const int GENCONSTR_MIN = 1;
/// <summary>
/// General constraint absolute value.
/// </summary>
public const int GENCONSTR_ABS = 2;
/// <summary>
/// General constraint logical AND.
/// </summary>
public const int GENCONSTR_AND = 3;
/// <summary>
/// General constraint logical OR.
/// </summary>
public const int GENCONSTR_OR = 4;
/// <summary>
/// General constraint norm.
/// </summary>
public const int GENCONSTR_NORM = 5;
/// <summary>
/// General constraint indicator.
/// </summary>
public const int GENCONSTR_INDICATOR = 6;
/// <summary>
/// General constraint piecewise-linear.
/// </summary>
public const int GENCONSTR_PWL = 7;
/// <summary>
/// General constraint polynomial function.
/// </summary>
public const int GENCONSTR_POLY = 8;
/// <summary>
/// General constraint natural exponential function.
/// </summary>
public const int GENCONSTR_EXP = 9;
/// <summary>
/// General constraint exponential function.
/// </summary>
public const int GENCONSTR_EXPA = 10;
/// <summary>
/// General constraint natural logarithmic function.
/// </summary>
public const int GENCONSTR_LOG = 11;
/// <summary>
/// General constraint logarithmic function.
/// </summary>
public const int GENCONSTR_LOGA = 12;
/// <summary>
/// General constraint power function.
/// </summary>
public const int GENCONSTR_POW = 13;
/// <summary>
/// General constraint sine function.
/// </summary>
public const int GENCONSTR_SIN = 14;
/// <summary>
/// General constraint cosine function.
/// </summary>
public const int GENCONSTR_COS = 15;
/// <summary>
/// General constraint tangent function.
/// </summary>
public const int GENCONSTR_TAN = 16;
/// <summary>
/// General constraint logistic function.
/// </summary>
public const int GENCONSTR_LOGISTIC = 17;
// Basis status info
/// <summary>
/// Variable is basic.
/// </summary>
public const int BASIC = 0;
/// <summary>
/// Variable is non-basic at lower bound.
/// </summary>
public const int NONBASIC_LOWER = -1;
/// <summary>
/// Variable is non-basic at upper bound.
/// </summary>
public const int NONBASIC_UPPER = -2;
/// <summary>
/// Variable is superbasic.
/// </summary>
public const int SUPERBASIC = -3;
// Numeric constants
/// <summary>
/// Infinity value.
/// </summary>
public const double INFINITY = 1e100;
/// <summary>
/// Undefined value.
/// </summary>
public const double UNDEFINED = 1e101;
/// <summary>
/// Maximum integer value.
/// </summary>
public const int MAXINT = 2000000000;
// Limits
/// <summary>
/// Maximum string length.
/// </summary>
public const int MAX_STRLEN = 512;
/// <summary>
/// Maximum name length.
/// </summary>
public const int MAX_NAMELEN = 255;
/// <summary>
/// Maximum tag length.
/// </summary>
public const int MAX_TAGLEN = 10240;
/// <summary>
/// Maximum concurrent threads.
/// </summary>
public const int MAX_CONCURRENT = 64;
// Other constants
/// <summary>
/// Default compute server port.
/// </summary>
public const int DEFAULT_CS_PORT = 61000;
// Version numbers
/// <summary>
/// Major number
/// </summary>
public const int VERSION_MAJOR = 11;
/// <summary>
/// Minor number
/// </summary>
public const int VERSION_MINOR = 0;
/// <summary>
/// Technical number
/// </summary>
public const int VERSION_TECHNICAL = 2;
// Callback constants
/// <summary>
/// Gurobi callback codes.
/// </summary>
public class Callback
{
/// <summary>
/// Periodic polling callback.
/// </summary>
public const int POLLING = 0;
/// <summary>
/// Currently performing presolve.
/// </summary>
public const int PRESOLVE = 1;
/// <summary>
/// Currently in simplex.
/// </summary>
public const int SIMPLEX = 2;
/// <summary>
/// Currently in MIP.
/// </summary>
public const int MIP = 3;
/// <summary>
/// Found a new MIP incumbent.
/// </summary>
public const int MIPSOL = 4;
/// <summary>
/// Currently exploring a MIP node.
/// </summary>
public const int MIPNODE = 5;
/// <summary>
/// Currently in barrier.
/// </summary>
public const int BARRIER = 7;
/// <summary>
/// Printing a log message.
/// </summary>
public const int MESSAGE = 6;
/// <summary>
/// Currently in multi-objective optimization.
/// </summary>
public const int MULTIOBJ = 8;
/// <summary>
/// Currently computing an IIS.
/// </summary>
public const int IIS = 9;
/// <summary>
/// Returns the number of columns removed by presolve to this point.
/// </summary>
public const int PRE_COLDEL = 1000;
/// <summary>
/// Returns the number of rows removed by presolve to this point.
/// </summary>
public const int PRE_ROWDEL = 1001;
/// <summary>
/// Returns the number of constraint senses changed by presolve to this
/// point.
/// </summary>
public const int PRE_SENCHG = 1002;
/// <summary>
/// Returns the number of bounds changed by presolve to this point.
/// </summary>
public const int PRE_BNDCHG = 1003;
/// <summary>
/// Returns the number of coefficients changed by presolve to this point.
/// </summary>
public const int PRE_COECHG = 1004;
/// <summary>
/// Returns the current simplex iteration count.
/// </summary>
public const int SPX_ITRCNT = 2000;
/// <summary>
/// Returns the current simplex objective value.
/// </summary>
public const int SPX_OBJVAL = 2001;
/// <summary>
/// Returns the current simplex primal infeasibility.
/// </summary>
public const int SPX_PRIMINF = 2002;
/// <summary>
/// Returns the current simplex dual infeasibility.
/// </summary>
public const int SPX_DUALINF = 2003;
/// <summary>
/// Returns 1 if the model has been perturbed.
/// </summary>
public const int SPX_ISPERT = 2004;
/// <summary>
/// Returns the current best objective value.
/// </summary>
public const int MIP_OBJBST = 3000;
/// <summary>
/// Returns the current best objective bound.
/// </summary>
public const int MIP_OBJBND = 3001;
/// <summary>
/// Returns the current explored node count.
/// </summary>
public const int MIP_NODCNT = 3002;
/// <summary>
/// Returns the current solution count.
/// </summary>
public const int MIP_SOLCNT = 3003;
/// <summary>
/// Returns the current cutting plane count.
/// </summary>
public const int MIP_CUTCNT = 3004;
/// <summary>
/// Returns the current unexplored node count.
/// </summary>
public const int MIP_NODLFT = 3005;
/// <summary>
/// Returns the current simplex iteration count.
/// </summary>
public const int MIP_ITRCNT = 3006;
/// <summary>
/// For a multi-scenario model, returns the number of scenarios that are still open.
/// </summary>
public const int MIP_OPENSCENARIOS = 3007;
/// <summary>
/// Returns the current phase of the MIP algorithm.
/// </summary>
public const int MIP_PHASE = 3008;
/// <summary>
/// Returns the new solution.
/// </summary>
public const int MIPSOL_SOL = 4001;
/// <summary>
/// Returns the objective value for the new solution.
/// </summary>
public const int MIPSOL_OBJ = 4002;
/// <summary>
/// Returns the current best objective value.
/// </summary>
public const int MIPSOL_OBJBST = 4003;
/// <summary>
/// Returns the current best objective bound.
/// </summary>
public const int MIPSOL_OBJBND = 4004;
/// <summary>
/// Returns the current explored node count.
/// </summary>
public const int MIPSOL_NODCNT = 4005;
/// <summary>
/// Returns the current solution count.
/// </summary>
public const int MIPSOL_SOLCNT = 4006;
/// <summary>
/// For a multi-scenario model, returns the number of scenarios that are still open.
/// </summary>
public const int MIPSOL_OPENSCENARIOS = 4007;
/// <summary>
/// Returns the current phase of the MIP algorithm.
/// </summary>
public const int MIPSOL_PHASE = 4008;
/// <summary>
/// Returns the status of the current node relaxation.
/// </summary>
public const int MIPNODE_STATUS = 5001;
/// <summary>
/// Returns the current node relaxation solution or ray.
/// </summary>
public const int MIPNODE_REL = 5002;
/// <summary>
/// Returns the current best objective value.
/// </summary>
public const int MIPNODE_OBJBST = 5003;
/// <summary>
/// Returns the current best objective bound.
/// </summary>
public const int MIPNODE_OBJBND = 5004;
/// <summary>
/// Returns the current explored node count.
/// </summary>
public const int MIPNODE_NODCNT = 5005;
/// <summary>
/// Returns the current solution count.
/// </summary>
public const int MIPNODE_SOLCNT = 5006;
/// <summary>
/// Returns the branching variable for the current node.
/// </summary>
public const int MIPNODE_BRVAR = 5007;
/// <summary>
/// For a multi-scenario model, returns the number of scenarios that are still open.
/// </summary>
public const int MIPNODE_OPENSCENARIOS = 5008;
/// <summary>
/// Returns the current phase of the MIP algorithm.
/// </summary>
public const int MIPNODE_PHASE = 5009;
/// <summary>
/// Returns the current barrier iteration count.
/// </summary>
public const int BARRIER_ITRCNT = 7001;
/// <summary>
/// Returns the current barrier primal objective value.
/// </summary>
public const int BARRIER_PRIMOBJ = 7002;
/// <summary>
/// Returns the current barrier dual objective value.
/// </summary>
public const int BARRIER_DUALOBJ = 7003;
/// <summary>
/// Returns the current barrier primal infeasibility.
/// </summary>
public const int BARRIER_PRIMINF = 7004;
/// <summary>
/// Returns the current barrier dual infeasibility.
/// </summary>
public const int BARRIER_DUALINF = 7005;
/// <summary>
/// Returns the current barrier complementarity violation.
/// </summary>
public const int BARRIER_COMPL = 7006;
/// <summary>
/// Returns the message that is being printed.
/// </summary>
public const int MSG_STRING = 6001;
/// <summary>
/// Returns the elapsed solver runtime (in seconds).
/// </summary>
public const int RUNTIME = 6002;
/// <summary>
/// Returns the elapsed solver work (in work units).
/// </summary>
public const int WORK = 6003;
/// <summary>
/// Returns the number of objectives that have already been optimized.
/// </summary>
public const int MULTIOBJ_OBJCNT = 8001;
/// <summary>
/// Returns the current solution count.
/// </summary>
public const int MULTIOBJ_SOLCNT = 8002;
/// <summary>
/// Returns the new solution.
/// </summary>
public const int MULTIOBJ_SOL = 8003;
/// <summary>
/// Returns the minimum number of constraints in the IIS.
/// </summary>
public const int IIS_CONSTRMIN = 9001;
/// <summary>
/// Returns the maximum number of constraints in the IIS.
/// </summary>
public const int IIS_CONSTRMAX = 9002;
/// <summary>
/// Returns the estimated number of constraints in the IIS.
/// </summary>
public const int IIS_CONSTRGUESS = 9003;
/// <summary>
/// Returns the minimum number of bounds in the IIS.
/// </summary>
public const int IIS_BOUNDMIN = 9004;
/// <summary>
/// Returns the maximum number of bounds in the IIS.
/// </summary>
public const int IIS_BOUNDMAX = 9005;
/// <summary>
/// Returns the estimated number of bounds in the IIS.
/// </summary>
public const int IIS_BOUNDGUESS = 9006;
}
// Errors
/// <summary>
/// Gurobi error codes.
/// </summary>
public class Error
{
/// <summary>
/// Available memory was exhausted.
/// </summary>
public const int OUT_OF_MEMORY = 10001;
/// <summary>
/// NULL input value provided for a required argument.
/// </summary>
public const int NULL_ARGUMENT = 10002;
/// <summary>
/// Invalid input value.
/// </summary>
public const int INVALID_ARGUMENT = 10003;
/// <summary>
/// Tried to query or set an unknown attribute.
/// </summary>
public const int UNKNOWN_ATTRIBUTE = 10004;
/// <summary>
/// Tried to query or set an attribute that could not be accessed.
/// </summary>
public const int DATA_NOT_AVAILABLE = 10005;
/// <summary>
/// Index for attribute query was out of range.
/// </summary>
public const int INDEX_OUT_OF_RANGE = 10006;
/// <summary>
/// Tried to query or set an unknown parameter.
/// </summary>
public const int UNKNOWN_PARAMETER = 10007;
/// <summary>
/// Tried to set a parameter to a value that is outside its valid range.
/// </summary>
public const int VALUE_OUT_OF_RANGE = 10008;
/// <summary>
/// Failed to obtain a Gurobi license.
/// </summary>
public const int NO_LICENSE = 10009;
/// <summary>
/// Attempted to solve a model that is larger than the limit for a
/// trial license.
/// </summary>
public const int SIZE_LIMIT_EXCEEDED = 10010;
/// <summary>
/// Problem in callback.
/// </summary>
public const int CALLBACK = 10011;
/// <summary>
/// Failed to read the requested file.
/// </summary>
public const int FILE_READ = 10012;
/// <summary>
/// Failed to write the requested file.
/// </summary>
public const int FILE_WRITE = 10013;
/// <summary>
/// Numerical error during requested operation.
/// </summary>
public const int NUMERIC = 10014;
/// <summary>
/// Attempted to perform infeasibility analysis on a feasible model.
/// </summary>
public const int IIS_NOT_INFEASIBLE = 10015;
/// <summary>
/// Requested operation not valid for a MIP model.
/// </summary>
public const int NOT_FOR_MIP = 10016;
/// <summary>
/// Tried to access a model while optimization was in progress.
/// </summary>
public const int OPTIMIZATION_IN_PROGRESS = 10017;
/// <summary>
/// Constraint, variable, or SOS contained duplicate indices.
/// </summary>
public const int DUPLICATES = 10018;
/// <summary>
/// Error in reading or writing a MIP node file.
/// </summary>
public const int NODEFILE = 10019;
/// <summary>
/// non-PSD Q matrix in the objective or in a quadratic constraint.
/// </summary>
public const int Q_NOT_PSD = 10020;
/// <summary>
/// Equality quadratic constraints.
/// </summary>
public const int QCP_EQUALITY_CONSTRAINT = 10021;
/// <summary>
/// Network error.
/// </summary>
public const int NETWORK = 10022;
/// <summary>
/// Job rejected from Compute Server queue.
/// </summary>
public const int JOB_REJECTED = 10023;
/// <summary>
/// Operation is not supported in the current usage environment.
/// </summary>
public const int NOT_SUPPORTED = 10024;
/// <summary>
/// Result is larger than return value allows.
/// </summary>
public const int EXCEED_2B_NONZEROS = 10025;
/// <summary>
/// Problem with piecewise-linear objective function.
/// </summary>
public const int INVALID_PIECEWIE_OBJ = 10026;
/// <summary>
/// Not allowed to change UpdateMode parameter once model
/// has been created.
/// </summary>
public const int UPDATEMODE_CHANGE = 10027;
/// <summary>
/// Problem launching Instant Cloud job.
/// </summary>
public const int CLOUD = 10028;
/// <summary>
/// An error occurred during model modification or update.
/// </summary>
public const int MODEL_MODIFICATION = 10029;
/// <summary>
/// An error occured with the client-server application.
/// </summary>
public const int CSWORKER = 10030;
/// <summary>
/// Multi-model tuning invoked on models of different types.
/// </summary>
public const int TUNE_MODEL_TYPES = 10031;
/// <summary>
/// Multi-model tuning invoked on models of different types.
/// </summary>
public const int SECURITY = 10032;
/// <summary>
/// Tried to access a constraint or variable that is not in the model.
/// </summary>
public const int NOT_IN_MODEL = 20001;
/// <summary>
/// Failed to create the requested model.
/// </summary>
public const int FAILED_TO_CREATE_MODEL = 20002;
/// <summary>
/// Internal Gurobi error.
/// </summary>
public const int INTERNAL = 20003;
}
// Cuts parameter values
/// <summary>
/// Constant for Cuts parameter -
/// choose cuts control automatically.
/// </summary>
public const int CUTS_AUTO = -1;
/// <summary>
/// Constant for Cuts parameter -
/// shuts off cuts.
/// </summary>
public const int CUTS_OFF = 0;
/// <summary>
/// Constant for Cuts parameter -
/// moderate cut generation.
/// </summary>
public const int CUTS_CONSERVATIVE = 1;
/// <summary>
/// Constant for Cuts parameter -
/// aggressive cut generation.
/// </summary>
public const int CUTS_AGGRESSIVE = 2;
/// <summary>
/// Constant for Cuts parameter -
/// very aggressive cut generation.
/// </summary>
public const int CUTS_VERYAGGRESSIVE = 3;
// Presolve parameter values
/// <summary>
/// Constant for Presolve parameter -
/// automatic presolve setting.
/// </summary>
public const int PRESOLVE_AUTO = -1;
/// <summary>
/// Constant for Presolve parameter -
/// turns off presolve.
/// </summary>
public const int PRESOLVE_OFF = 0;
/// <summary>
/// Constant for Presolve parameter -
/// moderate presolve setting.
/// </summary>
public const int PRESOLVE_CONSERVATIVE = 1;
/// <summary>
/// Constant for Presolve parameter -
/// aggressive presolve setting.
/// </summary>
public const int PRESOLVE_AGGRESSIVE = 2;
// Method parameter values
/// <summary>
/// Constant for Method parameter -
/// choose method automatically.
/// </summary>
public const int METHOD_NONE = -1;
public const int METHOD_AUTO = -1;
/// <summary>
/// Constant for Method and NodeMethod parameters -
/// use primal simplex.
/// </summary>
public const int METHOD_PRIMAL = 0;
/// <summary>
/// Constant for Method and NodeMethod parameters -
/// use dual simplex.
/// </summary>
public const int METHOD_DUAL = 1;