Drake
MosekSolver Class Reference

#include <drake/solvers/mosek_solver.h>

Public Member Functions

 MosekSolver ()=default
 
 ~MosekSolver () override=default
 
bool available () const override
 Defined true if Mosek was included during compilation, false otherwise. More...
 
void Solve (const MathematicalProgram &prog, const optional< Eigen::VectorXd > &initial_guess, const optional< SolverOptions > &solver_options, MathematicalProgramResult *result) const override
 Solves an optimization program with optional initial guess and solver options. 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...
 
bool AreProgramAttributesSatisfied (const MathematicalProgram &prog) const override
 Returns true if the program attributes are satisfied by the solver's capability. More...
 
void set_stream_logging (bool flag, const std::string &log_file)
 Control stream logging. More...
 
Does not allow copy, move, or assignment
 MosekSolver (const MosekSolver &)=delete
 
MosekSolveroperator= (const MosekSolver &)=delete
 
 MosekSolver (MosekSolver &&)=delete
 
MosekSolveroperator= (MosekSolver &&)=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 bool is_available ()
 
static SolverId id ()
 
static bool ProgramAttributesSatisfied (const MathematicalProgram &prog)
 
static std::shared_ptr< License > AcquireLicense ()
 This acquires a MOSEK license environment shared among all MosekSolver instances; the environment will stay valid as long as at least one shared_ptr returned by this function is alive. More...
 

Constructor & Destructor Documentation

◆ MosekSolver() [1/3]

MosekSolver ( const MosekSolver )
delete

◆ MosekSolver() [2/3]

MosekSolver ( MosekSolver &&  )
delete

◆ MosekSolver() [3/3]

MosekSolver ( )
default

◆ ~MosekSolver()

~MosekSolver ( )
overridedefault

Member Function Documentation

◆ AcquireLicense()

shared_ptr< MosekSolver::License > AcquireLicense ( )
static

This acquires a MOSEK license environment shared among all MosekSolver instances; the environment will stay valid as long as at least one shared_ptr returned by this function is alive.

Call this ONLY if you must use different MathematicalProgram instances at different instances in time, and repeatedly acquiring the license is costly (e.g., requires contacting a license server).

Returns
A shared pointer to a license environment that will stay valid as long as any shared_ptr returned by this function is alive. If MOSEK is not available in your build, this will return a null (empty) shared_ptr.
Exceptions
std::runtime_errorif MOSEK is available but a license cannot be obtained.

◆ AreProgramAttributesSatisfied()

bool AreProgramAttributesSatisfied ( const MathematicalProgram prog) const
overridevirtual

Returns true if the program attributes are satisfied by the solver's capability.

Implements MathematicalProgramSolverInterface.

◆ available()

bool available ( ) const
inlineoverridevirtual

Defined true if Mosek was included during compilation, false otherwise.

Implements MathematicalProgramSolverInterface.

◆ id()

◆ is_available()

bool is_available ( )
static

◆ operator=() [1/2]

MosekSolver& operator= ( MosekSolver &&  )
delete

◆ operator=() [2/2]

MosekSolver& operator= ( const MosekSolver )
delete

◆ ProgramAttributesSatisfied()

bool ProgramAttributesSatisfied ( const MathematicalProgram prog)
static

◆ set_stream_logging()

void set_stream_logging ( bool  flag,
const std::string &  log_file 
)
inline

Control stream logging.

Refer to https://docs.mosek.com/8.1/capi/solver-io.html for more details.

Parameters
flagSet to true if the user want to turn on stream logging.
log_fileIf the user wants to output the logging to a file, then set log_file to the name of that file. If the user wants to output the logging to the console, then set log_file to empty string.

◆ Solve() [1/2]

void Solve ( const MathematicalProgram prog,
const optional< Eigen::VectorXd > &  initial_guess,
const optional< SolverOptions > &  solver_options,
MathematicalProgramResult result 
) const
overridevirtual

Solves an optimization program with optional initial guess and solver options.

Note that these initial guess and solver options are not written to prog.

Implements MathematicalProgramSolverInterface.

◆ Solve() [2/2]

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.

◆ solver_id()

SolverId solver_id ( ) const
overridevirtual

Returns the identifier of this solver.

Implements MathematicalProgramSolverInterface.


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