Optimize with STOMP
The full example program can be found in file stomp_example.cpp
Define a Simple Task Implementation
Create a class that implements the stomp_core::Task as shown below
{
public:
SimpleOptimizationTask(const Eigen::MatrixXd& parameters_bias,
const std::vector<double>& bias_thresholds,
const std::vector<double>& std_dev):
parameters_bias_(parameters_bias),
bias_thresholds_(bias_thresholds),
std_dev_(std_dev)
{
int num_timesteps = parameters_bias.cols();
stomp_core::generateSmoothingMatrix(num_timesteps,1.0,smoothing_M_);
srand(time(0));
}
For full details look at stomp_core_examples::SimpleOptimizationTask
Instantiate a Task Object
Create an instance of the SimpleOptimizationTask defined in the previous step
Create a STOMP config object
Populate the stomp_core::StompConfiguration object as shown below:
Create an STOMP instance
Create an instance of STOMP using the Task and Configuration objects created in previous steps
Stomp stomp(config,task);
Call the Solve Method
Call the solve method and check the result
{
std::cout<<"STOMP succeeded"<<std::endl;
}
else
{
std::cout<<"A valid solution was not found"<<std::endl;
return -1;
}