task.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Christian Schulte, 2009
* Guido Tack, 2010
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode { namespace Int { namespace Cumulative {
/*
* Mandatory fixed task
*/
forceinline
ManFixPTask::ManFixPTask(void) {}
forceinline
ManFixPTask::ManFixPTask(IntVar s, int p, int c)
: Unary::ManFixPTask(s,p), _c(c) {}
forceinline void
ManFixPTask::init(IntVar s, int p, int c) {
Unary::ManFixPTask::init(s,p); _c=c;
}
forceinline void
ManFixPTask::init(const ManFixPTask& t) {
Unary::ManFixPTask::init(t); _c=t._c;
}
forceinline int
ManFixPTask::c(void) const {
return _c;
}
forceinline long long int
ManFixPTask::e(void) const {
return static_cast<long long int>(pmin())*c();
}
forceinline void
ManFixPTask::update(Space& home, ManFixPTask& t) {
Unary::ManFixPTask::update(home,t); _c=t._c;
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os, const ManFixPTask& t) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct();
return os << s.str();
}
/*
* Mandatory fixed task with fixed processing, start or end time
*/
forceinline
ManFixPSETask::ManFixPSETask(void) {}
forceinline
ManFixPSETask::ManFixPSETask(TaskType t, IntVar s, int p, int c)
: Unary::ManFixPSETask(t,s,p), _c(c) {}
forceinline void
ManFixPSETask::init(TaskType t, IntVar s, int p, int c) {
Unary::ManFixPSETask::init(t,s,p); _c=c;
}
forceinline void
ManFixPSETask::init(const ManFixPSETask& t0) {
Unary::ManFixPSETask::init(t0); _c=t0._c;
}
forceinline int
ManFixPSETask::c(void) const {
return _c;
}
forceinline long long int
ManFixPSETask::e(void) const {
return static_cast<long long int>(pmin())*c();
}
forceinline void
ManFixPSETask::update(Space& home, ManFixPSETask& t) {
Unary::ManFixPSETask::update(home,t); _c=t._c;
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os,const ManFixPSETask& t) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct();
return os << s.str();
}
/*
* Mandatory flexible task
*/
forceinline
ManFlexTask::ManFlexTask(void) {}
forceinline
ManFlexTask::ManFlexTask(IntVar s, IntVar p, IntVar e, int c)
: Unary::ManFlexTask(s,p,e), _c(c) {}
forceinline void
ManFlexTask::init(IntVar s, IntVar p, IntVar e, int c) {
Unary::ManFlexTask::init(s,p,e); _c=c;
}
forceinline void
ManFlexTask::init(const ManFlexTask& t) {
Unary::ManFlexTask::init(t); _c=t._c;
}
forceinline int
ManFlexTask::c(void) const {
return _c;
}
forceinline long long int
ManFlexTask::e(void) const {
return static_cast<long long int>(pmin())*c();
}
forceinline void
ManFlexTask::update(Space& home, ManFlexTask& t) {
Unary::ManFlexTask::update(home,t); _c=t._c;
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os, const ManFlexTask& t) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << t.est() << ':' << t.lst() << ':' << t.pmin() << ':'
<< t.pmax() << ':' << t.c() << ':' << t.ect() << ':' << t.lct();
return os << s.str();
}
/*
* Optional fixed task
*/
forceinline
OptFixPTask::OptFixPTask(void) {}
forceinline
OptFixPTask::OptFixPTask(IntVar s, int p, int c, BoolVar m) {
ManFixPTask::init(s,p,c); _m=m;
}
forceinline void
OptFixPTask::init(IntVar s, int p, int c, BoolVar m) {
ManFixPTask::init(s,p,c); _m=m;
}
forceinline
OptFixPTask::operator Unary::OptFixPTask (void) {
return Unary::OptFixPTask(_s,_p,_m);
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPTask& t) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct() << ':'
<< (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
return os << s.str();
}
/*
* Optional fixed task
*/
forceinline
OptFixPSETask::OptFixPSETask(void) {}
forceinline
OptFixPSETask::OptFixPSETask(TaskType t,IntVar s,int p,int c,BoolVar m) {
ManFixPSETask::init(t,s,p,c); _m=m;
}
forceinline void
OptFixPSETask::init(TaskType t, IntVar s, int p, int c, BoolVar m) {
ManFixPSETask::init(t,s,p,c); _m=m;
}
forceinline
OptFixPSETask::operator Unary::OptFixPSETask (void) {
return Unary::OptFixPSETask(_t,_s,_p,_m);
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os, const OptFixPSETask& t) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << t.est() << ":[" << t.pmin() << ',' << t.c() << "]:" << t.lct() << ':'
<< (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
return os << s.str();
}
/*
* Optional flexible task
*/
forceinline
OptFlexTask::OptFlexTask(void) {}
forceinline
OptFlexTask::OptFlexTask(IntVar s, IntVar p, IntVar e, int c, BoolVar m) {
ManFlexTask::init(s,p,e,c); _m=m;
}
forceinline void
OptFlexTask::init(IntVar s, IntVar p, IntVar e, int c, BoolVar m) {
ManFlexTask::init(s,p,e,c); _m=m;
}
forceinline
OptFlexTask::operator Unary::OptFlexTask (void) {
return Unary::OptFlexTask(_s,_p,_e,_m);
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os, const OptFlexTask& t) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << t.est() << ':' << t.lst() << ':' << t.pmin() << ':'
<< t.pmax() << ':' << t.c() << ':' << t.ect() << ':' << t.lct()
<< (t.mandatory() ? '1' : (t.optional() ? '?' : '0'));
return os << s.str();
}
}}}
// STATISTICS: int-var
Gecode::BoolVar
Boolean integer variables.
Definition int.hh:512
Gecode::IntVar
Integer variables.
Definition int.hh:371
Gecode::Int::Cumulative::ManFixPSETask
Cumulative (mandatory) task with fixed processing, start or end time.
Definition cumulative.hh:112
Gecode::Int::Cumulative::ManFixPSETask::init
void init(TaskType t, IntVar s, int p, int c)
Initialize task.
Definition task.hpp:89
Gecode::Int::Cumulative::ManFixPSETask::e
long long int e(void) const
Return required energy.
Definition task.hpp:102
Gecode::Int::Cumulative::ManFixPSETask::ManFixPSETask
ManFixPSETask(void)
Default constructor.
Definition task.hpp:84
Gecode::Int::Cumulative::ManFixPSETask::c
int c(void) const
Return required capacity.
Definition task.hpp:98
Gecode::Int::Cumulative::ManFixPSETask::_c
int _c
Required capacity.
Definition cumulative.hh:115
Gecode::Int::Cumulative::ManFixPSETask::update
void update(Space &home, ManFixPSETask &t)
Update this task to be a clone of task t.
Definition task.hpp:107
Gecode::Int::Cumulative::ManFixPTask
Cumulative (mandatory) task with fixed processing time.
Definition cumulative.hh:70
Gecode::Int::Cumulative::ManFixPTask::init
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
Gecode::Int::Cumulative::ManFixPTask::e
long long int e(void) const
Return required energy.
Definition task.hpp:61
Gecode::Int::Cumulative::ManFixPTask::ManFixPTask
ManFixPTask(void)
Default constructor.
Definition task.hpp:43
Gecode::Int::Cumulative::ManFixPTask::c
int c(void) const
Return required capacity.
Definition task.hpp:57
Gecode::Int::Cumulative::ManFixPTask::update
void update(Space &home, ManFixPTask &t)
Update this task to be a clone of task t.
Definition task.hpp:66
Gecode::Int::Cumulative::ManFixPTask::_c
int _c
Required capacity.
Definition cumulative.hh:73
Gecode::Int::Cumulative::ManFlexTask
Cumulative (mandatory) task with flexible processing time.
Definition cumulative.hh:166
Gecode::Int::Cumulative::ManFlexTask::init
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
Gecode::Int::Cumulative::ManFlexTask::_c
int _c
Required capacity.
Definition cumulative.hh:169
Gecode::Int::Cumulative::ManFlexTask::e
long long int e(void) const
Return required energy.
Definition task.hpp:143
Gecode::Int::Cumulative::ManFlexTask::update
void update(Space &home, ManFlexTask &t)
Update this task to be a clone of task t.
Definition task.hpp:148
Gecode::Int::Cumulative::ManFlexTask::ManFlexTask
ManFlexTask(void)
Default constructor.
Definition task.hpp:125
Gecode::Int::Cumulative::ManFlexTask::c
int c(void) const
Return required capacity.
Definition task.hpp:139
Gecode::Int::Cumulative::OptFixPSETask
Cumulative optional task with fixed processing, start or end time.
Definition cumulative.hh:235
Gecode::Int::Cumulative::OptFixPSETask::init
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
Gecode::Int::Cumulative::OptFixPSETask::OptFixPSETask
OptFixPSETask(void)
Default constructor.
Definition task.hpp:196
Gecode::Int::Cumulative::OptFixPTask
Cumulative optional task with fixed processing time.
Definition cumulative.hh:209
Gecode::Int::Cumulative::OptFixPTask::OptFixPTask
OptFixPTask(void)
Default constructor.
Definition task.hpp:167
Gecode::Int::Cumulative::OptFixPTask::init
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
Gecode::Int::Cumulative::OptFlexTask
Cumulative optional task with flexible processing time
Definition cumulative.hh:261
Gecode::Int::Cumulative::OptFlexTask::OptFlexTask
OptFlexTask(void)
Default constructor.
Definition task.hpp:225
Gecode::Int::Cumulative::OptFlexTask::init
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
Gecode::Int::ManToOptTask< ManFixPTask >::_m
Int::BoolView _m
Definition task.hh:46
Gecode::Int::ManToOptTask::mandatory
bool mandatory(void) const
Whether task is mandatory.
Definition man-to-opt.hpp:42
Gecode::Int::ManToOptTask::optional
bool optional(void) const
Whether task can still be optional.
Definition man-to-opt.hpp:52
Gecode::Int::Unary::ManFixPSETask::pmin
int pmin(void) const
Return minimum processing time.
Definition task.hpp:212
Gecode::Int::Unary::ManFixPSETask::init
void init(TaskType t, IntVar s, int p)
Initialize task.
Definition task.hpp:175
Gecode::Int::Unary::ManFixPSETask::est
int est(void) const
Return earliest start time.
Definition task.hpp:184
Gecode::Int::Unary::ManFixPSETask::lct
int lct(void) const
Return latest completion time.
Definition task.hpp:202
Gecode::Int::Unary::ManFixPSETask::update
void update(Space &home, ManFixPSETask &t)
Update this task to be a clone of task t.
Definition task.hpp:299
Gecode::Int::Unary::ManFixPTask::est
int est(void) const
Return earliest start time.
Definition task.hpp:56
Gecode::Int::Unary::ManFixPTask::pmin
int pmin(void) const
Return minimum processing time.
Definition task.hpp:72
Gecode::Int::Unary::ManFixPTask::init
void init(IntVar s, int p)
Initialize with start time s and processing time p.
Definition task.hpp:47
Gecode::Int::Unary::ManFixPTask::lct
int lct(void) const
Return latest completion time.
Definition task.hpp:68
Gecode::Int::Unary::ManFixPTask::update
void update(Space &home, ManFixPTask &t)
Update this task to be a clone of task t.
Definition task.hpp:139
Gecode::Int::Unary::ManFlexTask::lst
int lst(void) const
Return latest start time.
Definition task.hpp:339
Gecode::Int::Unary::ManFlexTask::est
int est(void) const
Return earliest start time.
Definition task.hpp:331
Gecode::Int::Unary::ManFlexTask::p
IntVar p(void) const
Return processing time.
Definition task.hpp:359
Gecode::Int::Unary::ManFlexTask::pmin
int pmin(void) const
Return minimum processing time.
Definition task.hpp:347
Gecode::Int::Unary::ManFlexTask::ect
int ect(void) const
Return earliest completion time.
Definition task.hpp:335
Gecode::Int::Unary::ManFlexTask::pmax
int pmax(void) const
Return maximum processing time.
Definition task.hpp:351
Gecode::Int::Unary::ManFlexTask::update
void update(Space &home, ManFlexTask &t)
Update this task to be a clone of task t.
Definition task.hpp:425
Gecode::Int::Unary::ManFlexTask::lct
int lct(void) const
Return latest completion time.
Definition task.hpp:343
Gecode::Int::Unary::ManFlexTask::init
void init(IntVar s, IntVar p, IntVar e)
Initialize with start time s, processing time p, end time e.
Definition task.hpp:322
Gecode::Int::Unary::OptFixPSETask
Unary optional task with fixed processing, start or end time.
Definition unary.hh:246
Gecode::Int::Unary::OptFixPTask
Unary optional task with fixed processing time
Definition unary.hh:222
Gecode::Int::Unary::OptFlexTask
Unary optional task with flexible processing time
Definition unary.hh:370
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::TaskType
TaskType
Type of task for scheduling constraints.
Definition int.hh:1004
Gecode::Int::Cumulative
Scheduling for cumulative resources
Definition cumulative.cpp:40
Gecode::Int::Cumulative::operator<<
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const ManFixPTaskBwd &t)
Definition task-view.hpp:40
Gecode::Int::Unary
Int for unary resources
Gecode::Int
Finite domain integers.
Gecode
Gecode toplevel namespace
forceinline
#define forceinline
Definition config.hpp:187