Generated on Fri Jun 2 2017 20:49:43 for Gecode by doxygen 1.8.13
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 
386  valselcommit(Space& home, const SetValBranch& svb);
387 
391  valselcommit(Space& home, const SetAssign& ia);
392 
393 }}}
394 
395 #endif
396 
397 // STATISTICS: set-branch
398 
No-good literal for inclusion.
Definition: branch.hh:282
Which values to select for branching first.
Definition: set.hh:1382
Merit class for size over afc.
Definition: branch.hh:138
Merit class for maximum of set view.
Definition: branch.hh:90
Value selection class for median of view.
Definition: branch.hh:242
MeritMin(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:48
int operator()(const Space &home, SetView x, int i)
Return minimum as merit for view x at position i.
Definition: merit.hpp:54
Value selection class for mimimum of view.
Definition: branch.hh:210
Abstract class for view selection.
Status
The status of a no-good literal.
Definition: core.hpp:977
Value commit class for exclusion.
Definition: branch.hh:362
int ModEvent
Type for modification events.
Definition: core.hpp:146
Base-class for merit class.
Computation spaces.
Definition: core.hpp:1362
ExecStatus prune(Space &home, ViewArray< VX > &x, ConstIntView)
Definition: rel.hpp:245
Base class for value selection and commit.
Base class for value commit.
Merit class for size over activity.
Definition: branch.hh:161
Gecode::IntArgs i(4, 1, 2, 3, 4)
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:44
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
ViewSel< SetView > * viewsel(Space &home, const SetVarBranch &svb)
Return view selectors for set views.
Definition: view-sel.cpp:43
AFC afc
AFC information.
Definition: branch.hh:141
ValSelCommitBase< SetView, int > * valselcommit(Space &home, const SetValBranch &svb)
Return value and commit for set views.
No-good literal for exclusion.
Definition: branch.hh:300
struct Gecode::@519::NNF::@60::@62 a
For atomic nodes.
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Set view for set variables
Definition: view.hpp:60
void print(std::basic_ostream< Char, Traits > &s, bool assigned, IL &lb, IU &ub, unsigned int cardMin, unsigned int cardMax)
Print set view.
Definition: print.hpp:67
Value branching information.
Definition: branch-val.hpp:44
Merit class for size of set view.
Definition: branch.hh:106
Variable branching information.
Definition: branch-var.hpp:55
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Value commit class for inclusion.
Definition: branch.hh:341
ExecStatus
Definition: core.hpp:523
Merit class for size over degree.
Definition: branch.hh:122
View-value no-good literal.
Value selection class for maximum of view.
Definition: branch.hh:226
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
Definition: view.hpp:662
Which value to select for assignment.
Definition: set.hh:1452
Gecode toplevel namespace
void dispose(Space &home)
Delete view merit class.
Which variable to select for branching.
Definition: set.hh:1253
Random number generator.
Definition: rnd.hpp:46
Activity activity
Activity information.
Definition: branch.hh:164
Class for activity management.
Definition: activity.hpp:44
Value selection class for random value of view.
Definition: branch.hh:258
#define GECODE_SET_EXPORT
Definition: set.hh:69
Merit class for mimimum of set views.
Definition: branch.hh:74
Rnd r
The used random number generator.
Definition: branch.hh:261
Base class for value selection.
No-good literal recorded during search.
Definition: core.hpp:971