21 #ifndef B3_TRAJECTORY_PRIOR_H
22 #define B3_TRAJECTORY_PRIOR_H
27 #include <gp_cpp/gp_predictive.h>
28 #include <gp_cpp/gp_mean.h>
29 #include <gp_cpp/gp_covariance.h>
30 #include <gp_cpp/gp_pdf.h>
45 typedef gp::Predictive_nl<gp::Zero, gp::Sqex> Prior;
61 "Cannot create Trajectory prior: dimension cannot be 0.");
93 const std::string&
name()
const {
return name_; }
96 size_t start()
const {
return start_; }
99 size_t end()
const {
return end_; }
114 "Cannot compute trajectory prior; wrong trajectory dimension.");
116 IFT(traj.
size() == end_ - start_ + 1, Illegal_argument,
117 "Cannot compute trajectory prior; wrong trajectory size.");
121 for(
size_t d = 0; d < dim_; d++)
131 void update_priors()
const;
143 mutable std::vector<Prior> priors_;
144 mutable bool priors_dirty_;
151 prior.update_priors();
154 std::vector<Trajectory::vec_t> trajs(D);
155 for(
size_t d = 0; d <
D; d++)
157 trajs[d] =
sample(prior.priors_[d]);
Trajectory_prior(size_t dim, const Activity_library &lib)
Crate a trajectory prior.
Definition: bbb_trajectory_prior.h:53
Activity_sequence sample(const As_prior &prior)
Sample an activity sequence from the given prior.
Definition: bbb_activity_sequence_prior.cpp:90
size_t start() const
Get the start time of the prior.
Definition: bbb_trajectory_prior.h:96
const Vector & end_mean() const
Get the end mean.
Definition: bbb_trajectory_prior.h:105
Definition: bbb_trajectory_prior.h:42
size_t size() const
Gets the size of this person.
Definition: bbb_trajectory.h:118
int get_length() const
Return the length of the vector.
Definition: m_vector.h:501
void set_end(size_t end)
Set the end time.
Definition: bbb_trajectory_prior.h:75
size_t end() const
Get the end time of the prior.
Definition: bbb_trajectory_prior.h:99
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
const std::string & name() const
Get the activity name of the prior.
Definition: bbb_trajectory_prior.h:93
void set_endpoint_means(const Vector &mu_s, const Vector &mu_e)
Set the endpoint means.
Definition: bbb_trajectory_prior.h:78
#define IFT(a, ex, msg)
Definition: l_exception.h:101
const vec_t & dim(size_t d) const
Gets the trajectory of this person.
Definition: bbb_trajectory.h:93
Definition: bbb_trajectory.h:41
size_t dimension() const
Get the dimensionality of the trajectories of this prior.
Definition: bbb_trajectory_prior.h:90
double log_pdf(const MV_gaussian_distribution &P, const Vector &x)
Computes the log PDF a multivariate normal distribution at x.
Definition: prob_pdf.cpp:64
const Vector & start_mean() const
Get the start mean.
Definition: bbb_trajectory_prior.h:102
friend Trajectory sample(const Trajectory_prior &prior)
Draw a sample (a Trajectory) from a trajectory prior.
Definition: bbb_trajectory_prior.h:149
void set_start(size_t start)
Set the start time.
Definition: bbb_trajectory_prior.h:72
void set_name(const std::string &name)
Set the activity name.
Definition: bbb_trajectory_prior.h:65
const Activity_library & library() const
Get activity library.
Definition: bbb_trajectory_prior.h:108
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
void set_dimensions(size_t st, VecIter first, VecIter last)
Set dimensions of this trajectory.
Definition: bbb_trajectory.h:160
double operator()(const Trajectory &traj) const
Evaluate this prior on a trajectory.
Definition: bbb_trajectory_prior.h:111
D
Definition: APPgetLargeConnectedEdges.m:106
Support for error handling exception classes in libKJB.
size_t dimensions() const
Gets the dimensionality of this person's trajectory.
Definition: bbb_trajectory.h:105
Definition: bbb_activity_library.h:38
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...