12#ifndef __CODAC_CONTRACTORNETWORK_H__
13#define __CODAC_CONTRACTORNETWORK_H__
16#include <initializer_list>
17#include <unordered_map>
38 class ContractorHashcode;
102 Interval& create_dom(
const Interval& i);
116 IntervalVector& create_dom(
const IntervalVector& iv);
157 IntervalVector&
subvector(Vector& v,
int start_index,
int end_index);
167 IntervalVector&
subvector(IntervalVector& iv,
int start_index,
int end_index);
188 void add(Ctc& static_ctc,
const std::vector<Domain>& v_domains);
200 void add(
DynCtc& dyn_ctc,
const std::vector<Domain>& v_domains);
258 double contract(
const std::unordered_map<Domain,Domain>& var_dom,
bool verbose =
false);
260 double contract_ordered_mode(
bool verbose =
false);
314 int iteration_nb()
const;
327 void set_name(Domain dom,
const std::string& name);
358 int print_dot_graph(
const std::string& cn_name =
"cn",
const std::string& layer_model =
"fdp")
const;
405 void reset_value(Domain *dom);
415 void replace_var_by_dom(Domain var, Domain dom);
423 int m_iteration_nb = 0;
428 std::list<std::pair<Domain*,Domain*> > m_domains_related_to_ctcderiv;
431 friend class Contractor;
Graph of contractors and domains that model a problem in the constraint programming framework....
Definition codac_ContractorNetwork.h:49
void set_fixedpoint_ratio(float r)
Sets the fixed point ratio defining the end of the propagation process.
Domain * add_dom(const Domain &ad)
Adds an abstract Domain to the graph.
int nb_dom() const
Returns the number of domains the graph is made of.
float m_fixedpoint_ratio
fixed point ratio for propagation limit
Definition codac_ContractorNetwork.h:424
friend std::ostream & operator<<(std::ostream &str, const ContractorNetwork &cn)
Displays a synthesis of this ContractorNetwork.
IntervalVector & create_interm_var(const IntervalVector &iv)
Creates an IntervalVector intermediate variable with a reference kept in the ContractorNetwork....
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.
std::map< DomainHashcode, Domain * > m_map_domains
pointers to the abstract Domain objects the graph is made of
Definition codac_ContractorNetwork.h:419
TubeVector & create_interm_var(const TubeVector &tv)
Creates a TubeVector intermediate variable with a reference kept in the ContractorNetwork....
int nb_ctc() const
Returns the number of contractors the graph is made of.
bool emptiness() const
Returns true if one of the domains is empty, false otherwise.
ContractorNetwork()
Creates an empty Contractor Network (CN)
double contract_during(double dt, bool verbose=false)
Launch the contraction process and stops after seconds.
std::map< ContractorHashcode, Contractor * > m_map_ctc
pointers to the abstract Contractor objects the graph is made of
Definition codac_ContractorNetwork.h:420
IntervalVector & subvector(IntervalVector &iv, int start_index, int end_index)
Creates a subvector of an IntervalVector domain.
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.
int nb_ctc_in_stack() const
Returns the number of contractors that are waiting for process.
void set_name(Domain dom, const std::string &name)
Sets a string name for a given Domain.
void trigger_ctc_related_to_dom(Domain *dom, Contractor *ctc_to_avoid=nullptr)
Triggers on the contractors related to the given Domain.
~ContractorNetwork()
ContractorNetwork destructor.
double m_contraction_duration_max
computation time limit
Definition codac_ContractorNetwork.h:425
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 reset_interm_vars()
Resets the initial value of the domains declared as intermediate variables.
CtcDeriv * m_ctc_deriv
optional pointer to a CtcDeriv object that can be automatically added in the graph
Definition codac_ContractorNetwork.h:427
void add_data(Tube &x, double t, const Interval &y)
Adds continuous data to a tube at (used for realtime applications).
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.
Tube & create_interm_var(const Tube &t)
Creates a Tube intermediate variable with a reference kept in the ContractorNetwork....
void add_data(TubeVector &x, double t, const IntervalVector &y)
Adds continuous data to a tube at (used for realtime applications).
double contract(bool verbose=false)
Launch the contraction process.
Contractor * add_ctc(const Contractor &ac)
Adds an abstract Contractor to the graph.
std::deque< Contractor * > m_deque
queue of active contractors
Definition codac_ContractorNetwork.h:421
void trigger_all_contractors()
Triggers on all contractors involved in the graph.
IntervalVector & subvector(Vector &v, int start_index, int end_index)
Creates a subvector of a Vector domain.
Interval & create_interm_var(const Interval &i)
Creates an Interval intermediate variable with a reference kept in the ContractorNetwork....
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.
void add_ctc_to_queue(Contractor *ac, std::deque< Contractor * > &ctc_deque)
Adds a Contractor object in the queue of active contractors.
that contracts a tube with respect to its derivative tube according to the constraint
Definition codac_CtcDeriv.h:31
Contractor interface.
Definition codac_DynCtc.h:61
One dimensional tube , defined as an interval of scalar trajectories.
Definition codac_Tube.h:48
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