Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
7.5 kB · 252 lines
C++
at develop
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253/* -*- 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