Generated on Thu Apr 11 13:59:12 2019 for Gecode by doxygen 1.6.3

man-to-opt.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  *
00006  *  Copyright:
00007  *     Christian Schulte, 2009
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 namespace Gecode { namespace Int {
00035 
00036   template<class ManTask>
00037   forceinline
00038   ManToOptTask<ManTask>::ManToOptTask(void) {}
00039 
00040   template<class ManTask>
00041   forceinline bool
00042   ManToOptTask<ManTask>::mandatory(void) const {
00043     return _m.one();
00044   }
00045   template<class ManTask>
00046   forceinline bool
00047   ManToOptTask<ManTask>::excluded(void) const {
00048     return _m.zero();
00049   }
00050   template<class ManTask>
00051   forceinline bool
00052   ManToOptTask<ManTask>::optional(void) const {
00053     return _m.none();
00054   }
00055 
00056   template<class ManTask>
00057   forceinline bool
00058   ManToOptTask<ManTask>::assigned(void) const {
00059     return ManTask::assigned() && _m.assigned();
00060   }
00061 
00062   template<class ManTask>
00063   forceinline ModEvent
00064   ManToOptTask<ManTask>::mandatory(Space& home) {
00065     return _m.one(home);
00066   }
00067   template<class ManTask>
00068   forceinline ModEvent
00069   ManToOptTask<ManTask>::excluded(Space& home) {
00070     return _m.zero(home);
00071   }
00072 
00073   template<class ManTask>
00074   forceinline void
00075   ManToOptTask<ManTask>::update(Space& home, ManToOptTask<ManTask>& t) {
00076     ManTask::update(home, t);
00077     _m.update(home,t._m);
00078   }
00079 
00080   template<class ManTask>
00081   forceinline void
00082   ManToOptTask<ManTask>::subscribe(Space& home, Propagator& p, PropCond pc) {
00083     ManTask::subscribe(home, p, pc);
00084     _m.subscribe(home, p, PC_BOOL_VAL);
00085   }
00086   template<class ManTask>
00087   forceinline void
00088   ManToOptTask<ManTask>::cancel(Space& home, Propagator& p, PropCond pc) {
00089     _m.cancel(home, p, PC_BOOL_VAL);
00090     ManTask::cancel(home, p, pc);
00091   }
00092 
00093   template<class ManTask>
00094   forceinline void
00095   ManToOptTask<ManTask>::reschedule(Space& home, Propagator& p, PropCond pc) {
00096     _m.reschedule(home, p, PC_BOOL_VAL);
00097     ManTask::reschedule(home, p, pc);
00098   }
00099 
00100 }}
00101 
00102 // STATISTICS: int-var