Graph of contractors and domains that model a problem in the constraint programming framework. Heterogeneous domains can be handled in the same network, which allows to deal with a wide variety of problems such as non-linear equations, differential systems, delays or inter-temporal equations.
More...
|
|
| ContractorNetwork () |
| Creates an empty Contractor Network (CN)
|
|
| ~ContractorNetwork () |
| ContractorNetwork destructor.
|
|
int | nb_ctc () const |
| Returns the number of contractors the graph is made of.
|
|
int | nb_dom () const |
| Returns the number of domains the graph is made of.
|
|
bool | emptiness () const |
| Returns true if one of the domains is empty, false otherwise.
|
|
|
Interval & | create_interm_var (const Interval &i) |
| Creates an Interval intermediate variable with a reference kept in the ContractorNetwork. The variable will be kept alive outside its definition block. This allows for instance to add constraints involving intermediate variables inside iteration loops. The variable exists in the CN but cannot be reached outside its definition block. Its deallocation is handled by the CN.
|
|
IntervalVector & | create_interm_var (const IntervalVector &iv) |
| Creates an IntervalVector intermediate variable with a reference kept in the ContractorNetwork. The variable will be kept alive outside its definition block. This allows for instance to add constraints involving intermediate variables inside iteration loops. The variable exists in the CN but cannot be reached outside its definition block. Its deallocation is handled by the CN.
|
|
Tube & | create_interm_var (const Tube &t) |
| Creates a Tube intermediate variable with a reference kept in the ContractorNetwork. The variable will be kept alive outside its definition block. This allows for instance to add constraints involving intermediate variables inside iteration loops. The variable exists in the CN but cannot be reached outside its definition block. Its deallocation is handled by the CN.
|
|
TubeVector & | create_interm_var (const TubeVector &tv) |
| Creates a TubeVector intermediate variable with a reference kept in the ContractorNetwork. The variable will be kept alive outside its definition block. This allows for instance to add constraints involving intermediate variables inside iteration loops. The variable exists in the CN but cannot be reached outside its definition block. Its deallocation is handled by the CN.
|
|
IntervalVector & | subvector (Vector &v, int start_index, int end_index) |
| Creates a subvector of a Vector domain.
|
|
IntervalVector & | subvector (IntervalVector &iv, int start_index, int end_index) |
| Creates a subvector of an IntervalVector domain.
|
|
void | add (Ctc &static_ctc, const std::vector< Domain > &v_domains) |
| Adds to the graph a static contractor (inherited from Ctc class) with related Domains.
|
|
void | add (DynCtc &dyn_ctc, const std::vector< Domain > &v_domains) |
| Adds to the graph a dynamic contractor (inherited from DynCtc class) with related Domains.
|
|
void | add_data (Tube &x, double t, const Interval &y) |
| Adds continuous data \([y]\) to a tube \([x](\cdot)\) at \(t\) (used for realtime applications).
|
|
void | add_data (TubeVector &x, double t, const IntervalVector &y) |
| Adds continuous data \([\mathbf{y}]\) to a tube \([\mathbf{x}](\cdot)\) at \(t\) (used for realtime applications).
|
|
|
double | contract (bool verbose=false) |
| Launch the contraction process.
|
|
double | contract (const std::unordered_map< Domain, Domain > &var_dom, bool verbose=false) |
| Launch the contraction process with specified domains in place of Variables objects.
|
|
double | contract_during (double dt, bool verbose=false) |
| Launch the contraction process and stops after \(dt\) seconds.
|
|
void | set_fixedpoint_ratio (float r) |
| Sets the fixed point ratio defining the end of the propagation process.
|
|
void | trigger_all_contractors () |
| Triggers on all contractors involved in the graph.
|
|
void | reset_interm_vars () |
| Resets the initial value of the domains declared as intermediate variables.
|
|
int | nb_ctc_in_stack () const |
| Returns the number of contractors that are waiting for process.
|
|
|
std::map< DomainHashcode, Domain * > | m_map_domains |
| pointers to the abstract Domain objects the graph is made of
|
|
std::map< ContractorHashcode, Contractor * > | m_map_ctc |
| pointers to the abstract Contractor objects the graph is made of
|
|
std::deque< Contractor * > | m_deque |
| queue of active contractors
|
|
float | m_fixedpoint_ratio = 0.0001 |
| fixed point ratio for propagation limit
|
|
double | m_contraction_duration_max = std::numeric_limits<double>::infinity() |
| computation time limit
|
|
CtcDeriv * | m_ctc_deriv = nullptr |
| optional pointer to a CtcDeriv object that can be automatically added in the graph
|
|
|
void | set_name (Domain dom, const std::string &name) |
| Sets a string name for a given Domain.
|
|
void | set_name (Ctc &ctc, const std::string &name) |
| Sets a string name for a given static contractor.
|
|
void | set_name (DynCtc &ctc, const std::string &name) |
| Sets a string name for a given dynamic contractor.
|
|
int | print_dot_graph (const std::string &cn_name="cn", const std::string &layer_model="fdp") const |
| Generates a dot graph for visualization in PDF file format, by using dot2tex.
|
|
Graph of contractors and domains that model a problem in the constraint programming framework. Heterogeneous domains can be handled in the same network, which allows to deal with a wide variety of problems such as non-linear equations, differential systems, delays or inter-temporal equations.
void codac::ContractorNetwork::add_data |
( |
Tube & | x, |
|
|
double | t, |
|
|
const Interval & | y ) |
Adds continuous data \([y]\) to a tube \([x](\cdot)\) at \(t\) (used for realtime applications).
In this case, the tube represents an enclosure of a trajectory of measurements that are given in realtime.
t must increase at each call of this method. Slices of the tube will be contracted only if provided data completely cover their tdomain. Contracted slices will trigger related contractors, allowing constraint propagation in the graph.
- Parameters
-
x | the tube \([x](\cdot)\) to be contracted with continuous data |
t | time of measurement \(t\) |
y | bounded measurement, equivalent to the set \([x](t)=[y]\) |
void codac::ContractorNetwork::add_data |
( |
TubeVector & | x, |
|
|
double | t, |
|
|
const IntervalVector & | y ) |
Adds continuous data \([\mathbf{y}]\) to a tube \([\mathbf{x}](\cdot)\) at \(t\) (used for realtime applications).
In this case, the tube vector represents an enclosure of a trajectory of vector measurements that are given in realtime.
t must increase at each call of this method. Slices of the tube will be contracted only if provided data completely cover their tdomain. Contracted slices will trigger related contractors, allowing constraint propagation in the graph.
- Parameters
-
x | the tube \([\mathbf{x}](\cdot)\) to be contracted with continuous data |
t | time of measurement \(t\) |
y | bounded measurement, equivalent to the set \([\mathbf{x}](t)=[\mathbf{y}]\) |
void codac::ContractorNetwork::set_fixedpoint_ratio |
( |
float | r | ) |
|
Sets the fixed point ratio defining the end of the propagation process.
The ratio \(r\) is a percentage of contraction impact computed on the volume of the domains. For a given domain submitted to a contractor, if the contraction impact after contraction is more than the defined ratio, then the propagation is performed on other contractors related to this domain. Otherwise, the propagation process stops.
\(r=0\) means that the propagation is performed up to a fixed point defined by the floating-point precision value. \(r=0.1\) means that the propagation will be done only if the domain has been contracted by 10%.
- Parameters
-
r | ratio of contraction, \(r\in[0,1]\) |