Try our new documentation site (beta).
Gurobi Optimizer Reference Manual
Version 8.1, Copyright © 2019, Gurobi Optimization, LLC
This is the reference manual for the GurobiTM Optimizer. It contains documentation for the following Gurobi language interfaces:
The Gurobi interactive shell is also documented in the Python section.
Additional Topics
This document covers a number of additional topics, which are listed here:
- Variables and Constraints
- Attributes
- Parameters
- Optimization Status Codes
- Callback Codes
- Error Codes
- File Formats
- Logging
- Command-Line Tool
- Solution Pool
- Multiple Objectives
- Recording API Calls
- Concurrent Optimizer
- Parameter Tuning Tool
- Instant Cloud
- Guidelines for Numerical Issues
Additional Resources
You can consult the Gurobi Quick Start for a high-level overview of the Gurobi Optimizer, or the Gurobi Example Tour for a quick tour of the examples provided with the Gurobi distribution, or the Gurobi Remote Services Reference Manual for an overview of Gurobi Compute Server, Distributed Algorithms, and Gurobi Remote Services.
Getting Help
If you have a question that is not answered in this document, please visit the Gurobi support site at https://support.gurobi.com. There, you can read knowledge base articles and join the community discussion forum. Also, if you have a current maintenance contract, you can use the Gurobi support site to submit a request to the Gurobi support team.
- C API Overview
- C API Details
- Environment Creation and Destruction
- Model Creation and Modification
- GRBloadmodel
- GRBnewmodel
- GRBcopymodel
- GRBaddconstr
- GRBaddconstrs
- GRBaddgenconstrXxx
- GRBaddgenconstrMax
- GRBaddgenconstrMin
- GRBaddgenconstrAbs
- GRBaddgenconstrAnd
- GRBaddgenconstrOr
- GRBaddgenconstrIndicator
- GRBaddqconstr
- GRBaddqpterms
- GRBaddrangeconstr
- GRBaddrangeconstrs
- GRBaddsos
- GRBaddvar
- GRBaddvars
- GRBchgcoeffs
- GRBdelconstrs
- GRBdelgenconstrs
- GRBdelq
- GRBdelqconstrs
- GRBdelsos
- GRBdelvars
- GRBsetobjectiven
- GRBsetpwlobj
- GRBupdatemodel
- GRBfreemodel
- GRBXaddconstrs
- GRBXaddrangeconstrs
- GRBXaddvars
- GRBXchgcoeffs
- GRBXloadmodel
- Model Solution
- Model Queries
- Input/Output
- Attribute Management
- GRBgetattrinfo
- GRBgetintattr
- GRBsetintattr
- GRBgetintattrelement
- GRBsetintattrelement
- GRBgetintattrarray
- GRBsetintattrarray
- GRBgetintattrlist
- GRBsetintattrlist
- GRBgetdblattr
- GRBsetdblattr
- GRBgetdblattrelement
- GRBsetdblattrelement
- GRBgetdblattrarray
- GRBsetdblattrarray
- GRBgetdblattrlist
- GRBsetdblattrlist
- GRBgetcharattrelement
- GRBsetcharattrelement
- GRBgetcharattrarray
- GRBsetcharattrarray
- GRBgetcharattrlist
- GRBsetcharattrlist
- GRBgetstrattr
- GRBsetstrattr
- GRBgetstrattrelement
- GRBsetstrattrelement
- GRBgetstrattrarray
- GRBsetstrattrarray
- GRBgetstrattrlist
- GRBsetstrattrlist
- Parameter Management and Tuning
- Monitoring Progress - Logging and Callbacks
- Modifying Solver Behavior - Callbacks
- Error Handling
- Advanced simplex routines
- C++ API Overview
- C++ API Details
- GRBEnv
- GRBModel
- GRBModel()
- GRBModel::addConstr()
- GRBModel::addConstrs()
- GRBModel::addGenConstrXxx()
- GRBModel::addQConstr()
- GRBModel::addRange()
- GRBModel::addRanges()
- GRBModel::addSOS()
- GRBModel::addVar()
- GRBModel::addVars()
- GRBModel::chgCoeff()
- GRBModel::chgCoeffs()
- GRBModel::computeIIS()
- GRBModel::discardConcurrentEnvs()
- GRBModel::discardMultiobjEnvs()
- GRBModel::feasRelax()
- GRBModel::fixedModel()
- GRBModel::get()
- GRBModel::getCoeff()
- GRBModel::getCol()
- GRBModel::getConcurrentEnv()
- GRBModel::getConstrByName()
- GRBModel::getConstrs()
- GRBModel::getEnv()
- GRBModel::getGenConstrMax()
- GRBModel::getGenConstrMin()
- GRBModel::getGenConstrAbs()
- GRBModel::getGenConstrAnd()
- GRBModel::getGenConstrOr()
- GRBModel::getGenConstrIndicator()
- GRBModel::getGenConstrs()
- GRBModel::getMultiobjEnv()
- GRBModel::getObjective()
- GRBModel::getPWLObj()
- GRBModel::getQCRow()
- GRBModel::getQConstrs()
- GRBModel::getRow()
- GRBModel::getSOS()
- GRBModel::getSOSs()
- GRBModel::getTuneResult()
- GRBModel::getVarByName()
- GRBModel::getVars()
- GRBModel::optimize()
- GRBModel::optimizeasync()
- GRBModel::presolve()
- GRBModel::read()
- GRBModel::remove()
- GRBModel::reset()
- GRBModel::setCallback()
- GRBModel::set()
- GRBModel::setObjective()
- GRBModel.setObjectiveN()
- GRBModel::setPWLObj()
- GRBModel::sync()
- GRBModel::terminate()
- GRBModel::tune()
- GRBModel::update()
- GRBModel::write()
- GRBVar
- GRBConstr
- GRBQConstr
- GRBSOS
- GRBGenConstr
- GRBExpr
- GRBLinExpr
- GRBLinExpr()
- GRBLinExpr::addTerms()
- GRBLinExpr::clear()
- GRBLinExpr::getConstant()
- GRBLinExpr::getCoeff()
- GRBLinExpr::getValue()
- GRBLinExpr::getVar()
- GRBLinExpr::operator=
- GRBLinExpr::operator+
- GRBLinExpr::operator-
- GRBLinExpr::operator+=
- GRBLinExpr::operator-=
- GRBLinExpr::operator*=
- GRBLinExpr::remove()
- GRBLinExpr::size()
- GRBQuadExpr
- GRBQuadExpr()
- GRBQuadExpr::addTerm()
- GRBQuadExpr::addTerms()
- GRBQuadExpr::clear()
- GRBQuadExpr::getCoeff()
- GRBQuadExpr::getLinExpr()
- GRBQuadExpr::getValue()
- GRBQuadExpr::getVar1()
- GRBQuadExpr::getVar2()
- GRBQuadExpr::operator=
- GRBQuadExpr::operator+
- GRBQuadExpr::operator-
- GRBQuadExpr::operator+=
- GRBQuadExpr::operator-=
- GRBQuadExpr::operator*=
- GRBQuadExpr::remove()
- GRBQuadExpr::size()
- GRBTempConstr
- GRBColumn
- GRBCallback
- GRBCallback::stopOneMultiObj()
- GRBException
- Non-Member Functions
- Attribute Enums
- Parameter Enums
- Java API Overview
- Java API Details
- GRBEnv
- GRBModel
- GRBModel()
- GRBModel.addConstr()
- GRBModel.addConstrs()
- GRBModel.addGenConstrXxx()
- GRBModel.addQConstr()
- GRBModel.addRange()
- GRBModel.addRanges()
- GRBModel.addSOS()
- GRBModel.addVar()
- GRBModel.addVars()
- GRBModel.chgCoeff()
- GRBModel.chgCoeffs()
- GRBModel.computeIIS()
- GRBModel.discardConcurrentEnvs()
- GRBModel.discardMultiobjEnvs()
- GRBModel.dispose()
- GRBModel.feasRelax()
- GRBModel.fixedModel()
- GRBModel.get()
- GRBModel.getCoeff()
- GRBModel.getCol()
- GRBModel.getConcurrentEnv()
- GRBModel.getConstrByName()
- GRBModel.getConstrs()
- GRBModel.getEnv()
- GRBModel.getGenConstrMax()
- GRBModel.getGenConstrMin()
- GRBModel.getGenConstrAbs()
- GRBModel.getGenConstrAnd()
- GRBModel.getGenConstrOr()
- GRBModel.getGenConstrIndicator()
- GRBModel.getGenConstrs()
- GRBModel.getMultiobjEnv()
- GRBModel.getObjective()
- GRBModel.getPWLObj()
- GRBModel.getQCRow()
- GRBModel.getQConstrs()
- GRBModel.getRow()
- GRBModel.getSOS()
- GRBModel.getSOSs()
- GRBModel.getTuneResult()
- GRBModel.getVarByName()
- GRBModel.getVars()
- GRBModel.optimize()
- GRBModel.optimizeasync()
- GRBModel.presolve()
- GRBModel.read()
- GRBModel.remove()
- GRBModel.reset()
- GRBModel.setCallback()
- GRBModel.set()
- GRBModel.setObjective()
- GRBModel.setObjectiveN()
- GRBModel.setPWLObj()
- GRBModel.sync()
- GRBModel.terminate()
- GRBModel.tune()
- GRBModel.update()
- GRBModel.write()
- GRBVar
- GRBConstr
- GRBQConstr
- GRBSOS
- GRBGenConstr
- GRBExpr
- GRBLinExpr
- GRBQuadExpr
- GRBColumn
- GRBCallback
- GRBCallback.stopOneMultiObj()
- GRBException
- GRB
- .NET API Overview
- .NET API Details
- GRBEnv
- GRBModel
- GRBModel()
- GRBModel.AddConstr()
- GRBModel.AddConstrs()
- GRBModel.AddGenConstrXxx()
- GRBModel.AddQConstr()
- GRBModel.AddRange()
- GRBModel.AddRanges()
- GRBModel.AddSOS()
- GRBModel.AddVar()
- GRBModel.AddVars()
- GRBModel.ChgCoeff()
- GRBModel.ChgCoeffs()
- GRBModel.ComputeIIS()
- GRBModel.DiscardConcurrentEnvs()
- GRBModel.DiscardMultiobjEnvs()
- GRBModel.Dispose()
- GRBModel.FeasRelax()
- GRBModel.FixedModel()
- GRBModel.Get()
- GRBModel.GetCoeff()
- GRBModel.GetCol()
- GRBModel.GetConcurrentEnv()
- GRBModel.GetConstrByName()
- GRBModel.GetConstrs()
- GRBModel.GetEnv()
- GRBModel.GetGenConstrMax()
- GRBModel.GetGenConstrMin()
- GRBModel.GetGenConstrAbs()
- GRBModel.GetGenConstrAnd()
- GRBModel.GetGenConstrOr()
- GRBModel.GetGenConstrIndicator()
- GRBModel.GetGenConstrs()
- GRBModel.GetMultiobjEnv()
- GRBModel.GetObjective()
- GRBModel.GetPWLObj()
- GRBModel.GetQConstr()
- GRBModel.GetQConstrs()
- GRBModel.GetQCRow()
- GRBModel.GetRow()
- GRBModel.GetSOS()
- GRBModel.GetSOSs()
- GRBModel.GetTuneResult()
- GRBModel.GetVarByName()
- GRBModel.GetVars()
- GRBModel.Optimize()
- GRBModel::OptimizeAsync()
- GRBModel.Presolve()
- GRBModel.Read()
- GRBModel.Remove()
- GRBModel.Reset()
- GRBModel.SetCallback()
- GRBModel.Set()
- GRBModel.SetObjective()
- GRBModel.SetObjectiveN()
- GRBModel.SetPWLObj()
- GRBModel.Terminate()
- GRBModel.Tune()
- GRBModel.Update()
- GRBModel.Write()
- GRBVar
- GRBConstr
- GRBQConstr
- GRBSOS
- GRBGenConstr
- GRBExpr
- GRBLinExpr
- GRBQuadExpr
- GRBTempConstr
- GRBColumn
- Overloaded Operators
- GRBCallback
- GRBException
- GRB
- Python API Overview
- Python API Details
- Global Functions
- Model
- Model()
- Model.addConstr()
- Model.addConstrs()
- Model.addGenConstrXxx()
- Model.addGenConstrMax()
- Model.addGenConstrMin()
- Model.addGenConstrAbs()
- Model.addGenConstrAnd()
- Model.addGenConstrOr()
- Model.addGenConstrIndicator()
- Model.addLConstr()
- Model.addQConstr()
- Model.addRange()
- Model.addSOS()
- Model.addVar()
- Model.addVars()
- Model.cbCut()
- Model.cbGet()
- Model.cbGetNodeRel()
- Model.cbGetSolution()
- Model.cbLazy()
- Model.cbSetSolution()
- Model.cbStopOneMultiObj()
- Model.cbUseSolution()
- Model.chgCoeff()
- Model.computeIIS()
- Model.copy()
- Model.discardConcurrentEnvs()
- Model.discardMultiobjEnvs()
- Model.feasRelaxS()
- Model.feasRelax()
- Model.fixed()
- Model.getAttr()
- Model.getCoeff()
- Model.getCol()
- Model.getConcurrentEnv()
- Model.getConstrByName()
- Model.getConstrs()
- Model.getGenConstrMax()
- Model.getGenConstrMin()
- Model.getGenConstrAbs()
- Model.getGenConstrAnd()
- Model.getGenConstrOr()
- Model.getGenConstrIndicator()
- Model.getGenConstrs()
- Model.getMultiobjEnv()
- Model.getObjective()
- Model.getParamInfo()
- Model.getPWLObj()
- Model.getQConstrs()
- Model.getQCRow()
- Model.getRow()
- Model.getSOS()
- Model.getSOSs()
- Model.getTuneResult()
- Model.getVarByName()
- Model.getVars()
- Model.message()
- Model.optimize()
- Model.presolve()
- Model.printAttr()
- Model.printQuality()
- Model.printStats()
- Model.read()
- Model.relax()
- Model.remove()
- Model.reset()
- Model.resetParams()
- Model.setAttr()
- Model.setObjective()
- Model.setObjectiveN()
- Model.setPWLObj()
- Model.setParam()
- Model.terminate()
- Model.tune()
- Model.update()
- Model.write()
- Var
- Constr
- QConstr
- SOS
- GenConstr
- LinExpr
- QuadExpr
- GenExpr
- TempConstr
- Column
- Callbacks
- GurobiError
- Env
- GRB
- tuplelist
- tupledict
- General Constraint Helper Functions
- MATLAB API Overview
- MATLAB API Details
- Common Arguments
- Solving a Model
- Input/Output
- Using Gurobi within MATLAB's Problem-Based Optimization
- Setting up the Gurobi MATLAB interface
- R API Overview
- R API Details
- Variables and Constraints
- Attributes
- Model Attributes
- NumConstrs
- NumVars
- NumSOS
- NumQConstrs
- NumGenConstrs
- NumNZs
- DNumNZs
- NumQNZs
- NumQCNZs
- NumIntVars
- NumBinVars
- NumPWLObjVars
- ModelName
- ModelSense
- ObjCon
- ObjVal
- ObjBound
- ObjBoundC
- PoolObjBound
- PoolObjVal
- MIPGap
- Runtime
- Status
- SolCount
- IterCount
- BarIterCount
- NodeCount
- IsMIP
- IsQP
- IsQCP
- IsMultiObj
- IISMinimal
- MaxCoeff
- MinCoeff
- MaxBound
- MinBound
- MaxObjCoeff
- MinObjCoeff
- MaxRHS
- MinRHS
- MaxQCCoeff
- MinQCCoeff
- MaxQCLCoeff
- MinQCLCoeff
- MaxQCRHS
- MinQCRHS
- MaxQObjCoeff
- MinQObjCoeff
- Kappa
- KappaExact
- FarkasProof
- TuneResultCount
- NumStart
- LicenseExpiration
- JobID
- Server
- Variable Attributes
- Linear Constraint Attributes
- SOS Attributes
- Quadratic Constraint Attributes
- General Constraint Attributes
- Quality Attributes
- BoundVio
- BoundSVio
- BoundVioIndex
- BoundSVioIndex
- BoundVioSum
- BoundSVioSum
- ConstrVio
- ConstrSVio
- ConstrVioIndex
- ConstrSVioIndex
- ConstrVioSum
- ConstrSVioSum
- ConstrResidual
- ConstrSResidual
- ConstrResidualIndex
- ConstrSResidualIndex
- ConstrResidualSum
- ConstrSResidualSum
- DualVio
- DualSVio
- DualVioIndex
- DualSVioIndex
- DualVioSum
- DualSVioSum
- DualResidual
- DualSResidual
- DualResidualIndex
- DualSResidualIndex
- DualResidualSum
- DualSResidualSum
- ComplVio
- ComplVioIndex
- ComplVioSum
- IntVio
- IntVioIndex
- IntVioSum
- Multi-objective Attributes
- Attribute Examples
- Model Attributes
- Parameters
- Parameter Guidelines
- Parameter Descriptions
- AggFill
- Aggregate
- BarConvTol
- BarCorrectors
- BarHomogeneous
- BarIterLimit
- BarOrder
- BarQCPConvTol
- BestBdStop
- BestObjStop
- BranchDir
- CliqueCuts
- CloudAccessID
- CloudSecretKey
- CloudPool
- ComputeServer
- ConcurrentJobs
- ConcurrentMIP
- ConcurrentSettings
- CoverCuts
- Crossover
- CrossoverBasis
- CSGroup
- CSIdleTimeout
- CSPriority
- CSQueueTimeout
- CSRouter
- CSTLSInsecure
- CutAggPasses
- Cutoff
- CutPasses
- Cuts
- DegenMoves
- Disconnected
- DisplayInterval
- DistributedMIPJobs
- DualReductions
- FeasibilityTol
- FeasRelaxBigM
- FlowCoverCuts
- FlowPathCuts
- GomoryPasses
- GUBCoverCuts
- Heuristics
- IgnoreNames
- IISMethod
- ImpliedCuts
- ImproveStartGap
- ImproveStartNodes
- ImproveStartTime
- InfProofCuts
- InfUnbdInfo
- InputFile
- IntFeasTol
- IterationLimit
- LazyConstraints
- LogFile
- LogToConsole
- MarkowitzTol
- Method
- MinRelNodes
- MIPFocus
- MIPGap
- MIPGapAbs
- MIPSepCuts
- MIQCPMethod
- MIRCuts
- ModKCuts
- MultiObjMethod
- MultiObjPre
- NetworkCuts
- NodefileDir
- NodefileStart
- NodeLimit
- NodeMethod
- NormAdjust
- NumericFocus
- ObjNumber
- ObjScale
- OptimalityTol
- OutputFlag
- PartitionPlace
- PerturbValue
- PoolGap
- PoolSearchMode
- PoolSolutions
- PreCrush
- PreDepRow
- PreDual
- PreMIQCPForm
- PrePasses
- PreQLinearize
- Presolve
- PreSOS1BigM
- PreSOS2BigM
- PreSparsify
- ProjImpliedCuts
- PSDTol
- PumpPasses
- QCPDual
- Quad
- Record
- ResultFile
- RINS
- ScaleFlag
- Seed
- ServerPassword
- ServerTimeout
- Sifting
- SiftMethod
- SimplexPricing
- SolutionLimit
- SolutionNumber
- StartNodeLimit
- StartNumber
- StrongCGCuts
- SubMIPCuts
- SubMIPNodes
- Symmetry
- Threads
- TimeLimit
- TokenServer
- TSPort
- TuneCriterion
- TuneJobs
- TuneOutput
- TuneResults
- TuneTimeLimit
- TuneTrials
- UpdateMode
- VarBranch
- WorkerPassword
- WorkerPool
- ZeroHalfCuts
- ZeroObjNodes
- Parameter Examples
- Empty Environment
- Optimization Status Codes
- Callback Codes
- Error Codes
- Model File Formats
- MPS format
- REW format
- LP format
- RLP format
- ILP format
- OPB format
- MST format
- HNT format
- ORD format
- BAS format
- SOL format
- PRM format
- Logging
- Simplex Logging
- Barrier Logging
- Sifting Logging
- MIP Logging
- Multi-Objective Logging
- Distributed MIP Logging
- Gurobi Command-Line Tool
- Solution Pool
- Multiple Objectives
- Recording API Calls
- Concurrent Optimizer
- Parameter Tuning Tool
- Gurobi Instant Cloud
- Gurobi Guidelines for Numerical Issues