00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __GECODE_INT_UNARY_HH__
00041 #define __GECODE_INT_UNARY_HH__
00042
00043 #include <gecode/int/task.hh>
00044
00055 namespace Gecode { namespace Int { namespace Unary {
00056
00058 class ManFixPTask {
00059 protected:
00061 Int::IntView _s;
00063 int _p;
00064 public:
00066
00067
00068 ManFixPTask(void);
00070 ManFixPTask(IntVar s, int p);
00072 void init(IntVar s, int p);
00074 void init(const ManFixPTask& t);
00076
00078
00079
00080 int est(void) const;
00082 int ect(void) const;
00084 int lst(void) const;
00086 int lct(void) const;
00088 int pmin(void) const;
00090 int pmax(void) const;
00092 IntVar st(void) const;
00094 bool mandatory(void) const;
00096 bool excluded(void) const;
00098 bool optional(void) const;
00100
00102
00103
00104 bool assigned(void) const;
00106
00108
00109
00110 ModEvent est(Space& home, int n);
00112 ModEvent ect(Space& home, int n);
00114 ModEvent lst(Space& home, int n);
00116 ModEvent lct(Space& home, int n);
00118 ModEvent norun(Space& home, int e, int l);
00120 ModEvent mandatory(Space& home);
00122 ModEvent excluded(Space& home);
00124
00126
00127
00128 void update(Space& home, bool share, ManFixPTask& t);
00130
00132
00133
00134 void subscribe(Space& home, Propagator& p, PropCond pc);
00136 void cancel(Space& home, Propagator& p, PropCond pc);
00138 void reschedule(Space& home, Propagator& p, PropCond pc);
00140
00141 };
00142
00147 template<class Char, class Traits>
00148 std::basic_ostream<Char,Traits>&
00149 operator <<(std::basic_ostream<Char,Traits>& os, const ManFixPTask& t);
00150
00152 class ManFixPSETask : public ManFixPTask {
00153 protected:
00155 TaskType _t;
00156 public:
00158
00159
00160 ManFixPSETask(void);
00167 ManFixPSETask(TaskType t, IntVar s, int p);
00174 void init(TaskType t, IntVar s, int p);
00176 void init(const ManFixPSETask& t);
00178
00180
00181
00182 int est(void) const;
00184 int ect(void) const;
00186 int lst(void) const;
00188 int lct(void) const;
00190 int pmin(void) const;
00192 int pmax(void) const;
00194
00196
00197
00198 ModEvent est(Space& home, int n);
00200 ModEvent ect(Space& home, int n);
00202 ModEvent lst(Space& home, int n);
00204 ModEvent lct(Space& home, int n);
00206 ModEvent norun(Space& home, int e, int l);
00208
00210
00211
00212 void update(Space& home, bool share, ManFixPSETask& t);
00214
00215 };
00216
00221 template<class Char, class Traits>
00222 std::basic_ostream<Char,Traits>&
00223 operator <<(std::basic_ostream<Char,Traits>& os, const ManFixPSETask& t);
00224
00226 class OptFixPTask : public ManToOptTask<ManFixPTask> {
00227 protected:
00228 using ManToOptTask<ManFixPTask>::_m;
00229 public:
00231
00232
00233 OptFixPTask(void);
00235 OptFixPTask(IntVar s, int p, BoolVar m);
00237 void init(IntVar s, int p, BoolVar m);
00239 };
00240
00245 template<class Char, class Traits>
00246 std::basic_ostream<Char,Traits>&
00247 operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPTask& t);
00248
00250 class OptFixPSETask : public ManToOptTask<ManFixPSETask> {
00251 protected:
00252 using ManToOptTask<ManFixPSETask>::_m;
00253 public:
00255
00256
00257 OptFixPSETask(void);
00259 OptFixPSETask(TaskType t, IntVar s, int p, BoolVar m);
00261 void init(TaskType t, IntVar s, int p, BoolVar m);
00263 };
00264
00269 template<class Char, class Traits>
00270 std::basic_ostream<Char,Traits>&
00271 operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPSETask& t);
00272
00274 class ManFlexTask {
00275 protected:
00277 Int::IntView _s;
00279 Int::IntView _p;
00281 Int::IntView _e;
00282 public:
00284
00285
00286 ManFlexTask(void);
00288 ManFlexTask(IntVar s, IntVar p, IntVar e);
00290 void init(IntVar s, IntVar p, IntVar e);
00292 void init(const ManFlexTask& t);
00294
00296
00297
00298 int est(void) const;
00300 int ect(void) const;
00302 int lst(void) const;
00304 int lct(void) const;
00306 int pmin(void) const;
00308 int pmax(void) const;
00310 IntVar st(void) const;
00312 IntVar p(void) const;
00314 IntVar e(void) const;
00316 bool mandatory(void) const;
00318 bool excluded(void) const;
00320 bool optional(void) const;
00322
00324
00325
00326 bool assigned(void) const;
00328
00330
00331
00332 ModEvent est(Space& home, int n);
00334 ModEvent ect(Space& home, int n);
00336 ModEvent lst(Space& home, int n);
00338 ModEvent lct(Space& home, int n);
00340 ModEvent norun(Space& home, int e, int l);
00342 ModEvent mandatory(Space& home);
00344 ModEvent excluded(Space& home);
00346
00348
00349
00350 void update(Space& home, bool share, ManFlexTask& t);
00352
00354
00355
00356 void subscribe(Space& home, Propagator& p, PropCond pc);
00358 void cancel(Space& home, Propagator& p, PropCond pc);
00360 void reschedule(Space& home, Propagator& p, PropCond pc);
00362
00363 };
00364
00369 template<class Char, class Traits>
00370 std::basic_ostream<Char,Traits>&
00371 operator <<(std::basic_ostream<Char,Traits>& os, const ManFlexTask& t);
00372
00374 class OptFlexTask : public ManToOptTask<ManFlexTask> {
00375 protected:
00376 using ManToOptTask<ManFlexTask>::_m;
00377 public:
00379
00380
00381 OptFlexTask(void);
00383 OptFlexTask(IntVar s, IntVar p, IntVar e, BoolVar m);
00385 void init(IntVar s, IntVar p, IntVar e, BoolVar m);
00387 };
00388
00393 template<class Char, class Traits>
00394 std::basic_ostream<Char,Traits>&
00395 operator <<(std::basic_ostream<Char,Traits>& os, const OptFlexTask& t);
00396
00397 }}}
00398
00399 #include <gecode/int/unary/task.hpp>
00400
00401 namespace Gecode { namespace Int { namespace Unary {
00402
00404 typedef ManFixPTask ManFixPTaskFwd;
00405
00407 typedef FwdToBwd<ManFixPTaskFwd> ManFixPTaskBwd;
00408
00410 typedef ManFixPSETask ManFixPSETaskFwd;
00411
00413 typedef FwdToBwd<ManFixPSETaskFwd> ManFixPSETaskBwd;
00414
00416 typedef OptFixPTask OptFixPTaskFwd;
00417
00419 typedef FwdToBwd<OptFixPTaskFwd> OptFixPTaskBwd;
00420
00422 typedef OptFixPSETask OptFixPSETaskFwd;
00423
00425 typedef FwdToBwd<OptFixPSETaskFwd> OptFixPSETaskBwd;
00426
00428 typedef ManFlexTask ManFlexTaskFwd;
00429
00431 typedef FwdToBwd<ManFlexTaskFwd> ManFlexTaskBwd;
00432
00434 typedef OptFlexTask OptFlexTaskFwd;
00435
00437 typedef FwdToBwd<OptFlexTaskFwd> OptFlexTaskBwd;
00438
00439
00444 template<class Char, class Traits>
00445 std::basic_ostream<Char,Traits>&
00446 operator <<(std::basic_ostream<Char,Traits>& os, const ManFixPTaskBwd& t);
00447
00452 template<class Char, class Traits>
00453 std::basic_ostream<Char,Traits>&
00454 operator <<(std::basic_ostream<Char,Traits>& os, const ManFixPSETaskBwd& t);
00455
00460 template<class Char, class Traits>
00461 std::basic_ostream<Char,Traits>&
00462 operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPTaskBwd& t);
00463
00468 template<class Char, class Traits>
00469 std::basic_ostream<Char,Traits>&
00470 operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPSETaskBwd& t);
00471
00476 template<class Char, class Traits>
00477 std::basic_ostream<Char,Traits>&
00478 operator <<(std::basic_ostream<Char,Traits>& os, const ManFlexTaskBwd& t);
00479
00486 template<class Char, class Traits>
00487 std::basic_ostream<Char,Traits>&
00488 operator <<(std::basic_ostream<Char,Traits>& os, const OptFlexTaskBwd& t);
00489
00490 }}}
00491
00492 #include <gecode/int/unary/task-view.hpp>
00493
00494 namespace Gecode { namespace Int {
00495
00497 template<>
00498 class TaskViewTraits<Unary::ManFixPTaskFwd> {
00499 public:
00501 typedef Unary::ManFixPTask Task;
00502 };
00503
00505 template<>
00506 class TaskViewTraits<Unary::ManFixPTaskBwd> {
00507 public:
00509 typedef Unary::ManFixPTask Task;
00510 };
00511
00513 template<>
00514 class TaskViewTraits<Unary::ManFixPSETaskFwd> {
00515 public:
00517 typedef Unary::ManFixPSETask Task;
00518 };
00519
00521 template<>
00522 class TaskViewTraits<Unary::ManFixPSETaskBwd> {
00523 public:
00525 typedef Unary::ManFixPSETask Task;
00526 };
00527
00529 template<>
00530 class TaskViewTraits<Unary::OptFixPTaskFwd> {
00531 public:
00533 typedef Unary::OptFixPTask Task;
00534 };
00535
00537 template<>
00538 class TaskViewTraits<Unary::OptFixPTaskBwd> {
00539 public:
00541 typedef Unary::OptFixPTask Task;
00542 };
00543
00545 template<>
00546 class TaskViewTraits<Unary::OptFixPSETaskFwd> {
00547 public:
00549 typedef Unary::OptFixPSETask Task;
00550 };
00551
00553 template<>
00554 class TaskViewTraits<Unary::OptFixPSETaskBwd> {
00555 public:
00557 typedef Unary::OptFixPSETask Task;
00558 };
00559
00561 template<>
00562 class TaskViewTraits<Unary::ManFlexTaskFwd> {
00563 public:
00565 typedef Unary::ManFlexTask Task;
00566 };
00567
00569 template<>
00570 class TaskViewTraits<Unary::ManFlexTaskBwd> {
00571 public:
00573 typedef Unary::ManFlexTask Task;
00574 };
00575
00577 template<>
00578 class TaskViewTraits<Unary::OptFlexTaskFwd> {
00579 public:
00581 typedef Unary::OptFlexTask Task;
00582 };
00583
00585 template<>
00586 class TaskViewTraits<Unary::OptFlexTaskBwd> {
00587 public:
00589 typedef Unary::OptFlexTask Task;
00590 };
00591
00592
00594 template<>
00595 class TaskTraits<Unary::ManFixPTask> {
00596 public:
00598 typedef Unary::ManFixPTaskFwd TaskViewFwd;
00600 typedef Unary::ManFixPTaskBwd TaskViewBwd;
00601 };
00602
00604 template<>
00605 class TaskTraits<Unary::ManFixPSETask> {
00606 public:
00608 typedef Unary::ManFixPSETaskFwd TaskViewFwd;
00610 typedef Unary::ManFixPSETaskBwd TaskViewBwd;
00611 };
00612
00614 template<>
00615 class TaskTraits<Unary::OptFixPTask> {
00616 public:
00618 typedef Unary::OptFixPTaskFwd TaskViewFwd;
00620 typedef Unary::OptFixPTaskBwd TaskViewBwd;
00622 typedef Unary::ManFixPTask ManTask;
00623 };
00624
00626 template<>
00627 class TaskTraits<Unary::OptFixPSETask> {
00628 public:
00630 typedef Unary::OptFixPSETaskFwd TaskViewFwd;
00632 typedef Unary::OptFixPSETaskBwd TaskViewBwd;
00634 typedef Unary::ManFixPTask ManTask;
00635 };
00636
00638 template<>
00639 class TaskTraits<Unary::ManFlexTask> {
00640 public:
00642 typedef Unary::ManFlexTaskFwd TaskViewFwd;
00644 typedef Unary::ManFlexTaskBwd TaskViewBwd;
00645 };
00646
00648 template<>
00649 class TaskTraits<Unary::OptFlexTask> {
00650 public:
00652 typedef Unary::OptFlexTaskFwd TaskViewFwd;
00654 typedef Unary::OptFlexTaskBwd TaskViewBwd;
00656 typedef Unary::ManFlexTask ManTask;
00657 };
00658
00659 }}
00660
00661 namespace Gecode { namespace Int { namespace Unary {
00662
00664 class OmegaNode {
00665 public:
00667 int p;
00669 int ect;
00671 void init(const OmegaNode& l, const OmegaNode& r);
00673 void update(const OmegaNode& l, const OmegaNode& r);
00674 };
00675
00677 template<class TaskView>
00678 class OmegaTree : public TaskTree<TaskView,OmegaNode> {
00679 protected:
00680 using TaskTree<TaskView,OmegaNode>::tasks;
00681 using TaskTree<TaskView,OmegaNode>::leaf;
00682 using TaskTree<TaskView,OmegaNode>::root;
00683 using TaskTree<TaskView,OmegaNode>::init;
00684 using TaskTree<TaskView,OmegaNode>::update;
00685 public:
00687 OmegaTree(Region& r, const TaskViewArray<TaskView>& t);
00689 void insert(int i);
00691 void remove(int i);
00693 int ect(void) const;
00695 int ect(int i) const;
00696 };
00697
00699 class OmegaLambdaNode : public OmegaNode {
00700 public:
00702 static const int undef = -1;
00704 int lp;
00706 int lect;
00708 int resEct;
00710 int resLp;
00712 void init(const OmegaLambdaNode& l, const OmegaLambdaNode& r);
00714 void update(const OmegaLambdaNode& l, const OmegaLambdaNode& r);
00715 };
00716
00718 template<class TaskView>
00719 class OmegaLambdaTree : public TaskTree<TaskView,OmegaLambdaNode> {
00720 protected:
00721 using TaskTree<TaskView,OmegaLambdaNode>::tasks;
00722 using TaskTree<TaskView,OmegaLambdaNode>::leaf;
00723 using TaskTree<TaskView,OmegaLambdaNode>::root;
00724 using TaskTree<TaskView,OmegaLambdaNode>::init;
00725 using TaskTree<TaskView,OmegaLambdaNode>::update;
00726 public:
00728 OmegaLambdaTree(Region& r, const TaskViewArray<TaskView>& t,
00729 bool inc=true);
00731 void shift(int i);
00733 void oinsert(int i);
00735 void linsert(int i);
00737 void lremove(int i);
00739 bool lempty(void) const;
00741 int responsible(void) const;
00743 int ect(void) const;
00745 int lect(void) const;
00746 };
00747
00748 }}}
00749
00750 #include <gecode/int/unary/tree.hpp>
00751
00752 namespace Gecode { namespace Int { namespace Unary {
00753
00755 template<class ManTask>
00756 ExecStatus overload(Space& home, TaskArray<ManTask>& t);
00758 template<class OptTask, class PL>
00759 ExecStatus overload(Space& home, Propagator& p, TaskArray<OptTask>& t);
00760
00762 template<class Task>
00763 ExecStatus timetabling(Space& home, Propagator& p, TaskArray<Task>& t);
00764
00766 template<class Task>
00767 ExecStatus subsumed(Space& home, Propagator& p, TaskArray<Task>& t);
00768
00770 template<class ManTask>
00771 ExecStatus detectable(Space& home, TaskArray<ManTask>& t);
00773 template<class OptTask, class PL>
00774 ExecStatus detectable(Space& home, Propagator& p, TaskArray<OptTask>& t);
00775
00777 template<class ManTask>
00778 ExecStatus notfirstnotlast(Space& home, TaskArray<ManTask>& t);
00780 template<class OptTask, class PL>
00781 ExecStatus notfirstnotlast(Space& home, Propagator& p, TaskArray<OptTask>& t);
00782
00784 template<class Task>
00785 ExecStatus edgefinding(Space& home, TaskArray<Task>& t);
00786
00787
00794 template<class ManTask, class PL>
00795 class ManProp : public TaskProp<ManTask,PL> {
00796 protected:
00797 using TaskProp<ManTask,PL>::t;
00799 ManProp(Home home, TaskArray<ManTask>& t);
00801 ManProp(Space& home, bool shared, ManProp& p);
00802 public:
00804 virtual Actor* copy(Space& home, bool share);
00806 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00808 static ExecStatus post(Home home, TaskArray<ManTask>& t);
00809 };
00810
00817 template<class OptTask, class PL>
00818 class OptProp : public TaskProp<OptTask,PL> {
00819 protected:
00820 using TaskProp<OptTask,PL>::t;
00822 OptProp(Home home, TaskArray<OptTask>& t);
00824 OptProp(Space& home, bool shared, OptProp& p);
00825 public:
00827 virtual Actor* copy(Space& home, bool share);
00829 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00831 static ExecStatus post(Home home, TaskArray<OptTask>& t);
00832 };
00833
00835 template<class ManTask>
00836 ExecStatus
00837 manpost(Home home, TaskArray<ManTask>& t, IntPropLevel ipl);
00838
00840 template<class OptTask>
00841 ExecStatus
00842 optpost(Home home, TaskArray<OptTask>& t, IntPropLevel ipl);
00843
00844 }}}
00845
00846 #include <gecode/int/unary/overload.hpp>
00847 #include <gecode/int/unary/time-tabling.hpp>
00848 #include <gecode/int/unary/subsumption.hpp>
00849 #include <gecode/int/unary/detectable.hpp>
00850 #include <gecode/int/unary/not-first-not-last.hpp>
00851 #include <gecode/int/unary/edge-finding.hpp>
00852
00853 #include <gecode/int/unary/man-prop.hpp>
00854 #include <gecode/int/unary/opt-prop.hpp>
00855 #include <gecode/int/unary/post.hpp>
00856
00857 #endif
00858
00859