34#ifndef __GECODE_INT_TASK_HH__
35#define __GECODE_INT_TASK_HH__
42 template<
class ManTask>
98namespace Gecode {
namespace Int {
101 template<
class TaskView>
139namespace Gecode {
namespace Int {
147 template<
class TaskView>
161namespace Gecode {
namespace Int {
187 int size(
void)
const;
217 static void*
operator new(size_t);
218 static void operator delete(
void*,size_t);
225 template<
class Char,
class Traits,
class Task>
226 std::basic_ostream<Char,Traits>&
232 template<
class TaskView>
249 int size(
void)
const;
262 static void*
operator new(size_t);
263 static void operator delete(
void*,size_t);
270 template<
class Char,
class Traits,
class TaskView>
271 std::basic_ostream<Char,Traits>&
279namespace Gecode {
namespace Int {
290 template<
class TaskView, SortTaskOrder sto,
bool inc>
294 template<
class TaskView, SortTaskOrder sto,
bool inc>
298 template<
class TaskView, SortTaskOrder sto,
bool inc>
308 template<
class TaskView, SortTaskOrder sto,
bool inc>
325 int left(
void)
const;
333 int task(
void)
const;
338 template<
class OptTaskView, SortTaskOrder sto,
bool inc>
352namespace Gecode {
namespace Int {
358 long long int plus(
long long int x,
long long int y);
364 template<
class TaskView,
class Node>
380 static bool n_root(
int i);
386 static bool left(
int i);
390 static bool right(
int i);
397 const Node&
root(
void)
const;
399 void update(
int i,
bool l=
true);
415namespace Gecode {
namespace Int {
423 template<
class Task,
class PL>
442 template<
class OptTask,
class PL>
446 template<
class OptTask,
class PL,
class Cap>
487namespace Gecode {
namespace Int {
512 int time(
void)
const;
526 template<
class Char,
class Traits>
527 std::basic_ostream<Char,Traits>&
Home class for posting propagators
Boolean view for Boolean variables.
Time-tabling event for task.
int idx(void) const
Return event index.
static Event * events(Region &r, const TaskArray< Task > &t, bool &assigned)
Allocate from r and initialize event array with tasks t.
unsigned int ei
Combines type and number of task.
void init(Type e, int t, int i)
Initialize event.
Type
Event type for task with order in which they are processed.
@ ZRO
Zero-length task start time.
@ ERT
Earliest required time of task.
@ LRT
Latest required time of task.
@ EST
Earliest start time of task.
@ LCT
Latest completion time of task.
int time(void) const
Return event time.
Type type(void) const
Return event type.
bool operator<(const Event &e) const
Order among events.
Task mapper: turns a task view into its dual.
ModEvent lct(Space &home, int n)
Update latest completion time to n.
ModEvent lst(Space &home, int n)
Update latest start time to n.
int ect(void) const
Return earliest completion time.
int lst(void) const
Return latest start time.
ModEvent ect(Space &home, int n)
Update earliest completion time to n.
int lct(void) const
Return latest completion time.
ModEvent norun(Space &home, int e, int l)
Update such that task cannot run from e to l.
int est(void) const
Return earliest start time.
int pmin(void) const
Return minimum processing time.
ModEvent est(Space &home, int n)
Update earliest start time to n.
int pmax(void) const
Return maximum processing time.
ManTaskViewIter(Region &r, const TaskViewArray< OptTaskView > &t)
Initialize iterator with mandatory tasks.
Int::BoolView _m
Boolean view whether task is mandatory (= 1) or not.
bool assigned(void) const
Test whether task is assigned.
bool mandatory(void) const
Whether task is mandatory.
ManToOptTask(void)
Default constructor.
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p for task.
void update(Space &home, ManToOptTask &t)
Update this task to be a clone of task t.
bool optional(void) const
Whether task can still be optional.
bool excluded(void) const
Whether task is excluded.
void subscribe(Space &home, Propagator &p, PropCond pc)
Subscribe propagator p to task.
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
Class for defining advanced propagation level.
static const PropCond pc
For basic propagation, domain operations are needed.
static const bool advanced
Do not perform advanced propagation.
static const bool basic
Perform basic propagation.
Class for defining basic and advanced propagation level.
static const bool advanced
Do not perform advanced propagation.
static const bool basic
Perform basic propagation.
static const PropCond pc
For basic propagation, domain operations are needed.
Class for defining basic propagation level.
static const PropCond pc
For basic propagation, domain operations are needed.
static const bool advanced
Do not perform advanced propagation.
static const bool basic
Perform basic propagation.
Task & operator[](int i)
Return task at position i.
void update(Space &, TaskArray &a)
Update array to be a clone of array a.
TaskArray(void)
Default constructor (array of size 0)
void subscribe(Space &home, Propagator &p, PropCond pc=Int::PC_INT_BND)
Subscribe propagator p to all tasks.
void cancel(Space &home, Propagator &p, PropCond pc=Int::PC_INT_BND)
Cancel subscription of propagator p for all tasks.
void reschedule(Space &home, Propagator &p, PropCond pc=Int::PC_INT_BND)
Schedule propagator p.
int size(void) const
Return size of array (number of elements)
const TaskArray< Task > & operator=(const TaskArray< Task > &a)
Initialize from task array a (share elements)
TaskArray< Task > t
Tasks.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual void reschedule(Space &home)
Schedule function.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high linear)
TaskProp(Home home, TaskArray< Task > &t)
Constructor for creation.
Traits class for mapping tasks to task views.
int n_nodes(void) const
Return number of nodes for balanced binary tree.
const TaskViewArray< TaskView > & tasks
The tasks from which the tree is computed.
static int n_right(int i)
Return index of right child of node i.
int n_inner(void) const
Return number of inner nodes.
static bool right(int i)
Test whether node i is a right child.
static int n_left(int i)
Return index of left child of node i.
static bool left(int i)
Test whether node i is a left child.
void init(void)
Initialize tree after leaves have been initialized.
bool n_leaf(int i) const
Whether node i is leaf.
const Node & root(void) const
Return root node.
static int n_parent(int i)
Return index of parent of node i.
int * _leaf
Map task number to leaf node number in right order.
Node & leaf(int i)
Return leaf for task i.
void update(void)
Update all inner nodes of tree after leaves have been initialized.
static bool n_root(int i)
Whether node i is index of root.
TaskArray< Task > & t
Access to task array.
TaskViewTraits< TaskView >::Task Task
The underlying task type.
TaskViewArray(TaskArray< Task > &t)
Initialize from task array a.
int size(void) const
Return size of array (number of elements)
TaskView & operator[](int i)
Return task view at position i.
void operator++(void)
Move iterator to next task.
bool operator()(void) const
Test whether iterator is still at a task.
int * map
Map for iteration order.
int task(void) const
Return current task position.
int left(void) const
How many tasks are left to be iterated.
TaskViewIter(void)
Default constructor (no initialization)
Traits class for mapping task views to tasks.
Base-class for propagators.
ModEventDelta med
A set of modification events (used during propagation)
Propagator(Home home)
Constructor for posting.
int ModEventDelta
Modification event deltas.
void sort(TaskViewArray< TaskView > &t)
Sort task view array t according to sto and inc (increasing or decreasing)
ExecStatus purge(Space &home, Propagator &p, TaskArray< OptTask > &t)
Purge optional tasks that are excluded and possibly rewrite propagator.
SortTaskOrder
How to sort tasks.
@ STO_ECT
Sort by earliest completion times.
@ STO_EST
Sort by earliest start times.
@ STO_LST
Sort by latest start times.
@ STO_LCT
Sort by latest completion times.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
int plus(int x, int y)
Safe addition in case x is -Int::Limits::infinity.
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const IdxViewArray< View > &x)
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
Post propagator for SetVar SetOpType SetVar y
int PropCond
Type for propagation conditions.
Post propagator for SetVar x
int ModEvent
Type for modification events.