Generated on Thu Jan 20 2022 00:00:00 for Gecode by doxygen 1.9.1
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  * Christian Schulte <schulte@gecode.org>
5  *
6  * Contributing authors:
7  * Samuel Gagnon <samuel.gagnon92@gmail.com>
8 
9  * Copyright:
10  * Christian Schulte, 2012
11  * Samuel Gagnon, 2018
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #ifndef __GECODE_INT_BRANCH_HH__
39 #define __GECODE_INT_BRANCH_HH__
40 
41 #include <gecode/int.hh>
42 
48 namespace Gecode { namespace Int { namespace Branch {
49 
68  template<class View>
69  class MeritMin : public MeritBase<View,int> {
70  public:
71  using typename MeritBase<View,int>::Var;
73  MeritMin(Space& home, const VarBranch<Var>& vb);
75  MeritMin(Space& home, MeritMin& m);
77  int operator ()(const Space& home, View x, int i);
78  };
79 
86  template<class View>
87  class MeritMax : public MeritBase<View,int> {
88  public:
89  using typename MeritBase<View,int>::Var;
91  MeritMax(Space& home, const VarBranch<Var>& vb);
93  MeritMax(Space& home, MeritMax& m);
95  int operator ()(const Space& home, View x, int i);
96  };
97 
104  template<class View>
105  class MeritSize : public MeritBase<View,unsigned int> {
106  public:
107  using typename MeritBase<View,unsigned int>::Var;
109  MeritSize(Space& home, const VarBranch<Var>& vb);
111  MeritSize(Space& home, MeritSize& m);
113  unsigned int operator ()(const Space& home, View x, int i);
114  };
115 
122  template<class View>
123  class MeritDegreeSize : public MeritBase<View,double> {
124  public:
125  using typename MeritBase<View,double>::Var;
131  double operator ()(const Space& home, View x, int i);
132  };
133 
140  template<class View>
141  class MeritAFCSize : public MeritBase<View,double> {
142  using typename MeritBase<View,double>::Var;
143  protected:
146  public:
148  MeritAFCSize(Space& home, const VarBranch<Var>& vb);
150  MeritAFCSize(Space& home, MeritAFCSize& m);
152  double operator ()(const Space& home, View x, int i);
154  bool notice(void) const;
156  void dispose(Space& home);
157  };
158 
165  template<class View>
166  class MeritActionSize : public MeritBase<View,double> {
167  using typename MeritBase<View,double>::Var;
168  protected:
171  public:
177  double operator ()(const Space& home, View x, int i);
179  bool notice(void) const;
181  void dispose(Space& home);
182  };
183 
190  template<class View>
191  class MeritCHBSize : public MeritBase<View,double> {
192  using typename MeritBase<View,double>::Var;
193  protected:
196  public:
198  MeritCHBSize(Space& home, const VarBranch<Var>& vb);
200  MeritCHBSize(Space& home, MeritCHBSize& m);
202  double operator ()(const Space& home, View x, int i);
204  bool notice(void) const;
206  void dispose(Space& home);
207  };
208 
215  template<class View>
216  class MeritRegretMin : public MeritBase<View,unsigned int> {
217  public:
218  using typename MeritBase<View,unsigned int>::Var;
224  unsigned int operator ()(const Space& home, View x, int i);
225  };
226 
233  template<class View>
234  class MeritRegretMax : public MeritBase<View,unsigned int> {
235  public:
236  using typename MeritBase<View,unsigned int>::Var;
242  unsigned int operator ()(const Space& home, View x, int i);
243  };
244 
245 }}}
246 
248 
249 namespace Gecode { namespace Int { namespace Branch {
250 
253  ViewSel<IntView>* viewsel(Space& home, const IntVarBranch& ivb);
256  ViewSel<BoolView>* viewsel(Space& home, const BoolVarBranch& bvb);
257 
258 }}}
259 
260 namespace Gecode { namespace Int { namespace Branch {
261 
280  template<class View>
281  class ValSelMin : public ValSel<View,int> {
282  public:
283  using typename ValSel<View,int>::Var;
285  ValSelMin(Space& home, const ValBranch<Var>& vb);
287  ValSelMin(Space& home, ValSelMin& vs);
289  int val(const Space& home, View x, int i);
290  };
291 
298  template<class View>
299  class ValSelMax : public ValSel<View,int> {
300  public:
301  using typename ValSel<View,int>::Var;
303  ValSelMax(Space& home, const ValBranch<Var>& vb);
305  ValSelMax(Space& home, ValSelMax& vs);
307  int val(const Space& home, View x, int i);
308  };
309 
316  template<class View>
317  class ValSelMed : public ValSel<View,int> {
318  public:
319  using typename ValSel<View,int>::Var;
321  ValSelMed(Space& home, const ValBranch<Var>& vb);
323  ValSelMed(Space& home, ValSelMed& vs);
325  int val(const Space& home, View x, int i);
326  };
327 
334  template<class View>
335  class ValSelAvg : public ValSel<View,int> {
336  public:
337  using typename ValSel<View,int>::Var;
339  ValSelAvg(Space& home, const ValBranch<Var>& vb);
341  ValSelAvg(Space& home, ValSelAvg& vs);
343  int val(const Space& home, View x, int i);
344  };
345 
352  template<class View>
353  class ValSelRnd : public ValSel<View,int> {
354  using typename ValSel<View,int>::Var;
355  protected:
358  public:
360  ValSelRnd(Space& home, const ValBranch<Var>& vb);
362  ValSelRnd(Space& home, ValSelRnd& vs);
364  int val(const Space& home, View x, int i);
366  bool notice(void) const;
368  void dispose(Space& home);
369  };
370 
377  class ValSelRangeMin : public ValSel<IntView,int> {
378  public:
380  ValSelRangeMin(Space& home, const ValBranch<IntVar>& vb);
382  ValSelRangeMin(Space& home, ValSelRangeMin& vs);
384  int val(const Space& home, IntView x, int i);
385  };
386 
393  class ValSelRangeMax : public ValSel<IntView,int> {
394  public:
396  ValSelRangeMax(Space& home, const ValBranch<IntVar>& vb);
398  ValSelRangeMax(Space& home, ValSelRangeMax& vs);
400  int val(const Space& home, IntView x, int i);
401  };
402 
403 }}}
404 
406 
407 namespace Gecode { namespace Int { namespace Branch {
408 
410  template<class View>
411  class EqNGL : public ViewValNGL<View,int,PC_INT_VAL> {
414  public:
416  EqNGL(Space& home, View x, int n);
418  EqNGL(Space& home, EqNGL& ngl);
420  virtual NGL::Status status(const Space& home) const;
422  virtual ExecStatus prune(Space& home);
424  virtual NGL* copy(Space& home);
425  };
426 
428  template<class View>
429  class NqNGL : public ViewValNGL<View,int,PC_INT_DOM> {
432  public:
434  NqNGL(Space& home, View x, int n);
436  NqNGL(Space& home, NqNGL& ngl);
438  virtual NGL::Status status(const Space& home) const;
440  virtual ExecStatus prune(Space& home);
442  virtual NGL* copy(Space& home);
443  };
444 
446  template<class View>
447  class LqNGL : public ViewValNGL<View,int,PC_INT_BND> {
450  public:
452  LqNGL(Space& home, View x, int n);
454  LqNGL(Space& home, LqNGL& ngl);
456  virtual NGL::Status status(const Space& home) const;
458  virtual ExecStatus prune(Space& home);
460  virtual NGL* copy(Space& home);
461  };
462 
464  template<class View>
465  class GqNGL : public ViewValNGL<View,int,PC_INT_BND> {
468  public:
470  GqNGL(Space& home, View x, int n);
472  GqNGL(Space& home, GqNGL& ngl);
474  virtual NGL::Status status(const Space& home) const;
476  virtual ExecStatus prune(Space& home);
478  virtual NGL* copy(Space& home);
479  };
480 
481 }}}
482 
483 #include <gecode/int/branch/ngl.hpp>
484 
485 namespace Gecode { namespace Int { namespace Branch {
486 
505  template<class View>
506  class ValCommitEq : public ValCommit<View,int> {
507  public:
508  using typename ValCommit<View,int>::Var;
510  ValCommitEq(Space& home, const ValBranch<Var>& vb);
512  ValCommitEq(Space& home, ValCommitEq& vc);
514  ModEvent commit(Space& home, unsigned int a, View x, int i, int n);
516  NGL* ngl(Space& home, unsigned int a, View x, int n) const;
518  void print(const Space& home, unsigned int a, View x, int i, int n,
519  std::ostream& o) const;
520  };
521 
528  template<class View>
529  class ValCommitLq : public ValCommit<View,int> {
530  public:
531  using typename ValCommit<View,int>::Var;
533  ValCommitLq(Space& home, const ValBranch<Var>& vb);
535  ValCommitLq(Space& home, ValCommitLq& vc);
537  ModEvent commit(Space& home, unsigned int a, View x, int i, int n);
539  NGL* ngl(Space& home, unsigned int a, View x, int n) const;
541  void print(const Space& home, unsigned int a, View x, int i, int n,
542  std::ostream& o) const;
543  };
544 
551  template<class View>
552  class ValCommitGq : public ValCommit<View,int> {
553  public:
554  using typename ValCommit<View,int>::Var;
556  ValCommitGq(Space& home, const ValBranch<Var>& vb);
558  ValCommitGq(Space& home, ValCommitGq& vc);
560  ModEvent commit(Space& home, unsigned int a, View x, int i, int n);
562  NGL* ngl(Space& home, unsigned int a, View x, int n) const;
564  void print(const Space& home, unsigned int a, View x, int i, int n,
565  std::ostream& o) const;
566  };
567 
574  template<class View>
575  class ValCommitGr : public ValCommit<View,int> {
576  public:
577  using typename ValCommit<View,int>::Var;
579  ValCommitGr(Space& home, const ValBranch<Var>& vb);
581  ValCommitGr(Space& home, ValCommitGr& vc);
583  ModEvent commit(Space& home, unsigned int a, View x, int i, int n);
585  NGL* ngl(Space& home, unsigned int a, View x, int n) const;
587  void print(const Space& home, unsigned int a, View x, int i, int n,
588  std::ostream& o) const;
589  };
590 
591 }}}
592 
594 
595 namespace Gecode { namespace Int { namespace Branch {
596 
599  ValSelCommitBase<IntView,int>*
600  valselcommit(Space& home, const IntValBranch& ivb);
601 
604  ValSelCommitBase<BoolView,int>*
605  valselcommit(Space& home, const BoolValBranch& bvb);
606 
609  ValSelCommitBase<IntView,int>*
610  valselcommit(Space& home, const IntAssign& ia);
611 
614  ValSelCommitBase<BoolView,int>*
615  valselcommit(Space& home, const BoolAssign& ba);
616 
617 }}}
618 
619 namespace Gecode { namespace Int { namespace Branch {
620 
625  template<int n, bool min, class Filter, class Print>
626  class ViewValuesBrancher : public ViewBrancher<IntView,Filter,n> {
627  protected:
631  Print p;
637  IntBranchFilter bf,
638  IntVarValPrint vvp);
639  public:
641  virtual const Choice* choice(Space& home);
643  virtual const Choice* choice(const Space& home, Archive& e);
645  virtual ExecStatus commit(Space& home, const Choice& c, unsigned int a);
647  virtual NGL* ngl(Space& home, const Choice& c, unsigned int a) const;
655  virtual void print(const Space& home, const Choice& c, unsigned int a,
656  std::ostream& o) const;
658  virtual Actor* copy(Space& home);
660  static void post(Home home, ViewArray<IntView>& x,
662  IntBranchFilter bf,
663  IntVarValPrint vvp);
665  virtual size_t dispose(Space& home);
666  };
667 
669  template<int n, bool min>
671  ViewSel<IntView>* vs[n],
672  IntBranchFilter bf,
673  IntVarValPrint vvp);
674 
675 }}}
676 
678 
679 #ifdef GECODE_HAS_CBS
680 
681 namespace Gecode { namespace Int { namespace Branch {
682 
687  template<class View>
688  class CBSBrancher : public Brancher {
689  private:
691  ViewArray<View> x;
692 
700  class VarIdToPos : public SharedHandle {
701  protected:
702  class VarIdToPosO : public SharedHandle::Object {
703  public:
705  std::unordered_map<unsigned int, unsigned int> _varIdToPos;
706  public:
708  VarIdToPosO(void) = default;
710  virtual ~VarIdToPosO(void) = default;
711  };
712  public:
714  VarIdToPos(void) = default;
716  void init(void);
718  bool isIn(unsigned int var_id) const;
720  int operator[](unsigned int var_id) const;
722  void insert(unsigned int var_id, unsigned int pos);
723  } varIdToPos;
724 
733  struct PropInfo {
735  unsigned int domsum;
737  unsigned int var_id;
739  int val;
741  double dens;
743  bool visited;
744  };
745 
756  std::unordered_map<unsigned int, PropInfo,
757  std::hash<unsigned int>,
758  std::equal_to<unsigned int>,
759  space_allocator<std::pair<const unsigned int, PropInfo>>>
760  logProp;
761 
762  public:
764  CBSBrancher(Home home, ViewArray<View>& x0);
766  CBSBrancher(Space& home, CBSBrancher& b);
768  static void post(Home home, ViewArray<View>& x);
770  virtual Actor* copy(Space& home);
772  virtual size_t dispose(Space& home);
774  virtual bool status(const Space& home) const;
776  virtual const Choice* choice(Space& home);
778  virtual const Choice* choice(const Space&, Archive& e);
780  virtual ExecStatus commit(Space& home, const Choice& c, unsigned int a);
782  virtual void print(const Space& home, const Choice& c, unsigned int a,
783  std::ostream& o) const;
784  private:
786  bool inbrancher(unsigned int varId) const;
787  };
788 
789 }}}
790 
791 #include <gecode/int/branch/cbs.hpp>
792 
793 #endif
794 
795 #endif
796 
797 // STATISTICS: int-branch
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:40
Class for action management.
Definition: action.hpp:42
Base-class for both propagators and branchers.
Definition: core.hpp:628
Archive representation
Definition: archive.hpp:42
Class for CHB management.
Definition: chb.hpp:46
Choice for performing commit
Definition: core.hpp:1412
Home class for posting propagators
Definition: core.hpp:856
No-good literal for equality.
Definition: branch.hh:411
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition: ngl.hpp:51
virtual NGL * copy(Space &home)
Create copy.
Definition: ngl.hpp:46
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition: ngl.hpp:59
EqNGL(Space &home, View x, int n)
Constructor for creation.
Definition: ngl.hpp:38
No-good literal for greater or equal.
Definition: branch.hh:465
virtual NGL * copy(Space &home)
Create copy.
Definition: ngl.hpp:132
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition: ngl.hpp:137
GqNGL(Space &home, View x, int n)
Constructor for creation.
Definition: ngl.hpp:124
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition: ngl.hpp:147
No-good literal for less or equal.
Definition: branch.hh:447
virtual NGL * copy(Space &home)
Create copy.
Definition: ngl.hpp:102
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition: ngl.hpp:107
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition: ngl.hpp:117
LqNGL(Space &home, View x, int n)
Constructor for creation.
Definition: ngl.hpp:94
Merit class for AFC over size.
Definition: branch.hh:141
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:122
AFC afc
AFC information.
Definition: branch.hh:145
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:117
double operator()(const Space &home, View x, int i)
Return AFC over size as merit for view x at position i.
Definition: merit.hpp:112
MeritAFCSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Merit class for action over size.
Definition: branch.hh:166
Action action
Action information.
Definition: branch.hh:170
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:144
MeritActionSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
double operator()(const Space &home, View x, int i)
Return action over size as merit for view x at position i.
Definition: merit.hpp:139
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:149
Merit class for CHB over size.
Definition: branch.hh:191
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:175
double operator()(const Space &home, View x, int i)
Return size over action as merit for view x at position i.
Definition: merit.hpp:165
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:170
CHB chb
CHB information.
Definition: branch.hh:195
MeritCHBSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Merit class for degree over size.
Definition: branch.hh:123
double operator()(const Space &home, View x, int i)
Return degree over size as merit for view x at position i.
Definition: merit.hpp:96
MeritDegreeSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Merit class for maximum.
Definition: branch.hh:87
MeritMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
int operator()(const Space &home, View x, int i)
Return maximum as merit for view x at position i.
Definition: merit.hpp:64
Merit class for mimimum of integer views.
Definition: branch.hh:69
MeritMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
int operator()(const Space &home, View x, int i)
Return minimum as merit for view x at position i.
Definition: merit.hpp:48
Merit class for maximum regret.
Definition: branch.hh:234
MeritRegretMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
unsigned int operator()(const Space &home, View x, int i)
Return maximum regret as merit for view x at position i.
Definition: merit.hpp:207
Merit class for minimum regret.
Definition: branch.hh:216
MeritRegretMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
unsigned int operator()(const Space &home, View x, int i)
Return minimum regret as merit for view x at position i.
Definition: merit.hpp:191
Merit class for size.
Definition: branch.hh:105
MeritSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
unsigned int operator()(const Space &home, View x, int i)
Return size as merit for view x at position i.
Definition: merit.hpp:80
No-good literal for disequality.
Definition: branch.hh:429
NqNGL(Space &home, View x, int n)
Constructor for creation.
Definition: ngl.hpp:66
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition: ngl.hpp:87
virtual NGL * copy(Space &home)
Create copy.
Definition: ngl.hpp:74
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition: ngl.hpp:79
Value commit class for equality.
Definition: branch.hh:506
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:52
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:47
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:60
ValCommitEq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Value commit class for greater or equal.
Definition: branch.hh:552
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:120
ValCommitGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:112
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:107
Value commit class for greater.
Definition: branch.hh:575
ValCommitGr(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:137
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:150
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:142
Value commit class for less or equal.
Definition: branch.hh:529
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:90
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:82
ValCommitLq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:77
Value selection class for average of view.
Definition: branch.hh:335
ValSelAvg(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
int val(const Space &home, View x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:92
Value selection class for maximum of view.
Definition: branch.hh:299
int val(const Space &home, View x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:62
ValSelMax(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Value selection class for median of view.
Definition: branch.hh:317
ValSelMed(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
int val(const Space &home, View x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:77
Value selection class for mimimum of view.
Definition: branch.hh:281
ValSelMin(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
int val(const Space &home, View x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:47
Value selection class for maximum range of integer view.
Definition: branch.hh:393
int val(const Space &home, IntView x, int i)
Return value of integer view x at position i.
Definition: val-sel.hpp:153
ValSelRangeMax(Space &home, const ValBranch< IntVar > &vb)
Constructor for initialization.
Definition: val-sel.hpp:147
Value selection class for minimum range of integer view.
Definition: branch.hh:377
int val(const Space &home, IntView x, int i)
Return value of integer view x at position i.
Definition: val-sel.hpp:137
ValSelRangeMin(Space &home, const ValBranch< IntVar > &vb)
Constructor for initialization.
Definition: val-sel.hpp:131
Value selection class for random value of view.
Definition: branch.hh:353
int val(const Space &home, View x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:108
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: val-sel.hpp:120
Rnd r
The used random number generator.
Definition: branch.hh:357
ValSelRnd(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
void dispose(Space &home)
Delete value selection.
Definition: val-sel.hpp:125
Brancher by view and values selection
Definition: branch.hh:626
virtual void print(const Space &home, const Choice &c, unsigned int a, std::ostream &o) const
Print branch for choice c and alternative a.
ViewValuesBrancher(Space &home, ViewValuesBrancher &b)
Constructor for cloning b.
virtual Actor * copy(Space &home)
Perform cloning.
static void post(Home home, ViewArray< IntView > &x, ViewSel< IntView > *vs[n], IntBranchFilter bf, IntVarValPrint vvp)
Post function for creation.
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int a)
Perform commit for choice c and alternative a.
virtual const Choice * choice(Space &home)
Return choice.
virtual size_t dispose(Space &home)
Delete brancher and return its size.
virtual NGL * ngl(Space &home, const Choice &c, unsigned int a) const
Create no-good literal for choice c and alternative a.
Integer view for integer variables.
Definition: view.hpp:129
Base-class for merit class.
Definition: merit.hpp:46
No-good literal recorded during search.
Definition: core.hpp:1340
Status
The status of a no-good literal.
Definition: core.hpp:1346
Random number generator.
Definition: rnd.hpp:42
Computation spaces.
Definition: core.hpp:1742
Value branching information.
Definition: val.hpp:41
Base class for value commit.
Definition: val-commit.hpp:44
Base class for value selection.
Definition: val-sel.hpp:44
Variable branching information.
Definition: var.hpp:55
View arrays.
Definition: array.hpp:253
Generic brancher by view selection.
Definition: view.hpp:78
ViewArray< IntView > x
Views to branch on.
Definition: view.hpp:83
ViewSel< IntView > * vs[n]
View selection objects.
Definition: view.hpp:87
Abstract class for view selection.
Definition: view-sel.hpp:44
View-value no-good literal.
Definition: view-val.hpp:61
ExecStatus
Definition: core.hpp:472
int ModEvent
Type for modification events.
Definition: core.hpp:62
#define GECODE_INT_EXPORT
Definition: int.hh:81
std::function< void(const Space &home, const Brancher &b, unsigned int a, IntVar x, int i, const int &n, std::ostream &o)> IntVarValPrint
Function type for printing branching alternatives for integer variables.
Definition: int.hh:4552
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Definition: post.cpp:238
std::function< bool(const Space &home, IntVar x, int i)> IntBranchFilter
Branch filter function type for integer variables.
Definition: int.hh:4176
void print(const Search::Statistics &stat, bool restart)
Print statistics.
Definition: job-shop.cpp:606
bool pos(const View &x)
Test whether x is postive.
Definition: mult.hpp:41
ViewSel< IntView > * viewsel(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition: view-sel.cpp:39
void postviewvaluesbrancher(Home home, ViewArray< IntView > &x, ViewSel< IntView > *vs[n], IntBranchFilter bf, IntVarValPrint vvp)
Post brancher for view and values.
ValSelCommitBase< IntView, int > * valselcommit(Space &home, const IntValBranch &ivb)
Return value and commit for integer views.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i({1, 2, 3, 4})