Generated on Sat Feb 7 2015 02:01:21 for Gecode by doxygen 1.8.9.1
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  * Last modified:
12  * $Date: 2013-03-11 06:26:07 +0100 (Mon, 11 Mar 2013) $ by $Author: tack $
13  * $Revision: 13487 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 namespace Gecode { namespace Int { namespace Cumulative {
41 
42  /*
43  * Mandatory fixed task
44  */
45 
50  : Unary::ManFixPTask(s,p), _c(c) {}
51  forceinline void
52  ManFixPTask::init(IntVar s, int p, int c) {
54  }
55  forceinline void
58  }
59 
60  forceinline int
61  ManFixPTask::c(void) const {
62  return _c;
63  }
64  forceinline long long int
65  ManFixPTask::e(void) const {
66  return static_cast<long long int>(pmin())*c();
67  }
68 
69  forceinline void
70  ManFixPTask::update(Space& home, bool share, ManFixPTask& t) {
71  Unary::ManFixPTask::update(home,share,t); _c=t._c;
72  }
73 
74  template<class Char, class Traits>
75  std::basic_ostream<Char,Traits>&
76  operator <<(std::basic_ostream<Char,Traits>& os, const ManFixPTask& t) {
77  std::basic_ostringstream<Char,Traits> s;
78  s.copyfmt(os); s.width(0);
79  s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct();
80  return os << s.str();
81  }
82 
83  /*
84  * Mandatory fixed task with fixed processing, start or end time
85  */
86 
91  : Unary::ManFixPSETask(t,s,p), _c(c) {}
92  forceinline void
95  }
96  forceinline void
99  }
100 
101  forceinline int
102  ManFixPSETask::c(void) const {
103  return _c;
104  }
105  forceinline long long int
106  ManFixPSETask::e(void) const {
107  return static_cast<long long int>(pmin())*c();
108  }
109 
110  forceinline void
112  Unary::ManFixPSETask::update(home,share,t); _c=t._c;
113  }
114 
115  template<class Char, class Traits>
116  std::basic_ostream<Char,Traits>&
117  operator <<(std::basic_ostream<Char,Traits>& os,const ManFixPSETask& t) {
118  std::basic_ostringstream<Char,Traits> s;
119  s.copyfmt(os); s.width(0);
120  s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct();
121  return os << s.str();
122  }
123 
124  /*
125  * Mandatory flexible task
126  */
127 
132  : Unary::ManFlexTask(s,p,e), _c(c) {}
133  forceinline void
135  Unary::ManFlexTask::init(s,p,e); _c=c;
136  }
137  forceinline void
140  }
141 
142  forceinline int
143  ManFlexTask::c(void) const {
144  return _c;
145  }
146  forceinline long long int
147  ManFlexTask::e(void) const {
148  return static_cast<long long int>(pmin())*c();
149  }
150 
151  forceinline void
152  ManFlexTask::update(Space& home, bool share, ManFlexTask& t) {
153  Unary::ManFlexTask::update(home,share,t); _c=t._c;
154  }
155 
156  template<class Char, class Traits>
157  std::basic_ostream<Char,Traits>&
158  operator <<(std::basic_ostream<Char,Traits>& os, const ManFlexTask& t) {
159  std::basic_ostringstream<Char,Traits> s;
160  s.copyfmt(os); s.width(0);
161  s << t.est() << ':' << t.lst() << ':' << t.pmin() << ':'
162  << t.pmax() << ':' << t.c() << ':' << t.ect() << ':' << t.lct();
163  return os << s.str();
164  }
165 
166  /*
167  * Optional fixed task
168  */
169 
174  ManFixPTask::init(s,p,c); _m=m;
175  }
176  forceinline void
177  OptFixPTask::init(IntVar s, int p, int c, BoolVar m) {
178  ManFixPTask::init(s,p,c); _m=m;
179  }
181  OptFixPTask::operator Unary::OptFixPTask (void) {
182  return Unary::OptFixPTask(_s,_p,_m);
183  }
184 
185  template<class Char, class Traits>
186  std::basic_ostream<Char,Traits>&
187  operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPTask& t) {
188  std::basic_ostringstream<Char,Traits> s;
189  s.copyfmt(os); s.width(0);
190  s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct() << ':'
191  << (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
192  return os << s.str();
193  }
194 
195  /*
196  * Optional fixed task
197  */
198 
203  ManFixPSETask::init(t,s,p,c); _m=m;
204  }
205  forceinline void
207  ManFixPSETask::init(t,s,p,c); _m=m;
208  }
210  OptFixPSETask::operator Unary::OptFixPSETask (void) {
211  return Unary::OptFixPSETask(_t,_s,_p,_m);
212  }
213 
214  template<class Char, class Traits>
215  std::basic_ostream<Char,Traits>&
216  operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPSETask& t) {
217  std::basic_ostringstream<Char,Traits> s;
218  s.copyfmt(os); s.width(0);
219  s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct() << ':'
220  << (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
221  return os << s.str();
222  }
223 
224  /*
225  * Optional flexible task
226  */
227 
232  ManFlexTask::init(s,p,e,c); _m=m;
233  }
234  forceinline void
236  ManFlexTask::init(s,p,e,c); _m=m;
237  }
239  OptFlexTask::operator Unary::OptFlexTask (void) {
240  return Unary::OptFlexTask(_s,_p,_e,_m);
241  }
242 
243  template<class Char, class Traits>
244  std::basic_ostream<Char,Traits>&
245  operator <<(std::basic_ostream<Char,Traits>& os, const OptFlexTask& t) {
246  std::basic_ostringstream<Char,Traits> s;
247  s.copyfmt(os); s.width(0);
248  s << t.est() << ':' << t.lst() << ':' << t.pmin() << ':'
249  << t.pmax() << ':' << t.c() << ':' << t.ect() << ':' << t.lct()
250  << (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
251  return os << s.str();
252  }
253 
254 }}}
255 
256 // STATISTICS: int-var
int c(void) const
Return required capacity.
Definition: task.hpp:102
int pmin(void) const
Return minimum processing time.
Definition: task.hpp:212
void update(Space &home, bool share, ManFixPSETask &t)
Update this task to be a clone of task t.
Definition: task.hpp:299
Cumulative (mandatory) task with flexible processing time.
Definition: cumulative.hh:170
NodeType t
Type of node.
Definition: bool-expr.cpp:234
Cumulative (mandatory) task with fixed processing, start or end time.
Definition: cumulative.hh:116
ManFlexTask(void)
Default constructor.
Definition: task.hpp:129
TaskType
Type of task for scheduling constraints.
Definition: int.hh:949
Unary optional task with flexible processing time
Definition: unary.hh:370
void init(IntVar s, int p)
Initialize with start time s and processing time p.
Definition: task.hpp:51
int c(void) const
Return required capacity.
Definition: task.hpp:143
void update(Space &home, bool share, ManFixPSETask &t)
Update this task to be a clone of task t.
Definition: task.hpp:111
ManFixPSETask(void)
Default constructor.
Definition: task.hpp:88
Cumulative optional task with flexible processing time
Definition: cumulative.hh:265
Computation spaces.
Definition: core.hpp:1362
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:177
OptFixPSETask(void)
Default constructor.
Definition: task.hpp:200
Gecode::FloatVal c(-8, 8)
Unary optional task with fixed processing time
Definition: unary.hh:224
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
void update(Space &home, bool share, ManFixPTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:143
Cumulative (mandatory) task with fixed processing time.
Definition: cumulative.hh:74
int pmin(void) const
Return minimum processing time.
Definition: task.hpp:76
void update(Space &home, bool share, ManFlexTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:152
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:235
void init(IntVar s, IntVar p, IntVar e)
Initialize with start time s, processing time p, end time e.
Definition: task.hpp:322
long long int e(void) const
Return required energy.
Definition: task.hpp:106
void init(TaskType t, IntVar s, int p, int c)
Initialize task.
Definition: task.hpp:93
void init(IntVar s, IntVar p, IntVar e, int c)
Initialize with start time s, processing time p, end time e.
Definition: task.hpp:134
long long int e(void) const
Return required energy.
Definition: task.hpp:65
OptFlexTask(void)
Default constructor.
Definition: task.hpp:229
Boolean integer variables.
Definition: int.hh:491
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:206
void init(TaskType t, IntVar s, int p)
Initialize task.
Definition: task.hpp:175
Cumulative optional task with fixed processing time.
Definition: cumulative.hh:213
OptFixPTask(void)
Default constructor.
Definition: task.hpp:171
void update(Space &home, bool share, ManFlexTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:425
void update(Space &home, bool share, ManFixPTask &t)
Update this task to be a clone of task t.
Definition: task.hpp:70
Multi _e(Gecode::IntArgs(4, 4, 2, 3, 1))
Integer variables.
Definition: int.hh:350
#define forceinline
Definition: config.hpp:132
Unary optional task with fixed processing, start or end time.
Definition: unary.hh:248
void init(IntVar s, int p, int c)
Initialize task with start time s, processing time p, and required resource c.
Definition: task.hpp:52
Int::BoolView _m
Boolean view whether task is mandatory (= 1) or not.
Definition: task.hh:50
int pmin(void) const
Return minimum processing time.
Definition: task.hpp:347
Gecode toplevel namespace
long long int e(void) const
Return required energy.
Definition: task.hpp:147
Cumulative optional task with fixed processing, start or end time.
Definition: cumulative.hh:239
int c(void) const
Return required capacity.
Definition: task.hpp:61
Multi _c(Gecode::IntArgs(3, 1, 2, 3))
ManFixPTask(void)
Default constructor.
Definition: task.hpp:47