12#ifndef __CODAC_TUBE_H__
13#define __CODAC_TUBE_H__
18#include "codac_TFnc.h"
23#include "codac_TubeTreeSynthesis.h"
24#include "codac_TubePolynomialSynthesis.h"
25#include "codac_TubeSynthesis.h"
26#include "codac_Polygon.h"
38 class TubeTreeSynthesis;
39 class TubePolynomialSynthesis;
69 explicit Tube(
const Interval&
tdomain,
double timestep,
const Interval&
codomain = Interval::ALL_REALS);
84 explicit Tube(
const Interval&
tdomain,
double timestep,
const TFnc& f,
int f_image_id = 0);
95 explicit Tube(
const std::vector<Interval>& v_tdomains,
const std::vector<Interval>& v_codomains);
117 explicit Tube(
const Tube& x,
const TFnc& f,
int f_image_id = 0);
153 explicit Tube(
const std::string& binary_file_name);
415 void sample(
double t,
const Interval& gate);
502 const std::pair<Interval,Interval>
eval(
const Interval& t = Interval::ALL_REALS)
const;
537 const Interval
invert(
const Interval& y,
const Interval& search_tdomain = Interval::ALL_REALS)
const;
547 void invert(
const Interval& y, std::vector<Interval> &v_t,
const Interval& search_tdomain = Interval::ALL_REALS)
const;
560 const Interval
invert(
const Interval& y,
const Tube& v,
const Interval& search_tdomain = Interval::ALL_REALS)
const;
573 void invert(
const Interval& y, std::vector<Interval> &v_t,
const Tube& v,
const Interval& search_tdomain = Interval::ALL_REALS)
const;
765 const Tube&
set(
const Interval& y,
int slice_id);
791 const Tube&
set(
const Interval& y,
const Interval& t);
855 const std::pair<Tube,Tube>
bisect(
double t,
float ratio = 0.49)
const;
1037 void enable_synthesis(SynthesisMode mode = SynthesisMode::BINARY_TREE,
double eps = 1.e-3)
const;
1075 const Interval
integral(
const Interval& t1,
const Interval& t2)
const;
1102 const std::pair<Interval,Interval>
partial_integral(
const Interval& t1,
const Interval& t2)
const;
1116 void serialize(
const std::string& binary_file_name =
"x.tube",
int version_number = SERIALIZATION_VERSION)
const;
1129 void serialize(
const std::string& binary_file_name,
const Trajectory& traj,
int version_number = SERIALIZATION_VERSION)
const;
1161 static const Tube hull(
const std::list<Tube>& l_tubes);
1231 static bool s_enable_syntheses;
that contracts a tube with respect to its derivative tube and a measurement according to the const...
Definition codac_CtcEval.h:27
Abstract class for common properties of Tube, TubeVector, Slice, Trajectory, TrajectoryVector objects...
Definition codac_DynamicalItem.h:26
Slice of a one dimensional tube and made of an envelope and two gates.
Definition codac_Slice.h:34
One dimensional trajectory , defined as a temporal map of values.
Definition codac_Trajectory.h:35
One dimensional tube , defined as an interval of scalar trajectories.
Definition codac_Tube.h:48
Slice * last_slice()
Returns a pointer to the last Slice object of this tube.
const Interval interpol(double t, const Tube &v) const
Returns the optimal evaluation of this tube at , based on the derivative information .
double max_diam() const
Returns the diameter of the interval value that is the more uncertain.
Slice * largest_slice()
Returns a pointer to the Slice object of this tube for which the interval value is the most uncertain...
Tube(const Trajectory &lb, const Trajectory &ub, double timestep)
Creates a scalar tube defined as an interval of two trajectories .
static const Tube hull(const std::list< Tube > &l_tubes)
Computes the hull of several tubes.
const Slice * largest_slice() const
Returns a constant pointer to the Slice object of this tube for which the interval value is the most ...
Slice * wider_slice()
Returns a pointer to the Slice defined over the wider temporal domain.
void delete_synthesis_tree() const
Deletes the synthesis tree of this tube.
const BoolInterval contains(const Trajectory &x) const
Returns true if this tube contains the trajectory .
void sample(double t, Slice *slice_to_be_sampled)
Samples this tube at from a pointer to the corresponding slice.
const Tube & set(const Interval &y, int slice_id)
Sets the interval value of the ith slice of this tube.
const Interval integral(double t) const
Computes the interval integral .
const Tube & operator/=(const Tube &x)
Operates /=.
Tube(const Trajectory &traj, double timestep)
Creates a scalar tube enclosing a trajectory , possibly with some temporal discretization.
const Tube & operator-=(const Interval &x)
Operates -=.
Slice * slice(int slice_id)
Returns a pointer to the ith Slice object of this tube.
const std::string class_name() const
Returns the name of this class.
Definition codac_Tube.h:1016
Tube & truncate_tdomain(const Interval &tdomain)
Truncates the tdomain of .
const Tube & operator-=(const Trajectory &x)
Operates -=.
const Tube & operator&=(const Tube &x)
Operates &=.
bool is_superset(const Tube &x) const
Returns true if this tube is a superset of .
const IntervalVector codomain_box() const
Returns the box .
TubePolynomialSynthesis * m_polynomial_synthesis
pointer to the optional synthesis tree
Definition codac_Tube.h:1222
const Tube & operator=(const Tube &x)
Returns a copy of a Tube.
void invert(const Interval &y, std::vector< Interval > &v_t, const Interval &search_tdomain=Interval::ALL_REALS) const
Computes the set of continuous values of the inversion .
Slice * first_slice()
Returns a pointer to the first Slice object of this tube.
void shift_tdomain(double a)
Shifts the tdomain of .
const Tube & operator*=(const Interval &x)
Operates *=.
const Tube & operator&=(const Interval &x)
Operates &=.
const Tube & operator|=(const Trajectory &x)
Operates |=.
const std::pair< Interval, Interval > partial_integral(const Interval &t) const
Computes the partial interval integral .
double max_gate_diam(double &t) const
Returns the diameter of the gate of this tube that is the more uncertain.
const Slice * steepest_slice() const
Returns a const pointer to the Slice object of this tube for which the difference between the mid val...
int index(const Slice *slice) const
Returns the Slice index related to the Slice pointer.
Slice * m_first_slice
pointer to the first Slice object of this tube
Definition codac_Tube.h:1220
Tube()
Creates a not-defined scalar tube.
const Tube & operator+=(const Trajectory &x)
Operates +=.
const Tube & operator+=(const Tube &x)
Operates +=.
const Slice * slice(double t) const
Returns a constant pointer to the Slice object of this tube that is defined at .
static void enable_syntheses(bool enable=true)
Enables the computation of a synthesis tree for any Tube object.
void sample(double t, const Interval &gate)
Samples this tube at with a specific gate value.
bool gate_exists(double t) const
Tests if a gate exists at time .
bool is_subset(const Tube &x) const
Returns true if this tube is a subset of .
const std::pair< Interval, Interval > eval(const Interval &t=Interval::ALL_REALS) const
Returns the interval evaluations of the bounds of the tube and over .
const Tube & set(const Interval &y)
Sets a constant interval value for this tube: .
Slice * slice(double t)
Returns a pointer to the Slice object of this tube that is defined at .
const Tube & set_empty()
Sets this tube to the empty set.
const Slice * wider_slice() const
Returns a constant pointer to the Slice defined over the wider temporal domain.
void create_synthesis_tree() const
Creates the synthesis tree associated to the values of this tube.
const Interval slice_tdomain(int slice_id) const
Returns the temporal definition domain of the ith Slice of this tube.
void serialize(const std::string &binary_file_name="x.tube", int version_number=SERIALIZATION_VERSION) const
Serializes this tube.
static bool same_slicing(const Tube &x1, const Tube &x2)
Tests whether the two Tube objects are sharing the same slicing.
const std::pair< Tube, Tube > bisect(double t, float ratio=0.49) const
Bisects this tube.
const Tube & inflate(double rad)
Inflates this tube by adding to all its codomain components.
const Trajectory diam(bool gates_thicknesses=false) const
Returns the diameters of the tube as a trajectory.
void create_polynomial_synthesis(double eps) const
Creates the synthesis tree associated to the values of this tube.
const Polygon polygon_envelope() const
Returns the polygon envelope of this tube.
Slice * steepest_slice()
Returns a pointer to the Slice object of this tube for which the difference between the mid values of...
const Tube & operator|=(const Tube &x)
Operates |=.
const Tube & operator*=(const Tube &x)
Operates *=.
bool operator!=(const Tube &x) const
Returns true if this tube is different from .
double volume() const
Returns the volume of this tube.
Tube(const Interval &tdomain, double timestep, const Interval &codomain=Interval::ALL_REALS)
Creates a scalar tube with some temporal discretization.
const Interval tdomain() const
Returns the temporal definition domain of this tube.
const Tube & operator*=(const Trajectory &x)
Operates *=.
const Trajectory diam(const Tube &v) const
Returns the diameters of the tube as a trajectory.
bool overlaps(const Tube &x, float ratio=1.) const
Returns true if this tube overlaps the tube .
bool operator==(const Tube &x) const
Returns true if this tube is equal to .
const Trajectory lb() const
Returns a possible lower bound of the tube.
const Interval integral(const Interval &t) const
Computes the interval integral .
friend std::ostream & operator<<(std::ostream &str, const Tube &x)
Displays a synthesis of this tube.
Tube(const std::string &binary_file_name, Trajectory *&traj)
Restore a scalar tube from serialization, together with a Trajectory object.
void sample(const Tube &x)
Samples this tube so that it will share the same sampling of .
const Interval interpol(const Interval &t, const Tube &v) const
Returns the optimal interval evaluation of this tube over , based on the derivative information .
const Tube & operator|=(const Interval &x)
Operates |=.
const Tube & set(const Interval &y, const Interval &t)
Sets the interval value of this tube over : .
SynthesisMode m_synthesis_mode
enables of the use of a synthesis tree
Definition codac_Tube.h:1223
TubeTreeSynthesis * m_synthesis_tree
pointer to the optional synthesis tree
Definition codac_Tube.h:1221
void deserialize(const std::string &binary_file_name, Trajectory *&traj)
Restores a scalar tube from serialization, together with a Trajectory object.
const Interval invert(const Interval &y, const Interval &search_tdomain=Interval::ALL_REALS) const
Returns the interval inversion .
const Interval operator()(double t) const
Returns the evaluation of this tube at .
const std::pair< Interval, Interval > partial_integral(const Interval &t1, const Interval &t2) const
Computes the partial interval integral .
const Slice * last_slice() const
Returns a constant pointer to the last Slice object of this tube.
void enable_synthesis(SynthesisMode mode=SynthesisMode::BINARY_TREE, double eps=1.e-3) const
Enables the computation of a synthesis tree.
friend void deserialize_Tube(std::ifstream &bin_file, Tube *&tube)
Creates a Tube object from a binary file.
void sample(double t)
Samples this tube at .
const Tube primitive(const Interval &c=Interval(0.)) const
Returns the primitive Tube of this tube.
bool is_empty() const
Returns true if this tube is empty.
const Trajectory ub() const
Returns a possible upper bound of the tube.
const Tube & operator/=(const Interval &x)
Operates /=.
const Interval invert(const Interval &y, const Tube &v, const Interval &search_tdomain=Interval::ALL_REALS) const
Returns the optimal interval inversion .
void invert(const Interval &y, std::vector< Interval > &v_t, const Tube &v, const Interval &search_tdomain=Interval::ALL_REALS) const
Computes the set of continuous values of the optimal inversion .
void serialize(const std::string &binary_file_name, const Trajectory &traj, int version_number=SERIALIZATION_VERSION) const
Serializes this tube together with a Trajectory object.
int size() const
Returns the dimension of the scalar tube (always 1)
const Interval codomain() const
Returns the interval of feasible values.
Tube(const Interval &tdomain, double timestep, const TFnc &f, int f_image_id=0)
Creates a scalar tube from a TFnc object and with some temporal discretization.
Tube(const Interval &tdomain, const Interval &codomain=Interval::ALL_REALS)
Creates a scalar tube made of one slice.
int nb_slices() const
Returns the number of slices of this tube.
bool is_strict_superset(const Tube &x) const
Returns true if this tube is a superset of , and not itself.
const Slice * first_slice() const
Returns a constant pointer to the first Slice object of this tube.
const Tube & operator-=(const Tube &x)
Operates -=.
const Interval integral(const Interval &t1, const Interval &t2) const
Computes the interval integral .
const Tube & set(const Interval &y, double t)
Sets the interval value of this tube at : .
void delete_polynomial_synthesis() const
Deletes the synthesis tree of this tube.
const Tube & operator&=(const Trajectory &x)
Operates &=.
void merge_similar_slices(double distance_threshold)
Merges all adjacent slices whose Hausdorff distance is less than the given threshold.
const Interval operator()(const Interval &t) const
Returns the interval evaluation of this tube over .
Tube(const std::vector< Interval > &v_tdomains, const std::vector< Interval > &v_codomains)
Creates a tube from a list of boxes .
void remove_gate(double t)
Removes the gate at and merges the two related slices.
bool is_strict_subset(const Tube &x) const
Returns true if this tube is a subset of , and not itself.
const Slice * slice(int slice_id) const
Returns a constant pointer to the ith Slice object of this tube.
bool is_interior_subset(const Tube &x) const
Returns true if this tube is a subset of the interior of .
Tube(const std::string &binary_file_name)
Restore a scalar tube from serialization.
bool is_strict_interior_subset(const Tube &x) const
Returns true if this tube is a subset of the interior of , and not itself.
const Tube & operator+=(const Interval &x)
Operates +=.
Tube(const Tube &x)
Creates a copy of a scalar tube , with the same time discretization.
const Interval operator()(int slice_id) const
Returns the value of the ith slice.
Interval m_tdomain
redundant information for fast evaluations
Definition codac_Tube.h:1224
int time_to_index(double t) const
Returns the Slice index related to the temporal key .
Tube(const Tube &x, const TFnc &f, int f_image_id=0)
Creates a copy of a scalar tube , with the same time discretization but a specific codomain defined b...
const Tube & operator/=(const Trajectory &x)
Operates /=.
const Tube & inflate(const Trajectory &rad)
Inflates this tube by adding non-constant uncertainties defined in a trajectory.
friend void deserialize_TubeVector(std::ifstream &bin_file, TubeVector *&tube)
Creates a TubeVector object from a binary file.
n-dimensional tube , defined as an interval of n-dimensional trajectories
Definition codac_TubeVector.h:39
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition codac_capd_helpers.h:9