OP
0.1
OP is a optimization solver plugin package
|
Op namespace. More...
Namespaces | |
debug | |
This namespace includes several methods for debugging parallel communication patterns. | |
mpi | |
template MPI namespace | |
utility | |
Utility methods to facilitate common operations. | |
Classes | |
class | NLopt |
A op::optimizer implementation for NLopt. More... | |
struct | NLoptOptions |
Options specific for nlopt. They are made to look like ipopt's interface. More... | |
class | Go |
class | Vector |
Abstracted Optimization Vector container. More... | |
class | Functional |
Abstracted Objective Functional class. More... | |
class | Optimizer |
Abstracted Optimizer implementation. More... | |
class | WaitLoop |
Typedefs | |
using | nlopt_index_type = std::vector< std::size_t > |
Default nlopt type. | |
using | CallbackFn = std::function< void()> |
Callback function type. | |
using | ActionFn = std::function< void()> |
Action type we'll use over and over again. | |
Enumerations | |
enum | State : int { OTHER, SOLUTION_FOUND = -4, UPDATE_VARIABLES = -3, OBJ_GRAD = -2, OBJ_EVAL = -1 } |
Functions | |
template<typename T > | |
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... | |
auto | wrapNLoptFunc (std::function< double(unsigned, const double *, double *, void *)> func) |
wraps any nltop::function into an objective call and a gradient call More... | |
template<typename T > | |
NLopt (op::Vector< std::vector< double >>, NLoptOptions &, MPI_Comm, utility::CommPattern< T >) -> NLopt< T > | |
template<class OptType , typename... Args> | |
std::unique_ptr< OptType > | PluginOptimizer (std::string optimizer_path, Args &&...args) |
Dynamically load an Optimizer. More... | |
template<typename V , typename T > | |
auto | ReduceObjectiveFunction (const std::function< V(T)> &local_func, MPI_Op op, MPI_Comm comm=MPI_COMM_WORLD) |
Generate an objective function that performs a global reduction. More... | |
template<typename T , typename I > | |
auto | OwnedLocalObjectiveGradientFunction (utility::RankCommunication< T > &info, I &global_ids_to_local, T &reduced_id_list, std::function< std::vector< double >(const std::vector< double > &)> local_obj_grad_func, std::function< double(const std::vector< double > &)> local_reduce_func, MPI_Comm comm=MPI_COMM_WORLD) |
Generate an objective gradient function that takes local variables and reduces them in parallel to locally "owned" variables. More... | |
template<typename T , typename I , typename ValuesType > | |
ValuesType | ReturnLocalUpdatedVariables (utility::RankCommunication< T > &info, I &global_ids_to_local, ValuesType &reduced_values) |
Generate update method to propagate owned local variables back to local variables in parallel. More... | |
template<typename T > | |
auto | AdvancedRegistration (T &global_ids_on_rank, int root=0, MPI_Comm mpicomm=MPI_COMM_WORLD) |
Op namespace.
Namespace for the OP interface.
enum op::State : int |
Define a simple state messaging scheme
n = constraint.size()
-4 => solution found -3 => update variables -2 => obj_grad -1 => obj_eval [0,n-1] => constraint_eval [n,2n-1] => constraint_eval
Definition at line 23 of file op_waitloop.hpp.
auto op::AdvancedRegistration | ( | T & | global_ids_on_rank, |
int | root = 0 , |
||
MPI_Comm | mpicomm = MPI_COMM_WORLD |
||
) |
AdvancedRegistration procedure given
double op::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.
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
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
Definition at line 406 of file nlopt_op.hpp.
auto op::OwnedLocalObjectiveGradientFunction | ( | utility::RankCommunication< T > & | info, |
I & | global_ids_to_local, | ||
T & | reduced_id_list, | ||
std::function< std::vector< double >(const std::vector< double > &)> | local_obj_grad_func, | ||
std::function< double(const std::vector< double > &)> | local_reduce_func, | ||
MPI_Comm | comm = MPI_COMM_WORLD |
||
) |
Generate an objective gradient function that takes local variables and reduces them in parallel to locally "owned" variables.
[in] | info | RankCommunication struct for local_variables |
[in] | global_ids_to_local | A vector mapping of global ids corresponding to local_variable indices |
[in] | local_obj_grad_func | The rank-local gradient contributions corresponding to local_variables |
[in] | local_reduce_func | A serial user-defined function computed on "owned" variables over both recieved contributions from other ranks and rank-local gradient contributions |
[in] | comm | the MPI communicator |
std::unique_ptr<OptType> op::PluginOptimizer | ( | std::string | optimizer_path, |
Args &&... | args | ||
) |
auto op::ReduceObjectiveFunction | ( | const std::function< V(T)> & | local_func, |
MPI_Op | op, | ||
MPI_Comm | comm = MPI_COMM_WORLD |
||
) |
ValuesType op::ReturnLocalUpdatedVariables | ( | utility::RankCommunication< T > & | info, |
I & | global_ids_to_local, | ||
ValuesType & | reduced_values | ||
) |
Generate update method to propagate owned local variables back to local variables in parallel.
for the variables a rank owns.. update() should propagate those for the variables an update does not own.. they will be in returned_data returned_remapped_data is a map[local_ids] -> values we want to write it back into our local variable array
[in] | info | The RankCommunication information corresponding to local_variable data |
[in] | global_ids_to_local | A vector mapping of global ids corresponding to local_variable indices |
[in] | reduced_values | The rank-local "owned" variables |
auto op::wrapNLoptFunc | ( | std::function< double(unsigned, const double *, double *, void *)> | func | ) |
wraps any nltop::function into an objective call and a gradient call
[in] | func | a nlopt::function |
Definition at line 40 of file nlopt_op.hpp.