70 int*
ties,
int&
n) = 0;
73 int*
ties,
int&
n, BranchFilter bf) = 0;
76 int*
ties,
int&
n) = 0;
79 int*
ties,
int n) = 0;
86 virtual bool notice(
void)
const;
94 static void*
operator new(
size_t s,
Space& home);
97 static void operator delete(
void*
p,
Space& home);
99 static void operator delete(
void*
p);
169 int*
ties,
int&
n, BranchFilter bf);
187 bool operator ()(Val
a, Val
b)
const;
195 bool operator ()(Val
a, Val
b)
const;
199 template<
class Choose,
class Merit>
205 typedef typename Merit::Val
Val;
230 int*
ties,
int&
n, BranchFilter bf);
238 virtual bool notice(
void)
const;
247 template<
class Choose,
class Merit>
273 int*
ties,
int&
n, BranchFilter bf);
280 template<
class Merit>
300 template<
class Merit>
320 template<
class Merit>
340 template<
class Merit>
386 return home.ralloc(s);
413 int j=0; ties[j++]=s;
414 for (
int i=s+1;
i<x.
size();
i++)
423 int*
ties,
int&
n, BranchFilter bf) {
424 int j=0; ties[j++]=s;
425 for (
int i=s+1;
i<x.
size();
i++) {
426 typename View::VarType y(x[
i].varimp());
463 for (
int i=s+1;
i<x.
size();
i++)
476 for (
int i=s+1;
i<x.
size();
i++) {
477 typename View::VarType y(x[
i].varimp());
490 n=1; ties[0] =
select(home,x,s);
495 int*
ties,
int&
n, BranchFilter bf) {
496 n=1; ties[0] =
select(home,x,s,bf);
501 ties[0] = ties[
static_cast<int>(
r(static_cast<unsigned int>(n)))];
507 return ties[
static_cast<int>(
r(static_cast<unsigned int>(n)))];
528 template<
class Choose,
class Merit>
533 template<
class Choose,
class Merit>
537 :
ViewSel<
View>(home,shared,vs), m(home,shared,vs.m) {}
539 template<
class Choose,
class Merit>
544 Val b_m = m(home,x[s],s);
546 for (
int i=s+1;
i<x.
size();
i++)
548 Val mxi = m(home,x[
i],i);
556 template<
class Choose,
class Merit>
562 Val b_m = m(home,x[s],s);
564 for (
int i=s+1;
i<x.
size();
i++) {
565 typename View::VarType y(x[
i].varimp());
567 Val mxi = m(home,x[
i],i);
576 template<
class Choose,
class Merit>
581 Val b = m(home,x[s],s);
582 int j=0; ties[j++]=s;
583 for (
int i=s+1;
i<x.
size();
i++)
585 Val mxi = m(home,x[
i],i);
588 j=0; ties[j++]=
i; b=mxi;
589 }
else if (mxi == b) {
599 template<
class Choose,
class Merit>
604 Val b = m(home,x[s],s);
605 int j=0; ties[j++]=s;
606 for (
int i=s+1;
i<x.
size();
i++) {
607 typename View::VarType y(x[
i].varimp());
609 Val mxi = m(home,x[
i],i);
612 j=0; ties[j++]=
i; b=mxi;
613 }
else if (mxi == b) {
624 template<
class Choose,
class Merit>
629 Val b = m(home,x[ties[0]],ties[0]);
632 for (
int i=1;
i<
n;
i++) {
633 Val mxi = m(home,x[ties[
i]],ties[i]);
636 b=mxi; j=0; ties[j++]=ties[
i];
637 }
else if (mxi == b) {
647 template<
class Choose,
class Merit>
652 Val b_m = m(home,x[ties[0]],ties[0]);
653 for (
int i=1;
i<
n;
i++) {
654 Val mxi = m(home,x[ties[
i]],ties[i]);
656 b_i = ties[
i]; b_m = mxi;
662 template<
class Choose,
class Merit>
668 template<
class Choose,
class Merit>
675 template<
class Choose,
class Merit>
681 template<
class Choose,
class Merit>
688 template<
class Choose,
class Merit>
693 Val w = m(home,x[s],s);
695 for (
int i=s+1;
i<x.
size();
i++)
697 Val mxi = m(home,x[
i],i);
704 double l =
tbl(home,static_cast<double>(w),static_cast<double>(b));
706 if (!
c(l,static_cast<double>(w))) {
714 if (
c(l,static_cast<double>(b)))
715 l = static_cast<double>(b);
719 if (!x[
i].
assigned() && !
c(l,static_cast<double>(m(home,x[
i],i))))
727 template<
class Choose,
class Merit>
732 Val w = m(home,x[s],s);
734 for (
int i=s+1;
i<x.
size();
i++) {
735 typename View::VarType y(x[
i].varimp());
737 Val mxi = m(home,x[
i],i);
745 double l =
tbl(home,static_cast<double>(w),static_cast<double>(b));
747 if (!
c(l,static_cast<double>(w))) {
749 for (
int i=s;
i<x.
size();
i++) {
750 typename View::VarType y(x[
i].varimp());
757 if (
c(l,static_cast<double>(b)))
758 l =
static_cast<double>(
b);
761 for (
int i=s;
i<x.
size();
i++) {
762 typename View::VarType y(x[
i].varimp());
764 !
c(l,static_cast<double>(m(home,x[
i],i))))
773 template<
class Choose,
class Merit>
778 Val w = m(home,x[ties[0]],ties[0]);
780 for (
int i=1;
i<
n;
i++) {
781 Val mxi = m(home,x[ties[
i]],ties[i]);
788 double l =
tbl(home,static_cast<double>(w),static_cast<double>(b));
791 if (
c(l,static_cast<double>(w))) {
793 if (
c(l,static_cast<double>(b)))
794 l =
static_cast<double>(
b);
797 for (
int i=0;
i<
n;
i++)
798 if (!
c(l,static_cast<double>(m(home,x[ties[
i]],ties[i]))))
808 template<
class Merit>
813 template<
class Merit>
819 template<
class Merit>
826 template<
class Merit>
831 template<
class Merit>
837 template<
class Merit>
845 template<
class Merit>
850 template<
class Merit>
856 template<
class Merit>
864 template<
class Merit>
869 template<
class Merit>
875 template<
class Merit>
Select view with largest merit.
ViewSelChoose< Choose, Merit >::Val Val
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.
ViewSelNone(Space &home, const VarBranch &vb)
Constructor for creation.
virtual ~ViewSel(void)
Unused destructor.
ViewSel< typename Merit::View >::BranchFilter BranchFilter
Rnd r
The random number generator used.
ViewSelRnd(Space &home, const VarBranch &vb)
Constructor for creation.
ViewSel(Space &home, const VarBranch &vb)
Constructor for creation.
bool operator()(Val a, Val b) const
Return true if a is better than b.
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.
Choose view according to merit taking tie-break limit into account.
Choose views with larger merit values.
Merit m
The merit object used.
ViewSelChoose< Choose, Merit >::BranchFilter BranchFilter
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.
ViewSelMinTbl(Space &home, const VarBranch &vb)
Constructor for initialization.
Gecode::FloatVal c(-8, 8)
virtual void dispose(Space &home)
Dispose view selection.
struct Gecode::@554::NNF::@60::@62 a
For atomic nodes.
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.
ViewSelMaxTbl(Space &home, const VarBranch &vb)
Constructor for initialization.
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.
BranchTraits< typename View::VarType >::Filter BranchFilter
The branch filter that corresponds to the view type.
Choose view according to merit.
ViewSelMax(Space &home, const VarBranch &vb)
Constructor for initialization.
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.
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
bool operator()(Val a, Val b) const
Return true if a is better than b.
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.
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)
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
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
ViewSelChoose(Space &home, const VarBranch &vb)
Constructor for creation.
struct Gecode::@554::NNF::@60::@61 b
For binary nodes (and, or, eqv)
ViewSelMin(Space &home, const VarBranch &vb)
Constructor for initialization.
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.
virtual void dispose(Space &home)
Delete view selection.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
BranchTbl tbl
Tie-break limit function.
double(* BranchTbl)(const Space &home, double w, double b)
Tie-break limit function.