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;
92 static void*
operator new(
size_t s,
Space& home);
95 static void operator delete(
void*
p,
Space& home);
97 static void operator delete(
void*
p);
167 int*
ties,
int&
n, BranchFilter bf);
197 template<
class Choose,
class Merit>
203 typedef typename Merit::Val
Val;
228 int*
ties,
int&
n, BranchFilter bf);
236 virtual bool notice(
void)
const;
245 template<
class Choose,
class Merit>
271 int*
ties,
int&
n, BranchFilter bf);
278 template<
class Merit>
298 template<
class Merit>
318 template<
class Merit>
338 template<
class Merit>
382 return home.ralloc(s);
409 int j=0; ties[j++]=s;
410 for (
int i=s+1;
i<x.
size();
i++)
419 int* ties,
int&
n, BranchFilter bf) {
420 int j=0; ties[j++]=s;
421 for (
int i=s+1;
i<x.
size();
i++) {
422 typename View::VarType y(x[
i].varimp());
459 for (
int i=s+1;
i<x.
size();
i++)
472 for (
int i=s+1;
i<x.
size();
i++) {
473 typename View::VarType y(x[
i].varimp());
486 n=1; ties[0] = select(home,x,s);
491 int* ties,
int&
n, BranchFilter bf) {
492 n=1; ties[0] = select(home,x,s,bf);
497 ties[0] = ties[
static_cast<int>(
r(static_cast<unsigned int>(n)))];
503 return ties[
static_cast<int>(
r(static_cast<unsigned int>(n)))];
524 template<
class Choose,
class Merit>
529 template<
class Choose,
class Merit>
533 :
ViewSel<
View>(home,shared,vs), m(home,shared,vs.m) {}
535 template<
class Choose,
class Merit>
540 Val b_m = m(home,x[s],s);
542 for (
int i=s+1;
i<x.
size();
i++)
544 Val mxi = m(home,x[
i],i);
552 template<
class Choose,
class Merit>
558 Val b_m = m(home,x[s],s);
560 for (
int i=s+1;
i<x.
size();
i++) {
561 typename View::VarType y(x[
i].varimp());
563 Val mxi = m(home,x[
i],i);
572 template<
class Choose,
class Merit>
577 Val b = m(home,x[s],s);
578 int j=0; ties[j++]=s;
579 for (
int i=s+1;
i<x.
size();
i++)
581 Val mxi = m(home,x[
i],i);
584 j=0; ties[j++]=
i; b=mxi;
585 }
else if (mxi == b) {
595 template<
class Choose,
class Merit>
600 Val b = m(home,x[s],s);
601 int j=0; ties[j++]=s;
602 for (
int i=s+1;
i<x.
size();
i++) {
603 typename View::VarType y(x[
i].varimp());
605 Val mxi = m(home,x[
i],i);
608 j=0; ties[j++]=
i; b=mxi;
609 }
else if (mxi == b) {
620 template<
class Choose,
class Merit>
625 Val b = m(home,x[ties[0]],ties[0]);
628 for (
int i=1;
i<
n;
i++) {
629 Val mxi = m(home,x[ties[
i]],ties[i]);
632 b=mxi; j=0; ties[j++]=ties[
i];
633 }
else if (mxi == b) {
643 template<
class Choose,
class Merit>
648 Val b_m = m(home,x[ties[0]],ties[0]);
649 for (
int i=1;
i<
n;
i++) {
650 Val mxi = m(home,x[ties[
i]],ties[i]);
652 b_i = ties[
i]; b_m = mxi;
658 template<
class Choose,
class Merit>
664 template<
class Choose,
class Merit>
671 template<
class Choose,
class Merit>
677 template<
class Choose,
class Merit>
684 template<
class Choose,
class Merit>
689 Val w = m(home,x[s],s);
691 for (
int i=s+1;
i<x.
size();
i++)
693 Val mxi = m(home,x[
i],i);
700 double l =
tbl(home,static_cast<double>(w),static_cast<double>(b));
702 if (!
c(l,static_cast<double>(w))) {
710 if (
c(l,static_cast<double>(b)))
711 l = static_cast<double>(b);
715 if (!x[
i].
assigned() && !
c(l,static_cast<double>(m(home,x[
i],i))))
723 template<
class Choose,
class Merit>
728 Val w = m(home,x[s],s);
730 for (
int i=s+1;
i<x.
size();
i++) {
731 typename View::VarType y(x[
i].varimp());
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))) {
745 for (
int i=s;
i<x.
size();
i++) {
746 typename View::VarType y(x[
i].varimp());
753 if (
c(l,static_cast<double>(b)))
754 l =
static_cast<double>(
b);
757 for (
int i=s;
i<x.
size();
i++) {
758 typename View::VarType y(x[
i].varimp());
760 !
c(l,static_cast<double>(m(home,x[
i],i))))
769 template<
class Choose,
class Merit>
774 Val w = m(home,x[ties[0]],ties[0]);
776 for (
int i=1;
i<
n;
i++) {
777 Val mxi = m(home,x[ties[
i]],ties[i]);
784 double l =
tbl(home,static_cast<double>(w),static_cast<double>(b));
787 if (
c(l,static_cast<double>(w))) {
789 if (
c(l,static_cast<double>(b)))
790 l =
static_cast<double>(
b);
793 for (
int i=0;
i<
n;
i++)
794 if (!
c(l,static_cast<double>(m(home,x[ties[
i]],ties[i]))))
804 template<
class Merit>
809 template<
class Merit>
815 template<
class Merit>
822 template<
class Merit>
827 template<
class Merit>
833 template<
class Merit>
841 template<
class Merit>
846 template<
class Merit>
852 template<
class Merit>
860 template<
class Merit>
865 template<
class Merit>
871 template<
class Merit>
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.
ViewSelChoose< Choose, Merit >::Val Val
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 at s.
virtual ViewSel< View > * copy(Space &home, bool shared)
Create copy during cloning.
ViewSelNone(Space &home, const VarBranch &vb)
Constructor for creation.
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.
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.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
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
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.
bool operator()(Val a, Val b) const
Return true if a is better than b.
Select view with least merit.
ViewSelMinTbl(Space &home, const VarBranch &vb)
Constructor for initialization.
bool operator()(Val a, Val b) const
Return true if a is better than b.
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.
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.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
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.
ViewSelChooseTbl(Space &home, const VarBranch &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.
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 bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
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 int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting from s and return its position.
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
int size(void) const
Return size of array (number of elements)
Merit::Val Val
Type of merit.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
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.
ViewSelMin(Space &home, const VarBranch &vb)
Constructor for initialization.
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.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
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.