Generated on Sat Nov 9 2013 19:18:25 for Gecode by doxygen 1.8.4
branch.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  * Christian Schulte <schulte@gecode.org>
6  *
7  * Contributing authors:
8  * Gabor Szokoli <szokoli@gecode.org>
9  *
10  * Copyright:
11  * Guido Tack, 2004
12  * Christian Schulte, 2004
13  * Gabor Szokoli, 2004
14  *
15  * Last modified:
16  * $Date: 2013-07-04 17:03:13 +0200 (Thu, 04 Jul 2013) $ by $Author: schulte $
17  * $Revision: 13801 $
18  *
19  * This file is part of Gecode, the generic constraint
20  * development environment:
21  * http://www.gecode.org
22  *
23  * Permission is hereby granted, free of charge, to any person obtaining
24  * a copy of this software and associated documentation files (the
25  * "Software"), to deal in the Software without restriction, including
26  * without limitation the rights to use, copy, modify, merge, publish,
27  * distribute, sublicense, and/or sell copies of the Software, and to
28  * permit persons to whom the Software is furnished to do so, subject to
29  * the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be
32  * included in all copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41  *
42  */
43 
44 #ifndef __GECODE_SET_BRANCH_HH__
45 #define __GECODE_SET_BRANCH_HH__
46 
47 #include <gecode/set.hh>
48 
54 namespace Gecode { namespace Set { namespace Branch {
55 
74  class MeritMin : public MeritBase<SetView,int> {
75  public:
77  MeritMin(Space& home, const VarBranch& vb);
79  MeritMin(Space& home, bool shared, MeritMin& m);
81  int operator ()(const Space& home, SetView x, int i);
82  };
83 
90  class MeritMax : public MeritBase<SetView,int> {
91  public:
93  MeritMax(Space& home, const VarBranch& vb);
95  MeritMax(Space& home, bool shared, MeritMax& m);
97  int operator ()(const Space& home, SetView x, int i);
98  };
99 
106  class MeritSize : public MeritBase<SetView,unsigned int> {
107  public:
109  MeritSize(Space& home, const VarBranch& vb);
111  MeritSize(Space& home, bool shared, MeritSize& m);
113  unsigned int operator ()(const Space& home, SetView x, int i);
114  };
115 
122  class MeritDegreeSize : public MeritBase<SetView,double> {
123  public:
125  MeritDegreeSize(Space& home, const VarBranch& vb);
127  MeritDegreeSize(Space& home, bool shared, MeritDegreeSize& m);
129  double operator ()(const Space& home, SetView x, int i);
130  };
131 
138  class MeritAFCSize : public MeritBase<SetView,double> {
139  protected:
142  public:
144  MeritAFCSize(Space& home, const VarBranch& vb);
146  MeritAFCSize(Space& home, bool shared, MeritAFCSize& m);
148  double operator ()(const Space& home, SetView x, int i);
150  bool notice(void) const;
152  void dispose(Space& home);
153  };
154 
161  class MeritActivitySize : public MeritBase<SetView,double> {
162  protected:
165  public:
167  MeritActivitySize(Space& home, const VarBranch& vb);
171  double operator ()(const Space& home, SetView x, int i);
173  bool notice(void) const;
175  void dispose(Space& home);
176  };
177 
178 }}}
179 
181 
182 namespace Gecode { namespace Set { namespace Branch {
183 
186  ViewSel<SetView>* viewsel(Space& home, const SetVarBranch& svb);
187 
188 }}}
189 
190 namespace Gecode { namespace Set { namespace Branch {
191 
210  class ValSelMin : public ValSel<SetView,int> {
211  public:
213  ValSelMin(Space& home, const ValBranch& vb);
215  ValSelMin(Space& home, bool shared, ValSelMin& vs);
217  int val(const Space& home, SetView x, int i);
218  };
219 
226  class ValSelMax : public ValSel<SetView,int> {
227  public:
229  ValSelMax(Space& home, const ValBranch& vb);
231  ValSelMax(Space& home, bool shared, ValSelMax& vs);
233  int val(const Space& home, SetView x, int i);
234  };
235 
242  class ValSelMed : public ValSel<SetView,int> {
243  public:
245  ValSelMed(Space& home, const ValBranch& vb);
247  ValSelMed(Space& home, bool shared, ValSelMed& vs);
249  int val(const Space& home, SetView x, int i);
250  };
251 
258  class ValSelRnd : public ValSel<SetView,int> {
259  protected:
262  public:
264  ValSelRnd(Space& home, const ValBranch& vb);
266  ValSelRnd(Space& home, bool shared, ValSelRnd& vs);
268  int val(const Space& home, SetView x, int i);
270  bool notice(void) const;
272  void dispose(Space& home);
273  };
274 
275 }}}
276 
278 
279 namespace Gecode { namespace Set { namespace Branch {
280 
282  class IncNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
283  public:
285  IncNGL(Space& home, SetView x, int n);
287  IncNGL(Space& home, bool share, IncNGL& ngl);
290  virtual NGL::Status status(const Space& home) const;
293  virtual ExecStatus prune(Space& home);
296  virtual NGL* copy(Space& home, bool share);
297  };
298 
300  class ExcNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
301  public:
303  ExcNGL(Space& home, SetView x, int n);
305  ExcNGL(Space& home, bool share, ExcNGL& ngl);
308  virtual NGL::Status status(const Space& home) const;
311  virtual ExecStatus prune(Space& home);
314  virtual NGL* copy(Space& home, bool share);
315  };
316 
317 }}}
318 
319 #include <gecode/set/branch/ngl.hpp>
320 
321 namespace Gecode { namespace Set { namespace Branch {
322 
341  class ValCommitInc : public ValCommit<SetView,int> {
342  public:
344  ValCommitInc(Space& home, const ValBranch& vb);
346  ValCommitInc(Space& home, bool shared, ValCommitInc& vc);
348  ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
350  NGL* ngl(Space& home, unsigned int a, View x, int n) const;
352  void print(const Space& home, unsigned int a, SetView x, int i, int n,
353  std::ostream& o) const;
354  };
355 
362  class ValCommitExc : public ValCommit<SetView,int> {
363  public:
365  ValCommitExc(Space& home, const ValBranch& vb);
367  ValCommitExc(Space& home, bool shared, ValCommitExc& vc);
369  ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
371  NGL* ngl(Space& home, unsigned int a, View x, int n) const;
373  void print(const Space& home, unsigned int a, SetView x, int i, int n,
374  std::ostream& o) const;
375  };
376 
377 }}}
378 
380 
381 namespace Gecode { namespace Set { namespace Branch {
382 
385  ValSelCommitBase<SetView,int>*
386  valselcommit(Space& home, const SetValBranch& svb);
387 
390  ValSelCommitBase<SetView,int>*
391  valselcommit(Space& home, const SetAssign& ia);
392 
393 }}}
394 
395 #endif
396 
397 // STATISTICS: set-branch
398