branch.hh
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
* Christian Schulte <schulte@gecode.org>
*
* Contributing authors:
* Gabor Szokoli <szokoli@gecode.org>
*
* Copyright:
* Guido Tack, 2004
* Christian Schulte, 2004
* Gabor Szokoli, 2004
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __GECODE_SET_BRANCH_HH__
#define __GECODE_SET_BRANCH_HH__
#include <gecode/set.hh>
namespace Gecode { namespace Set { namespace Branch {
class MeritMin : public MeritBase<SetView,int> {
public:
MeritMin(Space& home, const VarBranch<Var>& vb);
MeritMin(Space& home, MeritMin& m);
int operator ()(const Space& home, SetView x, int i);
};
class MeritMax : public MeritBase<SetView,int> {
public:
MeritMax(Space& home, const VarBranch<Var>& vb);
MeritMax(Space& home, MeritMax& m);
int operator ()(const Space& home, SetView x, int i);
};
class MeritSize : public MeritBase<SetView,unsigned int> {
public:
MeritSize(Space& home, const VarBranch<Var>& vb);
MeritSize(Space& home, MeritSize& m);
unsigned int operator ()(const Space& home, SetView x, int i);
};
class MeritDegreeSize : public MeritBase<SetView,double> {
public:
MeritDegreeSize(Space& home, const VarBranch<Var>& vb);
MeritDegreeSize(Space& home, MeritDegreeSize& m);
double operator ()(const Space& home, SetView x, int i);
};
class MeritAFCSize : public MeritBase<SetView,double> {
protected:
AFC afc;
public:
MeritAFCSize(Space& home, const VarBranch<Var>& vb);
MeritAFCSize(Space& home, MeritAFCSize& m);
double operator ()(const Space& home, SetView x, int i);
bool notice(void) const;
void dispose(Space& home);
};
class MeritActionSize : public MeritBase<SetView,double> {
protected:
Action action;
public:
MeritActionSize(Space& home, const VarBranch<Var>& vb);
MeritActionSize(Space& home, MeritActionSize& m);
double operator ()(const Space& home, SetView x, int i);
bool notice(void) const;
void dispose(Space& home);
};
class MeritCHBSize : public MeritBase<SetView,double> {
protected:
CHB chb;
public:
MeritCHBSize(Space& home, const VarBranch<Var>& vb);
MeritCHBSize(Space& home, MeritCHBSize& m);
double operator ()(const Space& home, SetView x, int i);
bool notice(void) const;
void dispose(Space& home);
};
}}}
#include <gecode/set/branch/merit.hpp>
namespace Gecode { namespace Set { namespace Branch {
GECODE_SET_EXPORT
ViewSel<SetView>* viewsel(Space& home, const SetVarBranch& svb);
}}}
namespace Gecode { namespace Set { namespace Branch {
class ValSelMin : public ValSel<SetView,int> {
public:
ValSelMin(Space& home, const ValBranch<Var>& vb);
ValSelMin(Space& home, ValSelMin& vs);
int val(const Space& home, SetView x, int i);
};
class ValSelMax : public ValSel<SetView,int> {
public:
ValSelMax(Space& home, const ValBranch<Var>& vb);
ValSelMax(Space& home, ValSelMax& vs);
int val(const Space& home, SetView x, int i);
};
class ValSelMed : public ValSel<SetView,int> {
public:
ValSelMed(Space& home, const ValBranch<Var>& vb);
ValSelMed(Space& home, ValSelMed& vs);
int val(const Space& home, SetView x, int i);
};
class ValSelRnd : public ValSel<SetView,int> {
protected:
Rnd r;
public:
ValSelRnd(Space& home, const ValBranch<Var>& vb);
ValSelRnd(Space& home, ValSelRnd& vs);
int val(const Space& home, SetView x, int i);
bool notice(void) const;
void dispose(Space& home);
};
}}}
#include <gecode/set/branch/val-sel.hpp>
namespace Gecode { namespace Set { namespace Branch {
class IncNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
public:
IncNGL(Space& home, SetView x, int n);
IncNGL(Space& home, IncNGL& ngl);
GECODE_SET_EXPORT
virtual NGL::Status status(const Space& home) const;
GECODE_SET_EXPORT
virtual ExecStatus prune(Space& home);
GECODE_SET_EXPORT
virtual NGL* copy(Space& home);
};
class ExcNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
public:
ExcNGL(Space& home, SetView x, int n);
ExcNGL(Space& home, ExcNGL& ngl);
GECODE_SET_EXPORT
virtual NGL::Status status(const Space& home) const;
GECODE_SET_EXPORT
virtual ExecStatus prune(Space& home);
GECODE_SET_EXPORT
virtual NGL* copy(Space& home);
};
}}}
#include <gecode/set/branch/ngl.hpp>
namespace Gecode { namespace Set { namespace Branch {
class ValCommitInc : public ValCommit<SetView,int> {
public:
ValCommitInc(Space& home, const ValBranch<Var>& vb);
ValCommitInc(Space& home, ValCommitInc& vc);
ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
NGL* ngl(Space& home, unsigned int a, View x, int n) const;
void print(const Space& home, unsigned int a, SetView x, int i, int n,
std::ostream& o) const;
};
class ValCommitExc : public ValCommit<SetView,int> {
public:
ValCommitExc(Space& home, const ValBranch<Var>& vb);
ValCommitExc(Space& home, ValCommitExc& vc);
ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
NGL* ngl(Space& home, unsigned int a, View x, int n) const;
void print(const Space& home, unsigned int a, SetView x, int i, int n,
std::ostream& o) const;
};
}}}
#include <gecode/set/branch/val-commit.hpp>
namespace Gecode { namespace Set { namespace Branch {
GECODE_SET_EXPORT
ValSelCommitBase<SetView,int>*
valselcommit(Space& home, const SetValBranch& svb);
GECODE_SET_EXPORT
ValSelCommitBase<SetView,int>*
valselcommit(Space& home, const SetAssign& ia);
}}}
#endif
// STATISTICS: set-branch
Gecode::AFC
Class for AFC (accumulated failure count) management.
Definition afc.hpp:40
Gecode::Action
Class for action management.
Definition action.hpp:42
Gecode::CHB
Class for CHB management.
Definition chb.hpp:46
Gecode::MeritBase< SetView, int >::MeritBase
MeritBase(Space &home, const VarBranch< Var > &vb)
Definition merit.hpp:176
Gecode::NGL
No-good literal recorded during search.
Definition core.hpp:1340
Gecode::NGL::NGL
NGL(void)
Constructor for creation.
Definition core.hpp:3812
Gecode::NGL::Status
Status
The status of a no-good literal.
Definition core.hpp:1346
Gecode::Rnd
Random number generator.
Definition rnd.hpp:42
Gecode::Set::Branch::ExcNGL::status
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition ngl.cpp:62
Gecode::Set::Branch::ExcNGL::copy
virtual NGL * copy(Space &home)
Create copy.
Definition ngl.cpp:58
Gecode::Set::Branch::ExcNGL::ExcNGL
ExcNGL(Space &home, SetView x, int n)
Constructor for creation.
Definition ngl.hpp:44
Gecode::Set::Branch::ExcNGL::prune
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition ngl.cpp:71
Gecode::Set::Branch::IncNGL::IncNGL
IncNGL(Space &home, SetView x, int n)
Constructor for creation.
Definition ngl.hpp:37
Gecode::Set::Branch::IncNGL::status
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition ngl.cpp:43
Gecode::Set::Branch::IncNGL::copy
virtual NGL * copy(Space &home)
Create copy.
Definition ngl.cpp:39
Gecode::Set::Branch::IncNGL::prune
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition ngl.cpp:52
Gecode::Set::Branch::MeritAFCSize::notice
bool notice(void) const
Whether dispose must always be called (that is, notice is needed).
Definition merit.hpp:107
Gecode::Set::Branch::MeritAFCSize::operator()
double operator()(const Space &home, SetView x, int i)
Return AFC over size as merit for view x at position i.
Definition merit.hpp:103
Gecode::Set::Branch::MeritAFCSize::afc
AFC afc
AFC information.
Definition branch.hh:137
Gecode::Set::Branch::MeritAFCSize::MeritAFCSize
MeritAFCSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:97
Gecode::Set::Branch::MeritAFCSize::dispose
void dispose(Space &home)
Dispose view selection.
Definition merit.hpp:111
Gecode::Set::Branch::MeritActionSize::notice
bool notice(void) const
Whether dispose must always be called (that is, notice is needed).
Definition merit.hpp:128
Gecode::Set::Branch::MeritActionSize::dispose
void dispose(Space &home)
Dispose view selection.
Definition merit.hpp:132
Gecode::Set::Branch::MeritActionSize::action
Action action
Action information.
Definition branch.hh:160
Gecode::Set::Branch::MeritActionSize::MeritActionSize
MeritActionSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:118
Gecode::Set::Branch::MeritActionSize::operator()
double operator()(const Space &home, SetView x, int i)
Return action over size as merit for view x at position i.
Definition merit.hpp:124
Gecode::Set::Branch::MeritCHBSize::operator()
double operator()(const Space &home, SetView x, int i)
Return CHB Q-score over size as merit for view x at position i.
Definition merit.hpp:145
Gecode::Set::Branch::MeritCHBSize::notice
bool notice(void) const
Whether dispose must always be called (that is, notice is needed).
Definition merit.hpp:149
Gecode::Set::Branch::MeritCHBSize::dispose
void dispose(Space &home)
Dispose view selection.
Definition merit.hpp:153
Gecode::Set::Branch::MeritCHBSize::MeritCHBSize
MeritCHBSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:139
Gecode::Set::Branch::MeritCHBSize::chb
CHB chb
CHB information.
Definition branch.hh:183
Gecode::Set::Branch::MeritDegreeSize::operator()
double operator()(const Space &home, SetView x, int i)
Return degree over size as merit for view x at position i.
Definition merit.hpp:90
Gecode::Set::Branch::MeritDegreeSize::MeritDegreeSize
MeritDegreeSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:84
Gecode::Set::Branch::MeritMax::MeritMax
MeritMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:57
Gecode::Set::Branch::MeritMax::operator()
int operator()(const Space &home, SetView x, int i)
Return maximum as merit for view x at position i.
Definition merit.hpp:63
Gecode::Set::Branch::MeritMin::MeritMin
MeritMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:44
Gecode::Set::Branch::MeritMin::operator()
int operator()(const Space &home, SetView x, int i)
Return minimum as merit for view x at position i.
Definition merit.hpp:50
Gecode::Set::Branch::MeritSize::MeritSize
MeritSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:72
Gecode::Set::Branch::MeritSize::operator()
unsigned int operator()(const Space &home, SetView x, int i)
Return size as merit for view x at position i.
Definition merit.hpp:78
Gecode::Set::Branch::ValCommitExc::ngl
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition val-commit.hpp:77
Gecode::Set::Branch::ValCommitExc::print
void print(const Space &home, unsigned int a, SetView x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition val-commit.hpp:84
Gecode::Set::Branch::ValCommitExc::ValCommitExc
ValCommitExc(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-commit.hpp:67
Gecode::Set::Branch::ValCommitExc::commit
ModEvent commit(Space &home, unsigned int a, SetView x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition val-commit.hpp:73
Gecode::Set::Branch::ValCommitInc::commit
ModEvent commit(Space &home, unsigned int a, SetView x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition val-commit.hpp:49
Gecode::Set::Branch::ValCommitInc::ValCommitInc
ValCommitInc(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-commit.hpp:43
Gecode::Set::Branch::ValCommitInc::print
void print(const Space &home, unsigned int a, SetView x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition val-commit.hpp:60
Gecode::Set::Branch::ValCommitInc::ngl
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition val-commit.hpp:53
Gecode::Set::Branch::ValSelMax::val
int val(const Space &home, SetView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:61
Gecode::Set::Branch::ValSelMax::ValSelMax
ValSelMax(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:55
Gecode::Set::Branch::ValSelMed::ValSelMed
ValSelMed(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:69
Gecode::Set::Branch::ValSelMed::val
int val(const Space &home, SetView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:75
Gecode::Set::Branch::ValSelMin::ValSelMin
ValSelMin(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:43
Gecode::Set::Branch::ValSelMin::val
int val(const Space &home, SetView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:49
Gecode::Set::Branch::ValSelRnd::notice
bool notice(void) const
Whether dispose must always be called (that is, notice is needed).
Definition val-sel.hpp:112
Gecode::Set::Branch::ValSelRnd::ValSelRnd
ValSelRnd(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:93
Gecode::Set::Branch::ValSelRnd::r
Rnd r
The used random number generator.
Definition branch.hh:280
Gecode::Set::Branch::ValSelRnd::val
int val(const Space &home, SetView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:100
Gecode::Set::Branch::ValSelRnd::dispose
void dispose(Space &home)
Delete value selection.
Definition val-sel.hpp:116
Gecode::Set::SetView
Set view for set variables
Definition view.hpp:56
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::ValBranch
Value branching information.
Definition val.hpp:41
Gecode::ValCommit< SetView, int >::ValCommit
ValCommit(Space &home, const ValBranch< Var > &vb)
Definition val-commit.hpp:101
Gecode::ValCommit< SetView, int >::View
SetView View
Definition val-commit.hpp:47
Gecode::ValSel< SetView, int >::ValSel
ValSel(Space &home, const ValBranch< Var > &vb)
Definition val-sel.hpp:98
Gecode::VarBranch
Variable branching information.
Definition var.hpp:55
Gecode::ViewValNGL< SetView, int, PC_SET_ANY >::x
SetView x
Definition view-val.hpp:64
Gecode::ViewValNGL< SetView, int, PC_SET_ANY >::n
int n
Definition view-val.hpp:66
Gecode::ViewValNGL< SetView, int, PC_SET_ANY >::ViewValNGL
ViewValNGL(Space &home, SetView x, int n)
Definition view-val.hpp:183
set.hh
GECODE_SET_EXPORT
#define GECODE_SET_EXPORT
Definition set.hh:67
Gecode::Int::Branch
Integer branchers.
Gecode::Int::Branch::viewsel
ViewSel< IntView > * viewsel(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition view-sel.cpp:39
Gecode::Int::Branch::valselcommit
ValSelCommitBase< IntView, int > * valselcommit(Space &home, const IntValBranch &ivb)
Return value and commit for integer views.
Definition val-sel-commit.cpp:39
Gecode::Set::Branch
Set branchings
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode
Gecode toplevel namespace
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
merit.hpp
ngl.hpp
val-commit.hpp
val-sel.hpp