Drake
SolverOptions Class Reference

Stores options for multiple solvers. More...

#include <drake/solvers/solver_options.h>

Public Member Functions

 SolverOptions ()=default
 
void SetOption (const SolverId &solver_id, const std::string &solver_option, double option_value)
 
void SetOption (const SolverId &solver_id, const std::string &solver_option, int option_value)
 
void SetOption (const SolverId &solver_id, const std::string &solver_option, const std::string &option_value)
 
const std::unordered_map< std::string, double > & GetOptionsDouble (const SolverId &solver_id) const
 
const std::unordered_map< std::string, int > & GetOptionsInt (const SolverId &solver_id) const
 
const std::unordered_map< std::string, std::string > & GetOptionsStr (const SolverId &solver_id) const
 
template<typename T >
const std::unordered_map< std::string, T > & GetOptions (const SolverId &solver_id) const
 
std::unordered_set< SolverIdGetSolverIds () const
 Returns the IDs that have any option set. More...
 
void Merge (const SolverOptions &other)
 Merges the other solver options into this. More...
 
bool operator== (const SolverOptions &other) const
 Returns true if this and other have exactly the same solvers, with exactly the same keys and values for the options for each solver. More...
 
bool operator!= (const SolverOptions &other) const
 Negate operator==. More...
 
void CheckOptionKeysForSolver (const SolverId &solver_id, const std::unordered_set< std::string > &allowable_double_keys, const std::unordered_set< std::string > &allowable_int_keys, const std::unordered_set< std::string > &allowable_str_keys) const
 Check if for a given solver_id, the option keys are included in double_keys, int_keys and str_keys. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 SolverOptions (const SolverOptions &)=default
 
SolverOptionsoperator= (const SolverOptions &)=default
 
 SolverOptions (SolverOptions &&)=default
 
SolverOptionsoperator= (SolverOptions &&)=default
 

Detailed Description

Stores options for multiple solvers.

This interface does not do any verification of solver parameters. It does not even verify that the specified solver exists. Use this only when you have particular knowledge of what solver is being invoked, and exactly what tuning is required.

Supported solver names/options:

"SNOPT" – Parameter names and values as specified in SNOPT User's Guide section 7.7 "Description of the optional parameters", used as described in section 7.5 for snSet(). The SNOPT user guide can be obtained from https://web.stanford.edu/group/SOL/guides/sndoc7.pdf

"IPOPT" – Parameter names and values as specified in IPOPT users guide section "Options Reference" http://www.coin-or.org/Ipopt/documentation/node40.html

"GUROBI" – Parameter name and values as specified in Gurobi Reference Manual, section 10.2 "Parameter Descriptions" https://www.gurobi.com/documentation/7.5/refman/parameters.html

"SCS" – Parameter name and values as specified in the struct SCS_SETTINGS in SCS header file https://github.com/cvxgrp/scs/blob/master/include/scs.h Note that the SCS code on github master might be more up-to-date than the version used in Drake.

"MOSEK" – Parameter name and values as specified in Mosek Reference https://docs.mosek.com/8.0/capi/parameters.html

Constructor & Destructor Documentation

◆ SolverOptions() [1/3]

SolverOptions ( )
default

◆ SolverOptions() [2/3]

SolverOptions ( const SolverOptions )
default

◆ SolverOptions() [3/3]

SolverOptions ( SolverOptions &&  )
default

Member Function Documentation

◆ CheckOptionKeysForSolver()

void CheckOptionKeysForSolver ( const SolverId solver_id,
const std::unordered_set< std::string > &  allowable_double_keys,
const std::unordered_set< std::string > &  allowable_int_keys,
const std::unordered_set< std::string > &  allowable_str_keys 
) const

Check if for a given solver_id, the option keys are included in double_keys, int_keys and str_keys.

Parameters
solver_idIf this SolverOptions has set options for this solver_id, then we check if the option keys are a subset of double_keys, int_keys and str_keys.
double_keysThe set of allowable keys for double options.
int_keysThe set of allowable keys for int options.
str_keysThe set of allowable keys for string options.
Exceptions
invalid_argumentif the solver contains un-allowed options.

◆ GetOptions()

const std::unordered_map<std::string, T>& GetOptions ( const SolverId solver_id) const

◆ GetOptionsDouble()

const std::unordered_map< std::string, double > & GetOptionsDouble ( const SolverId solver_id) const

◆ GetOptionsInt()

const std::unordered_map< std::string, int > & GetOptionsInt ( const SolverId solver_id) const

◆ GetOptionsStr()

const std::unordered_map< std::string, std::string > & GetOptionsStr ( const SolverId solver_id) const

◆ GetSolverIds()

std::unordered_set< SolverId > GetSolverIds ( ) const

Returns the IDs that have any option set.

◆ Merge()

void Merge ( const SolverOptions other)

Merges the other solver options into this.

If other and this option both define the same option for the same solver, we ignore then one from other and keep the one from this.

◆ operator!=()

bool operator!= ( const SolverOptions other) const

Negate operator==.

◆ operator=() [1/2]

SolverOptions& operator= ( SolverOptions &&  )
default

◆ operator=() [2/2]

SolverOptions& operator= ( const SolverOptions )
default

◆ operator==()

bool operator== ( const SolverOptions other) const

Returns true if this and other have exactly the same solvers, with exactly the same keys and values for the options for each solver.

◆ SetOption() [1/3]

void SetOption ( const SolverId solver_id,
const std::string &  solver_option,
double  option_value 
)

◆ SetOption() [2/3]

void SetOption ( const SolverId solver_id,
const std::string &  solver_option,
int  option_value 
)

◆ SetOption() [3/3]

void SetOption ( const SolverId solver_id,
const std::string &  solver_option,
const std::string &  option_value 
)

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