Generated on Fri Jul 21 2023 00:00:00 for Gecode by doxygen 1.9.6
task.hpp
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 * Guido Tack <tack@gecode.org>
6 *
7 * Copyright:
8 * Christian Schulte, 2009
9 * Guido Tack, 2010
10 *
11 * This file is part of Gecode, the generic constraint
12 * development environment:
13 * http://www.gecode.org
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining
16 * a copy of this software and associated documentation files (the
17 * "Software"), to deal in the Software without restriction, including
18 * without limitation the rights to use, copy, modify, merge, publish,
19 * distribute, sublicense, and/or sell copies of the Software, and to
20 * permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be
24 * included in all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 *
34 */
35
36namespace Gecode { namespace Int { namespace Cumulative {
37
38 /*
39 * Mandatory fixed task
40 */
41
46 : Unary::ManFixPTask(s,p), _c(c) {}
47 forceinline void
48 ManFixPTask::init(IntVar s, int p, int c) {
50 }
51 forceinline void
54 }
55
56 forceinline int
57 ManFixPTask::c(void) const {
58 return _c;
59 }
60 forceinline long long int
61 ManFixPTask::e(void) const {
62 return static_cast<long long int>(pmin())*c();
63 }
64
65 forceinline void
68 }
69
70 template<class Char, class Traits>
71 std::basic_ostream<Char,Traits>&
72 operator <<(std::basic_ostream<Char,Traits>& os, const ManFixPTask& t) {
73 std::basic_ostringstream<Char,Traits> s;
74 s.copyfmt(os); s.width(0);
75 s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct();
76 return os << s.str();
77 }
78
79 /*
80 * Mandatory fixed task with fixed processing, start or end time
81 */
82
87 : Unary::ManFixPSETask(t,s,p), _c(c) {}
88 forceinline void
91 }
92 forceinline void
95 }
96
97 forceinline int
98 ManFixPSETask::c(void) const {
99 return _c;
100 }
101 forceinline long long int
102 ManFixPSETask::e(void) const {
103 return static_cast<long long int>(pmin())*c();
104 }
105
106 forceinline void
109 }
110
111 template<class Char, class Traits>
112 std::basic_ostream<Char,Traits>&
113 operator <<(std::basic_ostream<Char,Traits>& os,const ManFixPSETask& t) {
114 std::basic_ostringstream<Char,Traits> s;
115 s.copyfmt(os); s.width(0);
116 s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct();
117 return os << s.str();
118 }
119
120 /*
121 * Mandatory flexible task
122 */
123
128 : Unary::ManFlexTask(s,p,e), _c(c) {}
129 forceinline void
132 }
133 forceinline void
136 }
137
138 forceinline int
139 ManFlexTask::c(void) const {
140 return _c;
141 }
142 forceinline long long int
143 ManFlexTask::e(void) const {
144 return static_cast<long long int>(pmin())*c();
145 }
146
147 forceinline void
150 }
151
152 template<class Char, class Traits>
153 std::basic_ostream<Char,Traits>&
154 operator <<(std::basic_ostream<Char,Traits>& os, const ManFlexTask& t) {
155 std::basic_ostringstream<Char,Traits> s;
156 s.copyfmt(os); s.width(0);
157 s << t.est() << ':' << t.lst() << ':' << t.pmin() << ':'
158 << t.pmax() << ':' << t.c() << ':' << t.ect() << ':' << t.lct();
159 return os << s.str();
160 }
161
162 /*
163 * Optional fixed task
164 */
165
170 ManFixPTask::init(s,p,c); _m=m;
171 }
172 forceinline void
173 OptFixPTask::init(IntVar s, int p, int c, BoolVar m) {
174 ManFixPTask::init(s,p,c); _m=m;
175 }
177 OptFixPTask::operator Unary::OptFixPTask (void) {
178 return Unary::OptFixPTask(_s,_p,_m);
179 }
180
181 template<class Char, class Traits>
182 std::basic_ostream<Char,Traits>&
183 operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPTask& t) {
184 std::basic_ostringstream<Char,Traits> s;
185 s.copyfmt(os); s.width(0);
186 s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct() << ':'
187 << (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
188 return os << s.str();
189 }
190
191 /*
192 * Optional fixed task
193 */
194
199 ManFixPSETask::init(t,s,p,c); _m=m;
200 }
201 forceinline void
203 ManFixPSETask::init(t,s,p,c); _m=m;
204 }
206 OptFixPSETask::operator Unary::OptFixPSETask (void) {
207 return Unary::OptFixPSETask(_t,_s,_p,_m);
208 }
209
210 template<class Char, class Traits>
211 std::basic_ostream<Char,Traits>&
212 operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPSETask& t) {
213 std::basic_ostringstream<Char,Traits> s;
214 s.copyfmt(os); s.width(0);
215 s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct() << ':'
216 << (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
217 return os << s.str();
218 }
219
220 /*
221 * Optional flexible task
222 */
223
228 ManFlexTask::init(s,p,e,c); _m=m;
229 }
230 forceinline void
232 ManFlexTask::init(s,p,e,c); _m=m;
233 }
235 OptFlexTask::operator Unary::OptFlexTask (void) {
236 return Unary::OptFlexTask(_s,_p,_e,_m);
237 }
238
239 template<class Char, class Traits>
240 std::basic_ostream<Char,Traits>&
241 operator <<(std::basic_ostream<Char,Traits>& os, const OptFlexTask& t) {
242 std::basic_ostringstream<Char,Traits> s;
243 s.copyfmt(os); s.width(0);
244 s << t.est() << ':' << t.lst() << ':' << t.pmin() << ':'
245 << t.pmax() << ':' << t.c() << ':' << t.ect() << ':' << t.lct()
246 << (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
247 return os << s.str();
248 }
249
250}}}
251
252// STATISTICS: int-var
NodeType t
Type of node.
Definition: bool-expr.cpp:230
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Boolean integer variables.
Definition: int.hh:515
Integer variables.
Definition: int.hh:371
Cumulative (mandatory) task with fixed processing, start or end time.
Definition: cumulative.hh:112
void init(TaskType t, IntVar s, int p, int c)
Initialize task.
Definition: task.hpp:89
long long int e(void) const
Return required energy.
Definition: task.hpp:102
ManFixPSETask(void)
Default constructor.
Definition: task.hpp:84
int c(void) const
Return required capacity.
Definition: task.hpp:98
void update(Space &home, ManFixPSETask &t)
Update this task to be a clone of task t.
Definition: task.hpp:107
Cumulative (mandatory) task with fixed processing time.
Definition: cumulative.hh:70
void init(IntVar s, int p, int c)
Initialize task with start time s, processing time p, and required resource c.
Definition: task.hpp:48
long long int e(void) const
Return required energy.
Definition: task.hpp:61
ManFixPTask(void)
Default constructor.
Definition: task.hpp:43
int c(void) const
Return required capacity.
Definition: task.hpp:57
void update(Space &home, ManFixPTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:66
Cumulative (mandatory) task with flexible processing time.
Definition: cumulative.hh:166
void init(IntVar s, IntVar p, IntVar e, int c)
Initialize with start time s, processing time p, end time e.
Definition: task.hpp:130
long long int e(void) const
Return required energy.
Definition: task.hpp:143
void update(Space &home, ManFlexTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:148
ManFlexTask(void)
Default constructor.
Definition: task.hpp:125
int c(void) const
Return required capacity.
Definition: task.hpp:139
Cumulative optional task with fixed processing, start or end time.
Definition: cumulative.hh:235
void init(TaskType t, IntVar s, int p, int c, BoolVar m)
Initialize with start time s, processing time p, required capacity c, and mandatory flag m.
Definition: task.hpp:202
OptFixPSETask(void)
Default constructor.
Definition: task.hpp:196
Cumulative optional task with fixed processing time.
Definition: cumulative.hh:209
OptFixPTask(void)
Default constructor.
Definition: task.hpp:167
void init(IntVar s, int p, int c, BoolVar m)
Initialize with start time s, processing time p, required capacity c, and mandatory flag m.
Definition: task.hpp:173
Cumulative optional task with flexible processing time
Definition: cumulative.hh:261
OptFlexTask(void)
Default constructor.
Definition: task.hpp:225
void init(IntVar s, IntVar p, IntVar e, int c, BoolVar m)
Initialize with start time s, processing time p, end time e, and mandatory flag m.
Definition: task.hpp:231
Int::BoolView _m
Boolean view whether task is mandatory (= 1) or not.
Definition: task.hh:46
int pmin(void) const
Return minimum processing time.
Definition: task.hpp:212
void init(TaskType t, IntVar s, int p)
Initialize task.
Definition: task.hpp:175
void update(Space &home, ManFixPSETask &t)
Update this task to be a clone of task t.
Definition: task.hpp:299
int pmin(void) const
Return minimum processing time.
Definition: task.hpp:72
void init(IntVar s, int p)
Initialize with start time s and processing time p.
Definition: task.hpp:47
void update(Space &home, ManFixPTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:139
IntVar p(void) const
Return processing time.
Definition: task.hpp:359
int pmin(void) const
Return minimum processing time.
Definition: task.hpp:347
void update(Space &home, ManFlexTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:425
void init(IntVar s, IntVar p, IntVar e)
Initialize with start time s, processing time p, end time e.
Definition: task.hpp:322
Unary optional task with fixed processing, start or end time.
Definition: unary.hh:246
Unary optional task with fixed processing time
Definition: unary.hh:222
Unary optional task with flexible processing time
Definition: unary.hh:370
Computation spaces.
Definition: core.hpp:1744
TaskType
Type of task for scheduling constraints.
Definition: int.hh:1019
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const ManFixPTaskBwd &t)
Definition: task-view.hpp:40
Gecode toplevel namespace
#define forceinline
Definition: config.hpp:194