codac  1.5.7
codac_Slice.h
Go to the documentation of this file.
1 
12 #ifndef __CODAC_SLICE_H__
13 #define __CODAC_SLICE_H__
14 
15 #include "codac_Tube.h"
16 #include "codac_Trajectory.h"
17 #include "codac_DynamicalItem.h"
18 #include "codac_ConvexPolygon.h"
19 #include "codac_TubeTreeSynthesis.h"
20 #include "codac_BoolInterval.h"
21 
22 namespace codac
23 {
24  #define EPSILON_CONTAINS ibex::next_float(0.) * 1000.
25 
26  class Tube;
27  class Trajectory;
28 
33  class Slice : public DynamicalItem
34  {
35  public:
36 
37  // Base:
38 
41 
48  explicit Slice(const Interval& tdomain, const Interval& codomain = Interval::ALL_REALS);
49 
55  Slice(const Slice& x);
56 
60  ~Slice();
61 
67  int size() const;
68 
75  const Slice& operator=(const Slice& x);
76 
82  const Interval tdomain() const;
83 
87 
94 
100  const Slice* prev_slice() const;
101 
108 
114  const Slice* next_slice() const;
115 
121  const Interval input_gate() const;
122 
128  const Interval output_gate() const;
129 
139  const ConvexPolygon polygon(const Slice& v) const;
140 
144 
150  const Interval codomain() const;
151 
157  const IntervalVector box() const;
158 
170  static double diam(const Interval& interval);
171 
180  double diam() const;
181 
190  double volume() const;
191 
200  const Interval operator()(double t) const;
201 
208  const Interval operator()(const Interval& t) const;
209 
218  const std::pair<Interval,Interval> eval(const Interval& t = Interval::ALL_REALS) const;
219 
230  const Interval interpol(double t, const Slice& v) const;
231 
242  const Interval interpol(const Interval& t, const Slice& v) const;
243 
251  const Interval invert(const Interval& y, const Interval& search_tdomain = Interval::ALL_REALS) const;
252 
263  const Interval invert(const Interval& y, const Slice& v, const Interval& search_tdomain = Interval::ALL_REALS) const;
264 
268 
278  bool operator==(const Slice& x) const;
279 
289  bool operator!=(const Slice& x) const;
290 
299  bool is_subset(const Slice& x) const;
300 
310  bool is_strict_subset(const Slice& x) const;
311 
320  bool is_interior_subset(const Slice& x) const;
321 
331  bool is_strict_interior_subset(const Slice& x) const;
332 
341  bool is_superset(const Slice& x) const;
342 
352  bool is_strict_superset(const Slice& x) const;
353 
362  bool is_empty() const;
363 
377  const BoolInterval contains(const Trajectory& x) const;
378 
382 
390  void set(const Interval& y);
391 
397  void set_empty();
398 
408  void set_envelope(const Interval& envelope, bool slice_consistency = true);
409 
421  void set_input_gate(const Interval& input_gate, bool slice_consistency = true);
422 
434  void set_output_gate(const Interval& output_gate, bool slice_consistency = true);
435 
444  const Slice& inflate(double rad);
445 
449 
456  Slice& operator+=(double x);
457 
465 
472  Slice& operator+=(const Slice& x);
473 
480  Slice& operator-=(double x);
481 
489 
496  Slice& operator-=(const Slice& x);
497 
504  Slice& operator*=(double x);
505 
513 
520  Slice& operator*=(const Slice& x);
521 
528  Slice& operator/=(double x);
529 
537 
544  Slice& operator/=(const Slice& x);
545 
552  Slice& operator|=(double x);
553 
561 
568  Slice& operator|=(const Slice& x);
569 
576  Slice& operator&=(double x);
577 
585 
592  Slice& operator&=(const Slice& x);
593 
597 
605  const std::string class_name() const { return "Slice"; };
606 
614  friend std::ostream& operator<<(std::ostream& str, const Slice& x);
615 
617 
618  protected:
619 
627  void set_tdomain(const Interval& tdomain);
628 
634  void shift_tdomain(double a);
635 
645  static void chain_slices(Slice *first_slice, Slice *second_slice);
646 
656  static void merge_slices(Slice *first_slice, Slice *&second_slice);
657 
665  const IntervalVector codomain_box() const;
666 
667  // Class variables:
668 
669  Interval m_tdomain;
670  Interval m_codomain = Interval::ALL_REALS;
671  Interval *m_input_gate = nullptr, *m_output_gate = nullptr;
672  Slice *m_prev_slice = nullptr, *m_next_slice = nullptr;
673  mutable TubeTreeSynthesis *m_synthesis_reference = nullptr;
674 
675  friend class Tube;
676  friend class TubeTreeSynthesis;
677  friend class CtcEval;
678  friend void deserialize_Tube(std::ifstream& bin_file, Tube *&tube);
679  };
680 }
681 
682 #endif
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
Slice & operator|=(const Slice &x)
Operates |=.
bool operator!=(const Slice &x) const
Returns true if this slice is different from .
Slice & operator-=(const Slice &x)
Operates -=.
static void chain_slices(Slice *first_slice, Slice *second_slice)
Chains the two slices so that they share pointers and a common gate.
Slice & operator+=(const Slice &x)
Operates +=.
bool is_superset(const Slice &x) const
Returns true if this slice is a superset of .
TubeTreeSynthesis * m_synthesis_reference
pointer to a leaf of the optional synthesis tree of the related tube
Definition: codac_Slice.h:673
double volume() const
Returns the volume of this slice.
Slice * prev_slice()
Points to the previous slice .
double diam() const
Returns the diameter of this slice.
const std::string class_name() const
Returns the name of this class.
Definition: codac_Slice.h:605
const IntervalVector box() const
Computes the two-dimensional box .
const Interval operator()(const Interval &t) const
Returns the interval evaluation of this slice over .
const Interval interpol(const Interval &t, const Slice &v) const
Returns the optimal evaluation of this slice over , based on the derivative information .
const Interval invert(const Interval &y, const Slice &v, const Interval &search_tdomain=Interval::ALL_REALS) const
Returns the optimal interval inversion .
const Slice * prev_slice() const
Points to the previous slice .
bool is_interior_subset(const Slice &x) const
Returns true if this slice is a subset of the interior of .
const Slice * next_slice() const
Points to the next slice .
Slice & operator&=(const Trajectory &x)
Operates &=.
Slice & operator*=(double x)
Operates *=.
Interval m_codomain
envelope of the slice
Definition: codac_Slice.h:670
const IntervalVector codomain_box() const
Returns the box .
const Slice & operator=(const Slice &x)
Returns a copy of a Slice.
Slice & operator/=(const Slice &x)
Operates /=.
static double diam(const Interval &interval)
Returns the diameter of an interval (IBEX overload)
void set_output_gate(const Interval &output_gate, bool slice_consistency=true)
Sets the interval value of the output gate of this slice.
Slice & operator&=(double x)
Operates &=.
Slice(const Interval &tdomain, const Interval &codomain=Interval::ALL_REALS)
Creates a slice .
const ConvexPolygon polygon(const Slice &v) const
Computes a convex polygon that optimally encloses the values of the slice according to the knowledge ...
Interval * m_output_gate
input and output gates
Definition: codac_Slice.h:671
static void merge_slices(Slice *first_slice, Slice *&second_slice)
Merges the two slices to keep only one.
Slice & operator+=(const Trajectory &x)
Operates +=.
const Interval output_gate() const
Returns the value of the output gate of this slice.
const Interval interpol(double t, const Slice &v) const
Returns the optimal evaluation of this slice at , based on the derivative information .
Slice & operator/=(const Trajectory &x)
Operates /=.
Slice & operator-=(double x)
Operates -=.
Slice & operator*=(const Trajectory &x)
Operates *=.
void set_tdomain(const Interval &tdomain)
Specifies the temporal domain of this slice.
const Interval tdomain() const
Returns the temporal definition domain of this slice.
Slice & operator-=(const Trajectory &x)
Operates -=.
Slice & operator|=(double x)
Operates |=.
bool is_subset(const Slice &x) const
Returns true if this slice is a subset of .
const Slice & inflate(double rad)
Inflates this slice by adding to all its codomain components.
const Interval codomain() const
Returns the envelope of the slice.
void set_empty()
Sets this slice to the empty set.
void shift_tdomain(double a)
Shifts the tdomain of .
friend void deserialize_Tube(std::ifstream &bin_file, Tube *&tube)
Creates a Tube object from a binary file.
Slice * m_next_slice
pointers to previous and next slices of the related tube
Definition: codac_Slice.h:672
void set(const Interval &y)
Sets a constant interval value for this slice: .
void set_input_gate(const Interval &input_gate, bool slice_consistency=true)
Sets the interval value of the input gate of this slice.
const Interval operator()(double t) const
Returns the evaluation of this slice at .
bool operator==(const Slice &x) const
Returns true if this slice is equal to .
Slice & operator&=(const Slice &x)
Operates &=.
const Interval input_gate() const
Returns the value of the input gate of this slice.
bool is_strict_superset(const Slice &x) const
Returns true if this slice is a superset of , and not itself.
Slice & operator*=(const Slice &x)
Operates *=.
bool is_strict_subset(const Slice &x) const
Returns true if this slice is a subset of , and not itself.
bool is_empty() const
Returns true if this slice is empty.
Slice(const Slice &x)
Creates a copy of the slice .
Interval m_tdomain
temporal domain of the slice
Definition: codac_Slice.h:669
Slice & operator|=(const Trajectory &x)
Operates |=.
void set_envelope(const Interval &envelope, bool slice_consistency=true)
Sets the interval value of the envelope of this slice.
const Interval invert(const Interval &y, const Interval &search_tdomain=Interval::ALL_REALS) const
Returns the interval inversion .
Slice * next_slice()
Points to the next slice .
~Slice()
Slice destructor.
friend std::ostream & operator<<(std::ostream &str, const Slice &x)
Displays a synthesis of this slice.
int size() const
Returns the dimension of the slice (always 1)
const BoolInterval contains(const Trajectory &x) const
Returns true if this slice contains the trajectory .
bool is_strict_interior_subset(const Slice &x) const
Returns true if this slice is a subset of the interior of , and not itself.
Slice & operator/=(double x)
Operates /=.
const std::pair< Interval, Interval > eval(const Interval &t=Interval::ALL_REALS) const
Returns the interval evaluations of the bounds of the slice over .
Slice & operator+=(double x)
Operates +=.
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
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition: codac_capd_helpers.h:9