53 typedef typename View::VarType
Var;
73 int*
ties,
int&
n) = 0;
84 int*
ties,
int&
n) = 0;
87 int*
ties,
int n) = 0;
94 virtual bool notice(
void)
const;
102 static void*
operator new(
size_t s,
Space& home);
105 static void operator delete(
void*
p,
Space& home);
107 static void operator delete(
void*
p);
197 bool operator ()(Val
a, Val
b)
const;
205 bool operator ()(Val
a, Val
b)
const;
209 template<
class Choose,
class Merit>
215 typedef typename Merit::Val
Val;
249 virtual bool notice(
void)
const;
258 template<
class Choose,
class Merit>
291 virtual bool notice(
void)
const;
299 template<
class Merit>
319 template<
class Merit>
339 template<
class Merit>
359 template<
class Merit>
419 return home.ralloc(s);
448 int j=0; ties[j++]=s;
449 for (
int i=s+1;
i<x.
size();
i++)
460 int j=0; ties[j++]=s;
461 for (
int i=s+1;
i<x.
size();
i++)
497 for (
int i=s+1;
i<x.
size();
i++)
511 for (
int i=s+1;
i<x.
size();
i++)
523 n=1; ties[0] =
select(home,x,s);
530 n=1; ties[0] =
select(home,x,s);
535 ties[0] = ties[
static_cast<int>(
r(static_cast<unsigned int>(n)))];
541 return ties[
static_cast<int>(
r(static_cast<unsigned int>(n)))];
562 template<
class Choose,
class Merit>
567 template<
class Choose,
class Merit>
571 :
ViewSel<
View>(home,shared,vs), m(home,shared,vs.m) {}
573 template<
class Choose,
class Merit>
578 Val b_m = m(home,x[s],s);
580 for (
int i=s+1;
i<x.
size();
i++)
582 Val mxi = m(home,x[
i],i);
590 template<
class Choose,
class Merit>
596 Val b_m = m(home,x[s],s);
598 for (
int i=s+1;
i<x.
size();
i++)
600 Val mxi = m(home,x[i],i);
608 template<
class Choose,
class Merit>
613 Val b = m(home,x[s],s);
614 int j=0; ties[j++]=s;
615 for (
int i=s+1;
i<x.
size();
i++)
617 Val mxi = m(home,x[
i],i);
620 j=0; ties[j++]=
i; b=mxi;
621 }
else if (mxi == b) {
631 template<
class Choose,
class Merit>
637 Val b = m(home,x[s],s);
638 int j=0; ties[j++]=s;
639 for (
int i=s+1;
i<x.
size();
i++)
641 Val mxi = m(home,x[i],i);
644 j=0; ties[j++]=
i; b=mxi;
645 }
else if (mxi == b) {
655 template<
class Choose,
class Merit>
660 Val b = m(home,x[ties[0]],ties[0]);
663 for (
int i=1;
i<
n;
i++) {
664 Val mxi = m(home,x[ties[
i]],ties[i]);
667 b=mxi; j=0; ties[j++]=ties[
i];
668 }
else if (mxi == b) {
678 template<
class Choose,
class Merit>
683 Val b_m = m(home,x[ties[0]],ties[0]);
684 for (
int i=1;
i<
n;
i++) {
685 Val mxi = m(home,x[ties[
i]],ties[i]);
687 b_i = ties[
i]; b_m = mxi;
693 template<
class Choose,
class Merit>
699 template<
class Choose,
class Merit>
706 template<
class Choose,
class Merit>
715 template<
class Choose,
class Merit>
721 tbl.update(home,shared,vs.
tbl);
724 template<
class Choose,
class Merit>
729 Val w = m(home,x[s],s);
731 for (
int i=s+1;
i<x.
size();
i++)
733 Val mxi = m(home,x[
i],i);
741 double l =
tbl()(home,
static_cast<double>(w),static_cast<double>(b));
743 if (!
c(l,static_cast<double>(w))) {
751 if (
c(l,static_cast<double>(b)))
752 l = static_cast<double>(b);
756 if (!x[
i].
assigned() && !
c(l,static_cast<double>(m(home,x[
i],i))))
764 template<
class Choose,
class Merit>
770 assert(
f(home,x[s],s));
771 Val w = m(home,x[s],s);
773 for (
int i=s+1;
i<x.
size();
i++)
775 Val mxi = m(home,x[i],i);
783 double l =
tbl()(home,
static_cast<double>(w),static_cast<double>(b));
785 if (!
c(l,static_cast<double>(w))) {
787 for (
int i=s; i<x.
size(); i++)
793 if (
c(l,static_cast<double>(b)))
794 l = static_cast<double>(b);
797 for (
int i=s; i<x.
size(); i++)
798 if (!x[i].
assigned() &&
f(home,x[i],i) &&
799 !
c(l,static_cast<double>(m(home,x[i],i))))
807 template<
class Choose,
class Merit>
812 Val w = m(home,x[ties[0]],ties[0]);
814 for (
int i=1;
i<
n;
i++) {
815 Val mxi = m(home,x[ties[
i]],ties[i]);
823 double l =
tbl()(home,
static_cast<double>(w),static_cast<double>(b));
826 if (
c(l,static_cast<double>(w))) {
828 if (
c(l,static_cast<double>(b)))
829 l =
static_cast<double>(
b);
832 for (
int i=0;
i<
n;
i++)
833 if (!
c(l,static_cast<double>(m(home,x[ties[
i]],ties[i]))))
840 template<
class Choose,
class Merit>
845 template<
class Choose,
class Merit>
853 template<
class Merit>
858 template<
class Merit>
864 template<
class Merit>
871 template<
class Merit>
876 template<
class Merit>
882 template<
class Merit>
890 template<
class Merit>
895 template<
class Merit>
901 template<
class Merit>
909 template<
class Merit>
914 template<
class Merit>
920 template<
class Merit>
Select view with largest merit.
ViewSelChoose< Choose, Merit >::Val Val
ViewSelNone(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting at s.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
virtual ~ViewSel(void)
Unused destructor.
Rnd r
The random number generator used.
bool operator()(Val a, Val b) const
Return true if a is better than b.
Class withot a branch filter function.
ViewSelMinTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Abstract class for view selection.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)=0
Select ties from x starting from s.
ViewSelMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
ViewSelChoose(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
Choose view according to merit taking tie-break limit into account.
Choose views with larger merit values.
Merit m
The merit object used.
bool shared(const IntSet &, VX)
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)=0
Break ties in x and update to new ties.
virtual int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting at s and return its position.
Select the first unassigned view.
Select view with least merit.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
virtual void dispose(Space &home)
Dispose view selection.
int p
Number of positive literals for node type.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Class storing a branch filter function.
Select view with largest merit taking tie-break limit into account.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
Choose view according to merit.
ViewSelMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
ViewSel< typename Merit::View >::Var Var
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
Select view with least merit taking tie-break limit into account.
virtual int select(Space &home, ViewArray< View > &x, int s)=0
Select a view from x starting from s and return its position.
Choose views with smaller merit values.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
Exception: invalid function
SharedData< BranchTbl > tbl
Tie-break limit function.
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
#define GECODE_VALID_FUNCTION(f)
Assert that a function is valid.
bool operator()(Val a, Val b) const
Return true if a is better than b.
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
Variable branching information.
Node * x
Pointer to corresponding Boolean expression node.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
ViewSelRnd(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
bool assigned(View x, int v)
Whether x is assigned to value v.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Post propagator for SetVar x
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
View::VarType Var
The corresponding variable type.
Merit::Val Val
Type of merit.
Gecode toplevel namespace
ViewSel< typename Merit::View >::View View
virtual int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting from s and return its position.
ViewSelChoose< Choose, Merit >::View View
int size(void) const
Return size of array (number of elements)
virtual ViewSel< View > * copy(Space &home, bool shared)=0
Create copy during cloning.
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
_View View
Define the view type.
ViewSel(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
#define GECODE_NEVER
Assert that this command is never executed.
virtual void dispose(Space &home)
Delete view selection.
ViewSelChoose< Choose, Merit >::Var Var
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
ViewSelMaxTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.