Generated on Sat Feb 12 2011 17:41:02 for Gecode by doxygen 1.7.3

man-prop.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *     Guido Tack <tack@gecode.org>
00006  *
00007  *  Copyright:
00008  *     Christian Schulte, 2009
00009  *     Guido Tack, 2010
00010  *
00011  *  Last modified:
00012  *     $Date: 2011-01-18 23:37:08 +0100 (Tue, 18 Jan 2011) $ by $Author: tack $
00013  *     $Revision: 11551 $
00014  *
00015  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  Permission is hereby granted, free of charge, to any person obtaining
00020  *  a copy of this software and associated documentation files (the
00021  *  "Software"), to deal in the Software without restriction, including
00022  *  without limitation the rights to use, copy, modify, merge, publish,
00023  *  distribute, sublicense, and/or sell copies of the Software, and to
00024  *  permit persons to whom the Software is furnished to do so, subject to
00025  *  the following conditions:
00026  *
00027  *  The above copyright notice and this permission notice shall be
00028  *  included in all copies or substantial portions of the Software.
00029  *
00030  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00031  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00032  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00033  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00034  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00035  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00036  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00037  *
00038  */
00039 
00040 namespace Gecode { namespace Scheduling { namespace Cumulative {
00041   
00042   template<class ManTask>
00043   forceinline
00044   ManProp<ManTask>::ManProp(Home home, int c0, TaskArray<ManTask>& t)
00045     : TaskProp<ManTask,Int::PC_INT_DOM>(home,t), c(c0) {}
00046 
00047   template<class ManTask>
00048   forceinline
00049   ManProp<ManTask>::ManProp(Space& home, bool shared, 
00050                             ManProp<ManTask>& p) 
00051     : TaskProp<ManTask,Int::PC_INT_DOM>(home,shared,p), c(p.c) {}
00052 
00053   template<class ManTask>
00054   forceinline ExecStatus 
00055   ManProp<ManTask>::post(Home home, int c, TaskArray<ManTask>& t) {
00056     // Check that tasks do not overload resource
00057     for (int i=t.size(); i--; )
00058       if (t[i].c() > c)
00059         return ES_FAILED;
00060     if (t.size() > 1)
00061       (void) new (home) ManProp<ManTask>(home,c,t);
00062     return ES_OK;
00063   }
00064 
00065   template<class ManTask>
00066   Actor* 
00067   ManProp<ManTask>::copy(Space& home, bool share) {
00068     return new (home) ManProp<ManTask>(home,share,*this);
00069   }
00070 
00071   template<class ManTask>  
00072   forceinline size_t 
00073   ManProp<ManTask>::dispose(Space& home) {
00074     (void) TaskProp<ManTask,Int::PC_INT_DOM>::dispose(home);
00075     return sizeof(*this);
00076   }
00077 
00078   template<class ManTask>
00079   ExecStatus 
00080   ManProp<ManTask>::propagate(Space& home, const ModEventDelta& med) {
00081     // Only bounds changes?
00082     if (Int::IntView::me(med) != Int::ME_INT_DOM)
00083       GECODE_ES_CHECK(overload(home,c,t));
00084     GECODE_ES_CHECK(edgefinding(home,c,t));
00085     return basic(home,*this,c,t);
00086   }
00087 
00088 }}}
00089 
00090 // STATISTICS: scheduling-prop