~ubuntu-branches/ubuntu/natty/gecode/natty

« back to all changes in this revision

Viewing changes to int/cumulatives.hh

  • Committer: Bazaar Package Importer
  • Author(s): Kari Pahula
  • Date: 2005-12-24 07:51:25 UTC
  • Revision ID: james.westby@ubuntu.com-20051224075125-klkiqofvbfvusfvt
Tags: upstream-1.0.0.dfsg.1
ImportĀ upstreamĀ versionĀ 1.0.0.dfsg.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Main authors:
 
3
 *     Mikael Lagerkvist <lagerkvist@gecode.org>
 
4
 *
 
5
 *  Copyright:
 
6
 *     Mikael Lagerkvist, 2005
 
7
 *
 
8
 *  Last modified:
 
9
 *     $Date: 2005-08-09 17:26:38 +0200 (Tue, 09 Aug 2005) $ by $Author: schulte $
 
10
 *     $Revision: 2190 $
 
11
 *
 
12
 *  This file is part of Gecode, the generic constraint
 
13
 *  development environment:
 
14
 *     http://www.gecode.org
 
15
 *
 
16
 *  See the file "LICENSE" for information on usage and
 
17
 *  redistribution of this file, and for a
 
18
 *     DISCLAIMER OF ALL WARRANTIES.
 
19
 *
 
20
 */
 
21
 
 
22
/*
 
23
 */
 
24
 
 
25
#ifndef __GECODE_INT_CUMULATIVES_HH__
 
26
#define __GECODE_INT_CUMULATIVES_HH__
 
27
 
 
28
#include "int.hh"
 
29
 
 
30
#include "support/shared-array.hh"
 
31
#include <vector>
 
32
#include <list>
 
33
 
 
34
namespace Gecode { namespace Int { namespace Cumulatives {
 
35
 
 
36
  /** \namespace Gecode::Int::Cumulatives 
 
37
   *  \brief %Cumulatives propagators
 
38
   *
 
39
   * This namespace contains a propagator for the 
 
40
   * cumulatives constraint as presented in
 
41
   \verbatim
 
42
   @inproceedings{DBLP:conf/cp/BeldiceanuC02,
 
43
     author    = {Nicolas Beldiceanu and Mats Carlsson},
 
44
     title     = {A New Multi-resource cumulatives Constraint 
 
45
                  with Negative Heights.},
 
46
     booktitle = {CP},
 
47
     year      = {2002},
 
48
     pages     = {63-79},
 
49
     ee        = {http://link.springer.de/link/service/series/0558/
 
50
                  bibs/2470/24700063.htm},
 
51
     crossref  = {DBLP:conf/cp/2002},
 
52
     bibsource = {DBLP, http://dblp.uni-trier.de}
 
53
   }
 
54
   @proceedings{DBLP:conf/cp/2002,
 
55
     editor    = {Pascal Van Hentenryck},
 
56
     title     = {Principles and Practice of Constraint Programming - 
 
57
                  CP 2002, 8th International Conference, CP 2002, 
 
58
                  Ithaca, NY, USA, September 9-13, 2002, Proceedings},
 
59
     booktitle = {CP},
 
60
     publisher = {Springer},
 
61
     series    = {Lecture Notes in Computer Science},
 
62
     volume    = {2470},
 
63
     year      = {2002},
 
64
     isbn      = {3-540-44120-4},
 
65
     bibsource = {DBLP, http://dblp.uni-trier.de}
 
66
   }
 
67
   \endverbatim
 
68
   */
 
69
 
 
70
 
 
71
  /**
 
72
   * \brief %Propagator for the cumulatives constraint.
 
73
   *
 
74
   * This class implements Beldiceanu's and Carlsson's sweep-line
 
75
   * propagation algorithm for the cumulatives constraint.
 
76
   *
 
77
   * Requires \code #include "int/cumulatives.hh" \endcode
 
78
   * \ingroup FuncIntProp
 
79
   */
 
80
  template <class ViewM, class ViewD, class ViewH, class View>
 
81
  class Val : public Propagator {
 
82
    ViewArray<ViewM>  machine;
 
83
    ViewArray<View>   start;
 
84
    ViewArray<ViewD>  duration;
 
85
    ViewArray<View>   end;
 
86
    ViewArray<ViewH>  height;
 
87
    Support::SharedArray<int>  limit;
 
88
    const bool        at_most;
 
89
    const bool        cd_option;
 
90
 
 
91
    Val(Space* home, bool share, Val<ViewM, ViewD, ViewH, View>& p);
 
92
    Val(Space* home, const ViewArray<ViewM>&, const ViewArray<View>&,
 
93
        const ViewArray<ViewD>&, const ViewArray<View>&,
 
94
        const ViewArray<ViewH>&, const IntArgs&, bool);
 
95
 
 
96
    ExecStatus prune(Space * home, int low, int up, int r, 
 
97
                     int ntask, int sheight,
 
98
                     const std::vector<int>& contribution, 
 
99
                     std::list<int>& prune_tasks);
 
100
  public:
 
101
    virtual ~Val(void);
 
102
    virtual Actor*     copy(Space* home, bool share);
 
103
    virtual PropCost   cost(void) const;
 
104
    virtual ExecStatus propagate(Space* home);
 
105
    static  ExecStatus post(Space* home, const ViewArray<ViewM>&,
 
106
                            const ViewArray<View>&, const ViewArray<ViewD>&,
 
107
                            const ViewArray<View>&, const ViewArray<ViewH>&,
 
108
                            const IntArgs&, bool);
 
109
  };
 
110
 
 
111
 
 
112
}}}
 
113
 
 
114
#include "int/cumulatives/val.icc"
 
115
 
 
116
#endif
 
117
 
 
118
// STATISTICS: int-prop
 
119