Program Listing for File task.h

Return to documentation for file (include/stomp/task.h)

#ifndef STOMP_TASK_H_
#define STOMP_TASK_H_

#include <Eigen/Core>
#include <memory>
#include <stomp/utils.h>

namespace stomp
{
class Task;
typedef std::shared_ptr<Task> TaskPtr;
class Task
{
public:
  Task() {}

  virtual bool generateNoisyParameters(const Eigen::MatrixXd& parameters,
                                       std::size_t start_timestep,
                                       std::size_t num_timesteps,
                                       int iteration_number,
                                       int rollout_number,
                                       Eigen::MatrixXd& parameters_noise,
                                       Eigen::MatrixXd& noise) = 0;

  virtual bool computeNoisyCosts(const Eigen::MatrixXd& parameters,
                                 std::size_t start_timestep,
                                 std::size_t num_timesteps,
                                 int iteration_number,
                                 int rollout_number,
                                 Eigen::VectorXd& costs,
                                 bool& validity) = 0;

  virtual bool computeCosts(const Eigen::MatrixXd& parameters,
                            std::size_t start_timestep,
                            std::size_t num_timesteps,
                            int iteration_number,
                            Eigen::VectorXd& costs,
                            bool& validity) = 0;

  virtual bool filterNoisyParameters(std::size_t start_timestep,
                                     std::size_t num_timesteps,
                                     int iteration_number,
                                     int rollout_number,
                                     Eigen::MatrixXd& parameters,
                                     bool& filtered)
  {
    filtered = false;
    return true;
  }

  virtual bool filterParameterUpdates(std::size_t start_timestep,
                                      std::size_t num_timesteps,
                                      int iteration_number,
                                      const Eigen::MatrixXd& parameters,
                                      Eigen::MatrixXd& updates)
  {
    return true;
  }

  virtual void postIteration(std::size_t start_timestep,
                             std::size_t num_timesteps,
                             int iteration_number,
                             double cost,
                             const Eigen::MatrixXd& parameters)
  {
  }

  virtual void done(bool success, int total_iterations, double final_cost, const Eigen::MatrixXd& parameters) {}
};

}  // namespace stomp
#endif /* TASK_H_ */