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);
186 virtual bool notice(
void)
const;
209 template<
class Choose,
class Merit>
215 typedef typename Merit::Val
Val;
258 template<
class Choose,
class Merit>
298 template<
class Merit>
318 template<
class Merit>
338 template<
class Merit>
358 template<
class Merit>
418 return home.ralloc(s);
446 int j=0;
ties[j++]=s;
447 for (
int i=s+1; i<x.
size(); i++)
448 if (!x[i].assigned())
458 int j=0;
ties[j++]=s;
459 for (
int i=s+1; i<x.
size(); i++)
460 if (!x[i].assigned() && f(home,x[i],i))
495 for (
int i=s+1; i<x.
size(); i++)
496 if (!x[i].assigned()) {
509 for (
int i=s+1; i<x.
size(); i++)
510 if (!x[i].assigned() && f(home,x[i],i)) {
533 ties[0] =
ties[
static_cast<int>(
r(
static_cast<unsigned int>(n)))];
539 return ties[
static_cast<int>(
r(
static_cast<unsigned int>(n)))];
570 template<
class Choose,
class Merit>
575 template<
class Choose,
class Merit>
581 template<
class Choose,
class Merit>
586 Val b_m =
m(home,x[s],s);
588 for (
int i=s+1; i<x.
size(); i++)
589 if (!x[i].assigned()) {
590 Val mxi =
m(home,x[i],i);
598 template<
class Choose,
class Merit>
604 Val b_m =
m(home,x[s],s);
606 for (
int i=s+1; i<x.
size(); i++)
607 if (!x[i].assigned() && f(home,x[i],i)) {
608 Val mxi =
m(home,x[i],i);
616 template<
class Choose,
class Merit>
621 Val b =
m(home,x[s],s);
622 int j=0;
ties[j++]=s;
623 for (
int i=s+1; i<x.
size(); i++)
624 if (!x[i].assigned()) {
625 Val mxi =
m(home,x[i],i);
628 j=0;
ties[j++]=i; b=mxi;
629 }
else if (mxi == b) {
639 template<
class Choose,
class Merit>
645 Val b =
m(home,x[s],s);
646 int j=0;
ties[j++]=s;
647 for (
int i=s+1; i<x.
size(); i++)
648 if (!x[i].assigned() && f(home,x[i],i)) {
649 Val mxi =
m(home,x[i],i);
652 j=0;
ties[j++]=i; b=mxi;
653 }
else if (mxi == b) {
663 template<
class Choose,
class Merit>
671 for (
int i=1; i<n; i++) {
676 }
else if (mxi == b) {
686 template<
class Choose,
class Merit>
692 for (
int i=1; i<n; i++) {
695 b_i =
ties[i]; b_m = mxi;
701 template<
class Choose,
class Merit>
707 template<
class Choose,
class Merit>
714 template<
class Choose,
class Merit>
723 template<
class Choose,
class Merit>
730 template<
class Choose,
class Merit>
735 Val w =
m(home,x[s],s);
737 for (
int i=s+1; i<x.
size(); i++)
738 if (!x[i].assigned()) {
739 Val mxi =
m(home,x[i],i);
747 double l =
tbl()(home,
static_cast<double>(w),
static_cast<double>(b));
749 if (!
c(l,
static_cast<double>(w))) {
751 for (
int i=s; i<x.
size(); i++)
752 if (!x[i].assigned())
757 if (
c(l,
static_cast<double>(b)))
758 l =
static_cast<double>(b);
761 for (
int i=s; i<x.
size(); i++)
762 if (!x[i].assigned() && !
c(l,
static_cast<double>(
m(home,x[i],i))))
770 template<
class Choose,
class Merit>
776 assert(f(home,x[s],s));
777 Val w =
m(home,x[s],s);
779 for (
int i=s+1; i<x.
size(); i++)
780 if (!x[i].assigned() && f(home,x[i],i)) {
781 Val mxi =
m(home,x[i],i);
789 double l =
tbl()(home,
static_cast<double>(w),
static_cast<double>(b));
791 if (!
c(l,
static_cast<double>(w))) {
793 for (
int i=s; i<x.
size(); i++)
794 if (!x[i].assigned() && f(home,x[i],i))
799 if (
c(l,
static_cast<double>(b)))
800 l =
static_cast<double>(b);
803 for (
int i=s; i<x.
size(); i++)
804 if (!x[i].assigned() && f(home,x[i],i) &&
805 !
c(l,
static_cast<double>(
m(home,x[i],i))))
813 template<
class Choose,
class Merit>
820 for (
int i=1; i<n; i++) {
829 double l =
tbl()(home,
static_cast<double>(w),
static_cast<double>(b));
832 if (
c(l,
static_cast<double>(w))) {
834 if (
c(l,
static_cast<double>(b)))
835 l =
static_cast<double>(b);
838 for (
int i=0; i<n; i++)
839 if (!
c(l,
static_cast<double>(
m(home,x[
ties[i]],
ties[i]))))
846 template<
class Choose,
class Merit>
851 template<
class Choose,
class Merit>
859 template<
class Merit>
864 template<
class Merit>
869 template<
class Merit>
876 template<
class Merit>
881 template<
class Merit>
886 template<
class Merit>
894 template<
class Merit>
899 template<
class Merit>
904 template<
class Merit>
912 template<
class Merit>
917 template<
class Merit>
922 template<
class Merit>
Class storing a branch filter function.
Class without 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.
int size(void) const
Return size of array (number of elements).
virtual bool notice(void) const
Whether dispose must always be called (that is, notice is needed).
ViewSelChoose< Choose, Merit >::View View
ViewSelChooseTbl(Space &home, ViewSelChooseTbl< Choose, Merit > &vs)
Constructor for copying during cloning.
ViewSelChoose< Choose, Merit >::Var Var
ViewSelChooseTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
ViewSelChoose< Choose, Merit >::Val Val
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.
SharedData< BranchTbl > tbl
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.
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).
Merit::Val Val
Type of merit.
ViewSel< typenameMerit::View >::Var Var
virtual void dispose(Space &home)
Delete view selection.
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.
ViewSel< typenameMerit::View >::View View
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.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
ViewSelMaxTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
ViewSelMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
ViewSelMinTbl(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
virtual ViewSel< View > * copy(Space &home)
Create copy during cloning.
ViewSelMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
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 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 bool notice(void) const
Whether dispose must always be called (that is, notice is needed).
virtual void dispose(Space &home)
Delete view selection.
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::VarType Var
The corresponding variable type.
virtual ~ViewSel(void)
Unused destructor.
virtual ViewSel< View > * copy(Space &home)=0
Create copy during cloning.
virtual int select(Space &home, ViewArray< View > &x, int *ties, int n)=0
Select a view from x considering views with positions in ties.
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.
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 brk(Space &home, ViewArray< View > &x, int *ties, int &n)=0
Break ties in x and update to new ties.
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_ View
Define the view 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 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)=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.
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
#define GECODE_NEVER
Assert that this command is never executed.
#define GECODE_VALID_FUNCTION(f)
Assert that a function is valid.