val-commit.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2012
*
* 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.
*
*/
namespace Gecode { namespace Int { namespace Branch {
template<class View>
forceinline
ValCommitEq<View>::ValCommitEq
(Space& home, const ValBranch<ValCommitEq<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
ValCommitEq<View>::ValCommitEq(Space& home, ValCommitEq& vc)
: ValCommit<View,int>(home,vc) {}
template<class View>
forceinline ModEvent
ValCommitEq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
return (a == 0) ? x.eq(home,n) : x.nq(home,n);
}
template<class View>
forceinline NGL*
ValCommitEq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
if (a == 0)
return new (home) EqNGL<View>(home,x,n);
else
return NULL;
}
template<class View>
forceinline void
ValCommitEq<View>::print(const Space&, unsigned int a, View, int i,
int n, std::ostream& o) const {
o << "var[" << i << "] "
<< ((a == 0) ? "=" : "!=") << " " << n;
}
template<class View>
forceinline
ValCommitLq<View>::ValCommitLq
(Space& home, const ValBranch<ValCommitLq<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
ValCommitLq<View>::ValCommitLq(Space& home, ValCommitLq& vc)
: ValCommit<View,int>(home,vc) {}
template<class View>
forceinline ModEvent
ValCommitLq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
return (a == 0) ? x.lq(home,n) : x.gr(home,n);
}
template<class View>
forceinline NGL*
ValCommitLq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
if (a == 0)
return new (home) LqNGL<View>(home,x,n);
else
return NULL;
}
template<class View>
forceinline void
ValCommitLq<View>::print(const Space&, unsigned int a, View, int i,
int n, std::ostream& o) const {
o << "var[" << i << "] "
<< ((a == 0) ? "<=" : ">") << " " << n;
}
template<class View>
forceinline
ValCommitGq<View>::ValCommitGq
(Space& home, const ValBranch<ValCommitGq<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
ValCommitGq<View>::ValCommitGq(Space& home, ValCommitGq& vc)
: ValCommit<View,int>(home,vc) {}
template<class View>
forceinline ModEvent
ValCommitGq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
return (a == 0) ? x.gq(home,n) : x.le(home,n);
}
template<class View>
forceinline NGL*
ValCommitGq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
if (a == 0)
return new (home) GqNGL<View>(home,x,n);
else
return NULL;
}
template<class View>
forceinline void
ValCommitGq<View>::print(const Space&, unsigned int a, View, int i,
int n, std::ostream& o) const {
o << "var[" << i << "] "
<< ((a == 0) ? ">=" : "<") << " " << n;
}
template<class View>
forceinline
ValCommitGr<View>::ValCommitGr
(Space& home, const ValBranch<ValCommitGr<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
ValCommitGr<View>::ValCommitGr(Space& home, ValCommitGr& vc)
: ValCommit<View,int>(home,vc) {}
template<class View>
forceinline ModEvent
ValCommitGr<View>::commit(Space& home, unsigned int a, View x, int, int n) {
return (a == 0) ? x.gr(home,n) : x.lq(home,n);
}
template<class View>
forceinline NGL*
ValCommitGr<View>::ngl(Space& home, unsigned int a, View x, int n) const {
if (a == 0)
return new (home) GqNGL<View>(home,x,n+1);
else
return NULL;
}
template<class View>
forceinline void
ValCommitGr<View>::print(const Space&, unsigned int a, View, int i,
int n, std::ostream& o) const {
o << "var[" << i << "] "
<< ((a == 0) ? ">" : "<=") << " " << n;
}
}}}
// STATISTICS: int-branch
Gecode::Int::Branch::EqNGL
No-good literal for equality.
Definition branch.hh:411
Gecode::Int::Branch::GqNGL
No-good literal for greater or equal.
Definition branch.hh:465
Gecode::Int::Branch::LqNGL
No-good literal for less or equal.
Definition branch.hh:447
Gecode::Int::Branch::ValCommitEq::ngl
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition val-commit.hpp:52
Gecode::Int::Branch::ValCommitEq::commit
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition val-commit.hpp:47
Gecode::Int::Branch::ValCommitEq::print
void print(const Space &home, unsigned int a, View 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::Int::Branch::ValCommitEq::ValCommitEq
ValCommitEq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Gecode::Int::Branch::ValCommitGq::print
void print(const Space &home, unsigned int a, View 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:120
Gecode::Int::Branch::ValCommitGq::ValCommitGq
ValCommitGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Gecode::Int::Branch::ValCommitGq::ngl
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition val-commit.hpp:112
Gecode::Int::Branch::ValCommitGq::commit
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition val-commit.hpp:107
Gecode::Int::Branch::ValCommitGr::ValCommitGr
ValCommitGr(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Gecode::Int::Branch::ValCommitGr::commit
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition val-commit.hpp:137
Gecode::Int::Branch::ValCommitGr::print
void print(const Space &home, unsigned int a, View 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:150
Gecode::Int::Branch::ValCommitGr::ngl
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition val-commit.hpp:142
Gecode::Int::Branch::ValCommitLq::print
void print(const Space &home, unsigned int a, View 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:90
Gecode::Int::Branch::ValCommitLq::ngl
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition val-commit.hpp:82
Gecode::Int::Branch::ValCommitLq::ValCommitLq
ValCommitLq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Gecode::Int::Branch::ValCommitLq::commit
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition val-commit.hpp:77
Gecode::NGL
No-good literal recorded during search.
Definition core.hpp:1340
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::ValBranch
Value branching information.
Definition val.hpp:41
Gecode::ValCommit
Base class for value commit.
Definition val-commit.hpp:44
Gecode::ValCommit< View, int >::ValCommit
ValCommit(Space &home, const ValBranch< Var > &vb)
Definition val-commit.hpp:101
Gecode::ValCommit< View, int >::Var
View::VarType Var
Definition val-commit.hpp:49
Gecode::ValCommit< View, int >::View
View View
Definition val-commit.hpp:47
Gecode::View
Gecode::Int::Branch
Integer branchers.
Gecode::Int
Finite domain integers.
Gecode
Gecode toplevel namespace
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
forceinline
#define forceinline
Definition config.hpp:187