Go to the documentation of this file.
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);
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++)
487 :
ViewSel<View>(home,vb),
r(vb.rnd()) {}
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>
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++)
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++)
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++)
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++)
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>
724 template<
class Choose,
class Merit>
729 Val w = m(home,
x[s],s);
731 for (
int i=s+1;
i<
x.size();
i++)
741 double l =
tbl()(home,
static_cast<double>(w),
static_cast<double>(
b));
743 if (!
c(
l,
static_cast<double>(w))) {
745 for (
int i=s;
i<
x.size();
i++)
751 if (
c(
l,
static_cast<double>(
b)))
752 l =
static_cast<double>(
b);
755 for (
int i=s;
i<
x.size();
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++)
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++)
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>
virtual ~ViewSel(void)
Unused destructor.
virtual int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting at s and return its position.
Post propagator for SetVar x
Select view with least merit taking tie-break limit into account.
Select the first unassigned view.
Class withot a branch filter function.
virtual int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting from s and return its position.
bool operator()(Val a, Val b) const
Return true if a is better than b.
ViewSelChoose< Choose, Merit >::Val Val
bool assigned(View x, int v)
Whether x is assigned to value v.
ViewSelChoose(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
Gecode::IntArgs i(4, 1, 2, 3, 4)
ViewSelMinTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
ViewSelChoose< Choose, Merit >::Var Var
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)=0
Select ties from x starting from s.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)=0
Break ties in x and update to new ties.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
virtual void dispose(Space &home)
Dispose view selection.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
#define GECODE_VALID_FUNCTION(f)
Assert that a function is valid.
Merit m
The merit object used.
Variable branching information.
Gecode toplevel namespace
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
ViewSelMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
Node * x
Pointer to corresponding Boolean expression node.
ViewSelMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Select view with largest merit.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
ViewSel< typename Merit::View >::Var Var
virtual int select(Space &home, ViewArray< View > &x, int s)=0
Select a view from x starting from s and return its position.
ViewSelChooseTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
#define GECODE_NEVER
Assert that this command is never executed.
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
ViewSelRnd(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
Choose views with smaller merit values.
ViewSelChoose< Choose, Merit >::View View
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
Class storing a branch filter function.
Rnd r
The random number generator used.
Abstract class for view selection.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting at s.
Exception: invalid function
Choose views with larger merit values.
Choose view according to merit taking tie-break limit into account.
bool shared(const IntSet &, VX)
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
Select view with largest merit taking tie-break limit into account.
Merit::Val Val
Type of merit.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
virtual void dispose(Space &home)
Delete view selection.
ViewSel< typename Merit::View >::View View
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
SharedData< BranchTbl > tbl
Tie-break limit function.
Gecode::FloatVal c(-8, 8)
virtual int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting from s and return its position.
View::VarType Var
The corresponding variable type.
Select view with least merit.
int n
Number of negative literals for node type.
ViewSelNone(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
ViewSelMaxTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
int p
Number of positive literals for node type.
virtual ViewSel< View > * copy(Space &home, bool shared)=0
Create copy during cloning.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
_View View
Define the view type.
ViewSel(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
bool operator()(Val a, Val b) const
Return true if a is better than b.
Choose view according to merit.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
virtual void dispose(Space &home)
Delete view selection.