Generated on Fri Jan 28 2022 04:43:06 for Gecode by doxygen 1.8.13
cumulatives.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Mikael Lagerkvist <lagerkvist@gecode.org>
5  *
6  * Copyright:
7  * Mikael Lagerkvist, 2005
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32  */
33 
34 #ifndef __GECODE_INT_CUMULATIVES_HH__
35 #define __GECODE_INT_CUMULATIVES_HH__
36 
37 #include <gecode/int.hh>
38 
39 namespace Gecode { namespace Int { namespace Cumulatives {
40 
85  template<class ViewM, class ViewP, class ViewU, class View>
86  class Val : public Propagator {
87  protected:
94  const bool at_most;
95 
97  Val(Home home, const ViewArray<ViewM>&, const ViewArray<View>&,
98  const ViewArray<ViewP>&, const ViewArray<View>&,
99  const ViewArray<ViewU>&, const SharedArray<int>&, bool);
100 
101  ExecStatus prune(Space& home, int low, int up, int r,
102  int ntask, int su,
103  int* contribution,
104  int* prune_tasks, int& prune_tasks_size);
105  public:
107  virtual Actor* copy(Space& home);
109  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
111  virtual void reschedule(Space& home);
113  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
115  static ExecStatus post(Home home, const ViewArray<ViewM>&,
116  const ViewArray<View>&, const ViewArray<ViewP>&,
117  const ViewArray<View>&, const ViewArray<ViewU>&,
118  const SharedArray<int>&, bool);
120  virtual size_t dispose(Space& home);
121  };
122 
123 
124 }}}
125 
127 
128 #endif
129 
130 // STATISTICS: int-prop
131 
ExecStatus prune(Space &home, int low, int up, int r, int ntask, int su, int *contribution, int *prune_tasks, int &prune_tasks_size)
Definition: val.hpp:168
Base-class for propagators.
Definition: core.hpp:1023
static ExecStatus post(Home home, const ViewArray< ViewM > &, const ViewArray< View > &, const ViewArray< ViewP > &, const ViewArray< View > &, const ViewArray< ViewU > &, const SharedArray< int > &, bool)
Post propagator.
Definition: val.hpp:69
Computation spaces.
Definition: core.hpp:1701
Base-class for both propagators and branchers.
Definition: core.hpp:627
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1034
virtual size_t dispose(Space &home)
Dispose propagator.
Definition: val.hpp:91
Val(Space &home, Val< ViewM, ViewP, ViewU, View > &p)
Definition: val.hpp:79
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: val.hpp:271
Propagator for the cumulatives constraint
Definition: cumulatives.hh:86
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low quadratic)
Definition: val.hpp:107
Propagation cost.
Definition: core.hpp:485
ExecStatus
Definition: core.hpp:471
virtual void reschedule(Space &home)
Schedule function.
Definition: val.hpp:113
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
virtual Actor * copy(Space &home)
Create copy during cloning.
Definition: val.hpp:123