man-to-opt.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>
*
* Copyright:
* Christian Schulte, 2009
*
* 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 {
template<class ManTask>
forceinline
ManToOptTask<ManTask>::ManToOptTask(void) {}
template<class ManTask>
forceinline bool
ManToOptTask<ManTask>::mandatory(void) const {
return _m.one();
}
template<class ManTask>
forceinline bool
ManToOptTask<ManTask>::excluded(void) const {
return _m.zero();
}
template<class ManTask>
forceinline bool
ManToOptTask<ManTask>::optional(void) const {
return _m.none();
}
template<class ManTask>
forceinline bool
ManToOptTask<ManTask>::assigned(void) const {
return ManTask::assigned() && _m.assigned();
}
template<class ManTask>
forceinline ModEvent
ManToOptTask<ManTask>::mandatory(Space& home) {
return _m.one(home);
}
template<class ManTask>
forceinline ModEvent
ManToOptTask<ManTask>::excluded(Space& home) {
return _m.zero(home);
}
template<class ManTask>
forceinline void
ManToOptTask<ManTask>::update(Space& home, ManToOptTask<ManTask>& t) {
ManTask::update(home, t);
_m.update(home,t._m);
}
template<class ManTask>
forceinline void
ManToOptTask<ManTask>::subscribe(Space& home, Propagator& p, PropCond pc) {
ManTask::subscribe(home, p, pc);
_m.subscribe(home, p, PC_BOOL_VAL);
}
template<class ManTask>
forceinline void
ManToOptTask<ManTask>::cancel(Space& home, Propagator& p, PropCond pc) {
_m.cancel(home, p, PC_BOOL_VAL);
ManTask::cancel(home, p, pc);
}
template<class ManTask>
forceinline void
ManToOptTask<ManTask>::reschedule(Space& home, Propagator& p, PropCond pc) {
_m.reschedule(home, p, PC_BOOL_VAL);
ManTask::reschedule(home, p, pc);
}
}}
// STATISTICS: int-var
Gecode::Int::ManToOptTask::_m
Int::BoolView _m
Boolean view whether task is mandatory (= 1) or not.
Definition task.hh:46
Gecode::Int::ManToOptTask::assigned
bool assigned(void) const
Test whether task is assigned.
Definition man-to-opt.hpp:58
Gecode::Int::ManToOptTask::mandatory
bool mandatory(void) const
Whether task is mandatory.
Definition man-to-opt.hpp:42
Gecode::Int::ManToOptTask::ManToOptTask
ManToOptTask(void)
Default constructor.
Definition man-to-opt.hpp:38
Gecode::Int::ManToOptTask::cancel
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p for task.
Definition man-to-opt.hpp:88
Gecode::Int::ManToOptTask::update
void update(Space &home, ManToOptTask &t)
Update this task to be a clone of task t.
Definition man-to-opt.hpp:75
Gecode::Int::ManToOptTask::optional
bool optional(void) const
Whether task can still be optional.
Definition man-to-opt.hpp:52
Gecode::Int::ManToOptTask::excluded
bool excluded(void) const
Whether task is excluded.
Definition man-to-opt.hpp:47
Gecode::Int::ManToOptTask::subscribe
void subscribe(Space &home, Propagator &p, PropCond pc)
Subscribe propagator p to task.
Definition man-to-opt.hpp:82
Gecode::Int::ManToOptTask::reschedule
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
Definition man-to-opt.hpp:95
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Int
Finite domain integers.
Gecode::Int::PC_BOOL_VAL
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value).
Definition var-type.hpp:126
Gecode
Gecode toplevel namespace
Gecode::PropCond
int PropCond
Type for propagation conditions.
Definition core.hpp:72
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
forceinline
#define forceinline
Definition config.hpp:187