dReal4
NloptOptimizer Class Reference

Wrapper class for nlopt. More...

#include </home/soonhokong/work/dreal4/dreal/optimization/nlopt_optimizer.h>

Public Member Functions

 NloptOptimizer (nlopt::algorithm algorithm, Box bound, const Config &config)
 Constructs an NloptOptimizer instance given algorithm and the bound box. More...
 
 NloptOptimizer (const NloptOptimizer &)=delete
 Deleted copy-constructor.
 
 NloptOptimizer (NloptOptimizer &&)=default
 Deleted move-constructor.
 
NloptOptimizeroperator= (const NloptOptimizer &)=delete
 Deleted copy-assignment operator.
 
NloptOptimizeroperator= (NloptOptimizer &&)=delete
 Deleted move-assignment operator.
 
 ~NloptOptimizer ()=default
 Destructor.
 
void SetMinObjective (const Expression &objective)
 Specifies the objective function.
 
void AddConstraint (const Formula &formula)
 Specifies a constraint. More...
 
void AddRelationalConstraint (const Formula &formula)
 Specifies a relational constraint. More...
 
void AddConstraints (const std::vector< Formula > &formulas)
 Specifies constraints.
 
nlopt::result Optimize (std::vector< double > *x, double *opt_f)
 Runs optimization. More...
 
nlopt::result Optimize (std::vector< double > *x, double *opt_f, const Environment &env)
 Runs optimization. More...
 

Detailed Description

Wrapper class for nlopt.

Constructor & Destructor Documentation

◆ NloptOptimizer()

NloptOptimizer ( nlopt::algorithm  algorithm,
Box  bound,
const Config config 
)

Constructs an NloptOptimizer instance given algorithm and the bound box.

See also
http://nlopt.readthedocs.io/en/latest/NLopt_Algorithms, for possible values of NLopt Algorithms.

Member Function Documentation

◆ AddConstraint()

void AddConstraint ( const Formula formula)

Specifies a constraint.

Note
formula should be one of the following kinds: 1) A relational formula (i.e. x >= y) 2) A negation of a relational formula (i.e. ¬(x > y)) 3) A conjunction of 1) or 2).
Exceptions
std::runtime_errorif the above condition does not meet.

◆ AddRelationalConstraint()

void AddRelationalConstraint ( const Formula formula)

Specifies a relational constraint.

Precondition
formula is a relational constraint.

◆ Optimize() [1/2]

nlopt::result Optimize ( std::vector< double > *  x,
double *  opt_f 
)

Runs optimization.

Uses x as an initial value for the optimization and updates it with a solution. opt_f will be updated with the found optimal value.

◆ Optimize() [2/2]

nlopt::result Optimize ( std::vector< double > *  x,
double *  opt_f,
const Environment env 
)

Runs optimization.

Note
Constraint and objective functions possibly include non-decision variables. If this is the case, env should be provided so that we can have full information to evaluate those functions.

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