Constants


Constants

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>
  /// 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;
  }

  // Version numbers

  /// <summary>
  /// Major number
  /// </summary>
  public const int VERSION_MAJOR     = 9;

  /// <summary>
  /// Minor number
  /// </summary>
  public const int VERSION_MINOR     = 5;

  /// <summary>
  /// Technical number
  /// </summary>
  public const int VERSION_TECHNICAL = 2;

  // 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;

  // 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;

  // 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;

  // Other constants

  /// <summary>
  /// Default compute server port.
  /// </summary>
  public const int DEFAULT_CS_PORT  = 61000;

  // 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;

  // 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.