|
OP
0.1
OP is a optimization solver plugin package
|
A op::optimizer implementation for NLopt. More...
#include <nlopt_op.hpp>

Public Member Functions | |
| NLopt (op::Vector< std::vector< double >> &variables, NLoptOptions &o, std::optional< MPI_Comm > comm={}, std::optional< op::utility::CommPattern< T >> comm_pattern_info={}) | |
| Constructor for our optimizer. | |
| num_local_owned_variables_ (0) | |
| void | setObjective (op::Functional &o) override |
| Sets the optimization objective. More... | |
| void | addConstraint (op::Functional &o) override |
| Adds a constraint for the optimization problem. More... | |
| bool | variables_changed (const std::vector< double > &x) |
| Method to see if variables changed, if they have set new x. More... | |
| bool | isAdvanced () |
| returns whether NLopt is in "advanced" mode or not | |
| auto | generateReducedLocalGradientFunction (std::function< std::vector< double >(const std::vector< double > &)> local_grad_func, std::function< double(const std::vector< double > &)> local_reduce_func) |
| generates reduced local gradient using comm_pattern_ | |
Public Member Functions inherited from op::Optimizer | |
| Optimizer () | |
| Ctor has deferred initialization. | |
| iterate ([](){}) | |
| save ([](){}) | |
| final_obj (std::numeric_limits< double >::max()) | |
| void | Go () |
| Start the optimization. | |
| void | UpdatedVariableCallback () |
| What to do when the variables are updated. | |
| virtual double | Solution () |
| What to do when the solution is found. Return the objetive. | |
| void | Iteration () |
| What to do at the end of an optimization iteration. | |
| void | SaveState () |
| Saves the state of the optimizer. | |
| virtual | ~Optimizer ()=default |
| Destructor. | |
Protected Attributes | |
| MPI_Comm | comm_ |
| std::vector< double > | global_variables_ |
|
op::Vector< std::vector < double > > & | variables_ |
| std::unique_ptr< nlopt::opt > | nlopt_ |
| NLoptOptions & | options_ |
| std::vector< double > | previous_variables_ |
|
std::vector < detail::FunctionalInfo< T > > | obj_info_ |
|
std::vector < detail::FunctionalInfo< T > > | constraints_info_ |
| std::vector< int > | owned_variables_per_rank_ |
| std::vector< int > | owned_offsets_ |
|
std::optional < utility::CommPattern< T > > | comm_pattern_ |
|
std::optional < std::unordered_map< typename T::value_type, T > > | global_reduced_map_to_local_ |
| std::size_t | num_local_owned_variables_ |
| int | root_rank_ = 0 |
| std::unique_ptr< WaitLoop > | waitloop_ |
Friends | |
| double | NLoptFunctional (const std::vector< double > &x, std::vector< double > &grad, void *objective_and_optimizer) |
| Takes in a op::Functional and computes the objective function and it's gradient as a nlopt function. More... | |
Additional Inherited Members | |
Public Attributes inherited from op::Optimizer | |
| op::Go | go |
| Go function to start optimization. | |
| CallbackFn | update |
| Update callback to compute before function calculations. | |
| CallbackFn | iterate |
| iterate callback to compute before | |
| CallbackFn | save |
| callback for saving current optimizer state | |
| double | final_obj |
| final objective value | |
A op::optimizer implementation for NLopt.
Definition at line 15 of file nlopt_op.hpp.
|
inlineoverridevirtual |
Adds a constraint for the optimization problem.
| [in] | o | Constraint Functional |
Reimplemented from op::Optimizer.
Definition at line 305 of file nlopt_op.hpp.
|
inlineoverridevirtual |
Sets the optimization objective.
| [in] | o | Objective Functional |
Implements op::Optimizer.
Definition at line 298 of file nlopt_op.hpp.
|
inline |
Method to see if variables changed, if they have set new x.
| [in] | x |
Definition at line 331 of file nlopt_op.hpp.
|
friend |
Takes in a op::Functional and computes the objective function and it's gradient as a nlopt function.
Has the same signature as nlopt::function so we can convert any op::Functional into a nlopt::function
| [in] | x | the optimization variables (on rank = 0 this is the actual global optimization variables, on other ranks it is the local-view of variables.data()) |
| [in] | grad | the result of the gradient of the function w.r.t. x (on rank 0, this is the global gradient eval, on other ranks it is the owned-local gradient) |
| [in] | objective | Get FunctionalInfo into this call |
for constraints g >= lower_bound, they need to be rewritten as -(g - lower_bound) <= 0
for constraints g <= upper_bound, they need to be rewritten as g - upper_bound < = 0
1.8.5