this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Mikael Lagerkvist <lagerkvist@gecode.org>
5 *
6 * Copyright:
7 * Mikael Lagerkvist, 2005
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34#ifndef GECODE_INT_CUMULATIVES_HH
35#define GECODE_INT_CUMULATIVES_HH
36
37#include <gecode/int.hh>
38
39namespace Gecode { namespace Int { namespace Cumulatives {
40
41 /** \namespace Gecode::Int::Cumulatives
42 * \brief %Cumulatives propagators
43 *
44 * This namespace contains a propagator for the
45 * cumulatives constraint as presented in
46 \verbatim
47 @inproceedings{DBLP:conf/cp/BeldiceanuC02,
48 author = {Nicolas Beldiceanu and Mats Carlsson},
49 title = {A New Multi-resource cumulatives Constraint
50 with Negative Heights.},
51 booktitle = {CP},
52 year = {2002},
53 pages = {63-79},
54 ee = {http://link.springer.de/link/service/series/0558/
55 bibs/2470/24700063.htm},
56 crossref = {DBLP:conf/cp/2002},
57 bibsource = {DBLP, http://dblp.uni-trier.de}
58 }
59 @proceedings{DBLP:conf/cp/2002,
60 editor = {Pascal Van Hentenryck},
61 title = {Principles and Practice of Constraint Programming -
62 CP 2002, 8th International Conference, CP 2002,
63 Ithaca, NY, USA, September 9-13, 2002, Proceedings},
64 booktitle = {CP},
65 publisher = {Springer},
66 series = {Lecture Notes in Computer Science},
67 volume = {2470},
68 year = {2002},
69 isbn = {3-540-44120-4},
70 bibsource = {DBLP, http://dblp.uni-trier.de}
71 }
72 \endverbatim
73 */
74
75
76 /**
77 * \brief %Propagator for the cumulatives constraint
78 *
79 * This class implements Beldiceanu's and Carlsson's sweep-line
80 * propagation algorithm for the cumulatives constraint.
81 *
82 * Requires \code #include <gecode/int/cumulatives.hh> \endcode
83 * \ingroup FuncIntProp
84 */
85 template<class ViewM, class ViewP, class ViewU, class View>
86 class Val : public Propagator {
87 protected:
88 ViewArray<ViewM> m;
89 ViewArray<View> s;
90 ViewArray<ViewP> p;
91 ViewArray<View> e;
92 ViewArray<ViewU> u;
93 SharedArray<int> c;
94 const bool at_most;
95
96 Val(Space& home, Val<ViewM, ViewP, ViewU, View>& p);
97 Val(Home home, const ViewArray<ViewM>&, const ViewArray<View>&,
98 const ViewArray<ViewP>&, const ViewArray<View>&,
99 const ViewArray<ViewU>&, const SharedArray<int>&, bool);
100
101 ExecStatus prune(Space& home, int low, int up, int r,
102 int ntask, int su,
103 int* contribution,
104 int* prune_tasks, int& prune_tasks_size);
105 public:
106 /// Create copy during cloning
107 virtual Actor* copy(Space& home);
108 /// Cost function (defined as low quadratic)
109 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
110 /// Schedule function
111 virtual void reschedule(Space& home);
112 /// Perform propagation
113 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
114 /// Post propagator
115 static ExecStatus post(Home home, const ViewArray<ViewM>&,
116 const ViewArray<View>&, const ViewArray<ViewP>&,
117 const ViewArray<View>&, const ViewArray<ViewU>&,
118 const SharedArray<int>&, bool);
119 /// Dispose propagator
120 virtual size_t dispose(Space& home);
121 };
122
123
124}}}
125
126#include <gecode/int/cumulatives/val.hpp>
127
128#endif
129
130// STATISTICS: int-prop
131