49 typedef typename View::VarType
Var;
69 int*
ties,
int&
n) = 0;
80 int*
ties,
int&
n) = 0;
83 int*
ties,
int n) = 0;
99 static void*
operator new(
size_t s,
Space& home);
101 static void operator delete(
void*
p,
Space& home);
103 static void operator delete(
void*
p);
205 template<
class Choose,
class Merit>
211 typedef typename Merit::Val
Val;
254 template<
class Choose,
class Merit>
294 template<
class Merit>
314 template<
class Merit>
334 template<
class Merit>
354 template<
class Merit>
414 return home.ralloc(s);
442 int j=0; ties[j++]=s;
443 for (
int i=s+1; i<
x.size(); i++)
444 if (!
x[i].assigned())
454 int j=0; ties[j++]=s;
455 for (
int i=s+1; i<
x.size(); i++)
456 if (!
x[i].assigned() && f(home,
x[i],i))
481 :
ViewSel<View>(home,vb),
r(vb.rnd()) {}
491 for (
int i=s+1; i<
x.size(); i++)
492 if (!
x[i].assigned()) {
505 for (
int i=s+1; i<
x.size(); i++)
506 if (!
x[i].assigned() && f(home,
x[i],i)) {
517 n=1; ties[0] = select(home,
x,s);
524 n=1; ties[0] = select(home,
x,s);
529 ties[0] = ties[
static_cast<int>(
r(
static_cast<unsigned int>(
n)))];
535 return ties[
static_cast<int>(
r(
static_cast<unsigned int>(
n)))];
556 template<
class Choose,
class Merit>
561 template<
class Choose,
class Merit>
567 template<
class Choose,
class Merit>
572 Val b_m = m(home,
x[s],s);
574 for (
int i=s+1; i<
x.size(); i++)
575 if (!
x[i].assigned()) {
576 Val mxi = m(home,
x[i],i);
584 template<
class Choose,
class Merit>
590 Val b_m = m(home,
x[s],s);
592 for (
int i=s+1; i<
x.size(); i++)
593 if (!
x[i].assigned() && f(home,
x[i],i)) {
594 Val mxi = m(home,
x[i],i);
602 template<
class Choose,
class Merit>
607 Val b = m(home,
x[s],s);
608 int j=0; ties[j++]=s;
609 for (
int i=s+1; i<
x.size(); i++)
610 if (!
x[i].assigned()) {
611 Val mxi = m(home,
x[i],i);
614 j=0; ties[j++]=i;
b=mxi;
615 }
else if (mxi ==
b) {
625 template<
class Choose,
class Merit>
631 Val b = m(home,
x[s],s);
632 int j=0; ties[j++]=s;
633 for (
int i=s+1; i<
x.size(); i++)
634 if (!
x[i].assigned() && f(home,
x[i],i)) {
635 Val mxi = m(home,
x[i],i);
638 j=0; ties[j++]=i;
b=mxi;
639 }
else if (mxi ==
b) {
649 template<
class Choose,
class Merit>
654 Val b = m(home,
x[ties[0]],ties[0]);
657 for (
int i=1; i<
n; i++) {
658 Val mxi = m(home,
x[ties[i]],ties[i]);
661 b=mxi; j=0; ties[j++]=ties[i];
662 }
else if (mxi ==
b) {
672 template<
class Choose,
class Merit>
677 Val b_m = m(home,
x[ties[0]],ties[0]);
678 for (
int i=1; i<
n; i++) {
679 Val mxi = m(home,
x[ties[i]],ties[i]);
681 b_i = ties[i]; b_m = mxi;
687 template<
class Choose,
class Merit>
693 template<
class Choose,
class Merit>
700 template<
class Choose,
class Merit>
709 template<
class Choose,
class Merit>
716 template<
class Choose,
class Merit>
721 Val w = m(home,
x[s],s);
723 for (
int i=s+1; i<
x.size(); i++)
724 if (!
x[i].assigned()) {
725 Val mxi = m(home,
x[i],i);
733 double l = tbl()(home,
static_cast<double>(w),
static_cast<double>(
b));
735 if (!c(
l,
static_cast<double>(w))) {
737 for (
int i=s; i<
x.size(); i++)
738 if (!
x[i].assigned())
743 if (c(
l,
static_cast<double>(
b)))
744 l =
static_cast<double>(
b);
747 for (
int i=s; i<
x.size(); i++)
748 if (!
x[i].assigned() && !c(
l,
static_cast<double>(m(home,
x[i],i))))
756 template<
class Choose,
class Merit>
762 assert(f(home,
x[s],s));
763 Val w = m(home,
x[s],s);
765 for (
int i=s+1; i<
x.size(); i++)
766 if (!
x[i].assigned() && f(home,
x[i],i)) {
767 Val mxi = m(home,
x[i],i);
775 double l = tbl()(home,
static_cast<double>(w),
static_cast<double>(
b));
777 if (!c(
l,
static_cast<double>(w))) {
779 for (
int i=s; i<
x.size(); i++)
780 if (!
x[i].assigned() && f(home,
x[i],i))
785 if (c(
l,
static_cast<double>(
b)))
786 l =
static_cast<double>(
b);
789 for (
int i=s; i<
x.size(); i++)
790 if (!
x[i].assigned() && f(home,
x[i],i) &&
791 !c(
l,
static_cast<double>(m(home,
x[i],i))))
799 template<
class Choose,
class Merit>
804 Val w = m(home,
x[ties[0]],ties[0]);
806 for (
int i=1; i<
n; i++) {
807 Val mxi = m(home,
x[ties[i]],ties[i]);
815 double l = tbl()(home,
static_cast<double>(w),
static_cast<double>(
b));
818 if (c(
l,
static_cast<double>(w))) {
820 if (c(
l,
static_cast<double>(
b)))
821 l =
static_cast<double>(
b);
824 for (
int i=0; i<
n; i++)
825 if (!c(
l,
static_cast<double>(m(home,
x[ties[i]],ties[i]))))
832 template<
class Choose,
class Merit>
837 template<
class Choose,
class Merit>
845 template<
class Merit>
850 template<
class Merit>
855 template<
class Merit>
862 template<
class Merit>
867 template<
class Merit>
872 template<
class Merit>
880 template<
class Merit>
885 template<
class Merit>
890 template<
class Merit>
898 template<
class Merit>
903 template<
class Merit>
908 template<
class Merit>
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Class storing a branch filter function.
Class withot a branch filter function.
Choose views with larger merit values.
bool operator()(Val a, Val b) const
Return true if a is better than b.
Choose views with smaller merit values.
bool operator()(Val a, Val b) const
Return true if a is better than b.
Exception: invalid function
Class for sharing data between spaces.
Variable branching information.
Choose view according to merit taking tie-break limit into account.
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
ViewSelChooseTbl(Space &home, ViewSelChooseTbl< Choose, Merit > &vs)
Constructor for copying during cloning.
ViewSelChoose< Choose, Merit >::View View
ViewSelChooseTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
ViewSelChoose< Choose, Merit >::Val Val
ViewSelChoose< Choose, Merit >::Var Var
SharedData< BranchTbl > tbl
Tie-break limit function.
virtual void dispose(Space &home)
Delete view selection.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n, BrancherFilter< View > &f)
Select ties from x starting from s.
Choose view according to merit.
ViewSelChoose(Space &home, ViewSelChoose< Choose, Merit > &vs)
Constructor for copying during cloning.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
ViewSelChoose(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n, BrancherFilter< View > &f)
Select ties from x starting from s.
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
virtual void dispose(Space &home)
Delete view selection.
ViewSel< typenameMerit::View >::Var Var
Merit m
The merit object used.
ViewSel< typenameMerit::View >::View View
Merit::Val Val
Type of merit.
virtual int select(Space &home, ViewArray< View > &x, int *ties, int n)
Select a view from x considering views with positions in ties.
virtual int select(Space &home, ViewArray< View > &x, int s, BrancherFilter< View > &f)
Select a view from x starting from s and return its position.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
virtual int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting from s and return its position.
Select view with largest merit taking tie-break limit into account.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
ViewSelMaxTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Select view with largest merit.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
ViewSelMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Select view with least merit taking tie-break limit into account.
ViewSelMinTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
Select view with least merit.
ViewSelMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
Select the first unassigned view.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting at s.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
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.
ViewSelNone(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)
Select ties from x starting from s.
Rnd r
The random number generator used.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
ViewSelRnd(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
virtual int select(Space &home, ViewArray< View > &x, int s)
Select a view from x starting from s and return its position.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)
Break ties in x and update to new ties.
Abstract class for view selection.
_View View
Define the view type.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n)=0
Select ties from x starting from s.
virtual ~ViewSel(void)
Unused destructor.
virtual void brk(Space &home, ViewArray< View > &x, int *ties, int &n)=0
Break ties in x and update to new ties.
ViewSel(Space &home, const VarBranch< Var > &vb)
Constructor for creation.
virtual int select(Space &home, ViewArray< View > &x, int s, BrancherFilter< View > &f)=0
Select a view from x starting from s and return its position.
virtual void dispose(Space &home)
Dispose view selection.
virtual void ties(Space &home, ViewArray< View > &x, int s, int *ties, int &n, BrancherNoFilter< View > &f)
Select ties from x starting from s.
View::VarType Var
The corresponding variable type.
virtual int select(Space &home, ViewArray< View > &x, int s, BrancherNoFilter< View > &f)
Select a view from x starting from s and return its position.
virtual ViewSel< View > * copy(Space &home)=0
Create copy during cloning.
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, BrancherFilter< View > &f)=0
Select ties from x starting from s.
virtual int select(Space &home, ViewArray< View > &x, int s)=0
Select a view from x starting from s and return its position.
virtual int select(Space &home, ViewArray< View > &x, int *ties, int n)=0
Select a view from x considering views with positions in ties.
ViewSel(Space &home, ViewSel< View > &vs)
Constructor for copying during cloning.
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
Post propagator for SetVar x
#define GECODE_NEVER
Assert that this command is never executed.
#define GECODE_VALID_FUNCTION(f)
Assert that a function is valid.