00001 #ifndef RIDE_CONSTRAINTS_HPP
00002 #define RIDE_CONSTRAINTS_HPP
00003
00004 #include <map>
00005 #include <vector>
00006 #include <list>
00007 #include "ride/interval.hpp"
00008
00009
00010
00011
00012 namespace jafar {
00013
00014 namespace ride {
00015
00020 enum ConstraintType {
00021 NONE,DMIN,DMAX,CORRIDOR,FORMATION,DEFENCE,SPLIT
00022 };
00023
00028 class Constraint {
00029 private :
00030 int id;
00031 int size;
00032 std::vector<int> idWP;
00033 ConstraintType type;
00034 protected :
00035 void setType(ConstraintType type_);
00036 public :
00037 Constraint(int id_, int idWP_);
00038 Constraint(int id_, std::vector<int> idWP_);
00039
00040 virtual ~Constraint();
00041 int getId() const;
00042 std::vector<int> getDomain() const;
00043 int getDomainSize() const;
00044 bool isInDomain(int wpId) const;
00045 ConstraintType getType() const;
00046 virtual void apply(Interval & inter);
00047 };
00048
00053 class ConstraintDmin : public Constraint {
00054 private :
00055 double Dmin;
00056 public :
00057 ConstraintDmin(int id_, std::vector<int> idWP_, double Dmin_);
00058
00059 ~ConstraintDmin();
00060 double getDmin() const;
00061 void apply(Interval & inter);
00062 };
00063
00068 class ConstraintDmax : public Constraint {
00069 private :
00070 double Dmax;
00071 public :
00072 ConstraintDmax(int id_, std::vector<int> idWP_, double Dmax_);
00073
00074 ~ConstraintDmax();
00075 double getDmax() const;
00076 void apply(Interval & inter);
00077 };
00078
00083 class ConstraintCorridor : public Constraint {
00084 private :
00085 double Corridor;
00086 public :
00087 ConstraintCorridor(int id_, std::vector<int> idWP_, double Corridor_);
00088
00089 ~ConstraintCorridor();
00090 double getCorridor() const;
00091 void apply(Interval & inter);
00092 };
00093
00098 class ConstraintFormation : public Constraint {
00099 private :
00100 std::vector<tagSlot> formation;
00101 public :
00102 ConstraintFormation(int id_, std::vector<int> idWP_, std::vector<tagSlot> form);
00103 ConstraintFormation(int id_, int idWP_, std::vector<tagSlot> form);
00104 ~ConstraintFormation();
00105 std::vector<tagSlot> getFormation() const;
00106 void apply(Interval & inter);
00107 };
00108
00113 class ConstraintDefence : public Constraint {
00114 private :
00115 int threatId;
00116 bool active;
00117 public :
00118 ConstraintDefence(int id_, std::vector<int> idWP_, int thId, bool active_);
00119
00120 ~ConstraintDefence();
00121 int getThreatId() const;
00122 bool isActive() const;
00123 void apply(Interval & inter);
00124 };
00125
00130 class ConstraintSplit : public Constraint {
00131 private :
00132 SplitParam splitParam;
00133 public :
00134 ConstraintSplit(int id_, int idWP_, SplitParam splitParam_);
00135 ~ConstraintSplit();
00136 SplitParam getSplitParam() const;
00137 void apply(Interval & inter);
00138 };
00139
00140 }
00141
00142 }
00143
00144 #endif
00145