Drake
GurobiSolver Class Reference

#include <drake/solvers/gurobi_solver.h>

Inheritance diagram for GurobiSolver:
[legend]
Collaboration diagram for GurobiSolver:
[legend]

Classes

struct  SolveStatusInfo
 Contains info returned to a user function that handles a Node or Solution callback. More...
 

Public Types

typedef std::function< void(const MathematicalProgram &, const SolveStatusInfo &callback_info, Eigen::VectorXd *, VectorXDecisionVariable *)> MipNodeCallbackFunction
 Users can supply a callback to be called when the Gurobi solver finds an intermediate solution node, which may not be feasible. More...
 
typedef std::function< void(const MathematicalProgram &, const SolveStatusInfo &callback_info)> MipSolCallbackFunction
 Users can supply a callback to be called when the Gurobi solver finds a feasible solution. More...
 

Public Member Functions

 GurobiSolver ()=default
 
 ~GurobiSolver () override=default
 
bool available () const override
 Returns true iff this solver was enabled at compile-time. More...
 
void AddMipNodeCallback (const MipNodeCallbackFunction &callback)
 Registers a callback to be called at intermediate solutions during the solve. More...
 
void AddMipSolCallback (const MipSolCallbackFunction &callback)
 Registers a callback to be called at feasible solutions during the solve. More...
 
SolutionResult Solve (MathematicalProgram &prog) const override
 Sets values for the decision variables on the given MathematicalProgram prog, or: More...
 
SolverId solver_id () const override
 Returns the identifier of this solver. More...
 
Does not allow copy, move, or assignment
 GurobiSolver (const GurobiSolver &)=delete
 
GurobiSolveroperator= (const GurobiSolver &)=delete
 
 GurobiSolver (GurobiSolver &&)=delete
 
GurobiSolveroperator= (GurobiSolver &&)=delete
 
- Public Member Functions inherited from MathematicalProgramSolverInterface
 MathematicalProgramSolverInterface ()=default
 
virtual ~MathematicalProgramSolverInterface ()=default
 
 MathematicalProgramSolverInterface (const MathematicalProgramSolverInterface &)=delete
 
MathematicalProgramSolverInterfaceoperator= (const MathematicalProgramSolverInterface &)=delete
 
 MathematicalProgramSolverInterface (MathematicalProgramSolverInterface &&)=delete
 
MathematicalProgramSolverInterfaceoperator= (MathematicalProgramSolverInterface &&)=delete
 

Static Public Member Functions

static SolverId id ()
 

Member Typedef Documentation

typedef std::function<void(const MathematicalProgram&, const SolveStatusInfo& callback_info, Eigen::VectorXd*, VectorXDecisionVariable*)> MipNodeCallbackFunction

Users can supply a callback to be called when the Gurobi solver finds an intermediate solution node, which may not be feasible.

See Gurobi reference manual for more detail on callbacks: https://www.gurobi.com/documentation/7.0/refman/callback_codes.html. The user may supply a partial solution in the VectorXd and VectorXDecisionVariable arguments that will be passed to Gurobi as a candidate feasible solution. See gurobi_solver_test.cc for an example of using std::bind to create a callback of this signature, while allowing additional data to be passed through.

Parameters
MathematicalProgram&The optimization wrapper, whose current variable values (accessible via MathematicalProgram::GetSolution) will be set to the intermediate solution values.
SolveStatusInfo&Intermediate solution status information values queried from Gurobi.
VectorXd*User may assign this to be the values of the variable assignments.
VectorXDecisionVariable*User may assign this to be the decision variables being assigned. Must have the same number of elements as the VectorXd assignment.
typedef std::function<void(const MathematicalProgram&, const SolveStatusInfo& callback_info)> MipSolCallbackFunction

Users can supply a callback to be called when the Gurobi solver finds a feasible solution.

See Gurobi reference manual for more detail on callbacks: https://www.gurobi.com/documentation/7.0/refman/callback_codes.html. See gurobi_solver_test.cc for an example of using std::bind to create a callback of this signature, while allowing additional data to be passed through.

Parameters
MathematicalProgram&The optimization wrapper, whose current variable values (accessible via MathematicalProgram::GetSolution) will be set to the intermediate solution values.
SolveStatusInfo&Intermediate solution status information values queried from Gurobi.
void*Arbitrary data supplied during callback registration.

Constructor & Destructor Documentation

GurobiSolver ( const GurobiSolver )
delete
GurobiSolver ( GurobiSolver &&  )
delete
GurobiSolver ( )
default
~GurobiSolver ( )
overridedefault

Member Function Documentation

void AddMipNodeCallback ( const MipNodeCallbackFunction callback)
inline

Registers a callback to be called at intermediate solutions during the solve.

Parameters
callbackUser callback function.
user_dataArbitrary data that will be passed to the user callback function.

Here is the caller graph for this function:

void AddMipSolCallback ( const MipSolCallbackFunction callback)
inline

Registers a callback to be called at feasible solutions during the solve.

Parameters
callbackUser callback function.
usrdataArbitrary data that will be passed to the user callback function.

Here is the call graph for this function:

Here is the caller graph for this function:

bool available ( ) const
overridevirtual

Returns true iff this solver was enabled at compile-time.

Implements MathematicalProgramSolverInterface.

Here is the caller graph for this function:

SolverId id ( )
static
Returns
same as MathematicalProgramSolverInterface::solver_id()

Here is the call graph for this function:

Here is the caller graph for this function:

GurobiSolver& operator= ( GurobiSolver &&  )
delete
GurobiSolver& operator= ( const GurobiSolver )
delete
SolutionResult Solve ( MathematicalProgram prog) const
overridevirtual

Sets values for the decision variables on the given MathematicalProgram prog, or:

  • If no solver is available, throws std::runtime_error
  • If the solver returns an error, returns a nonzero SolutionResult.

Implements MathematicalProgramSolverInterface.

Here is the call graph for this function:

Here is the caller graph for this function:

SolverId solver_id ( ) const
overridevirtual

Returns the identifier of this solver.

Implements MathematicalProgramSolverInterface.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: