ngl.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, 2013
*
* 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
EqNGL<View>::EqNGL(Space& home, View x, int n)
: ViewValNGL<View,int,PC_INT_VAL>(home,x,n) {}
template<class View>
forceinline
EqNGL<View>::EqNGL(Space& home, EqNGL& ngl)
: ViewValNGL<View,int,PC_INT_VAL>(home,ngl) {}
template<class View>
NGL*
EqNGL<View>::copy(Space& home) {
return new (home) EqNGL<View>(home,*this);
}
template<class View>
NGL::Status
EqNGL<View>::status(const Space&) const {
if (x.assigned())
return (x.val() == n) ? NGL::SUBSUMED : NGL::FAILED;
else
return x.in(n) ? NGL::NONE : NGL::FAILED;
}
template<class View>
ExecStatus
EqNGL<View>::prune(Space& home) {
return me_failed(x.nq(home,n)) ? ES_FAILED : ES_OK;
}
template<class View>
forceinline
NqNGL<View>::NqNGL(Space& home, View x, int n)
: ViewValNGL<View,int,PC_INT_DOM>(home,x,n) {}
template<class View>
forceinline
NqNGL<View>::NqNGL(Space& home, NqNGL& ngl)
: ViewValNGL<View,int,PC_INT_DOM>(home,ngl) {}
template<class View>
NGL*
NqNGL<View>::copy(Space& home) {
return new (home) NqNGL<View>(home,*this);
}
template<class View>
NGL::Status
NqNGL<View>::status(const Space&) const {
if (x.assigned())
return (x.val() == n) ? NGL::FAILED : NGL::SUBSUMED;
else
return x.in(n) ? NGL::NONE : NGL::SUBSUMED;
}
template<class View>
ExecStatus
NqNGL<View>::prune(Space& home) {
return me_failed(x.eq(home,n)) ? ES_FAILED : ES_OK;
}
template<class View>
forceinline
LqNGL<View>::LqNGL(Space& home, View x, int n)
: ViewValNGL<View,int,PC_INT_BND>(home,x,n) {}
template<class View>
forceinline
LqNGL<View>::LqNGL(Space& home, LqNGL& ngl)
: ViewValNGL<View,int,PC_INT_BND>(home,ngl) {}
template<class View>
NGL*
LqNGL<View>::copy(Space& home) {
return new (home) LqNGL<View>(home,*this);
}
template<class View>
NGL::Status
LqNGL<View>::status(const Space&) const {
if (x.max() <= n)
return NGL::SUBSUMED;
else if (x.min() > n)
return NGL::FAILED;
else
return NGL::NONE;
}
template<class View>
ExecStatus
LqNGL<View>::prune(Space& home) {
return me_failed(x.gr(home,n)) ? ES_FAILED : ES_OK;
}
template<class View>
forceinline
GqNGL<View>::GqNGL(Space& home, View x, int n)
: ViewValNGL<View,int,PC_INT_BND>(home,x,n) {}
template<class View>
forceinline
GqNGL<View>::GqNGL(Space& home, GqNGL& ngl)
: ViewValNGL<View,int,PC_INT_BND>(home,ngl) {}
template<class View>
NGL*
GqNGL<View>::copy(Space& home) {
return new (home) GqNGL<View>(home,*this);
}
template<class View>
NGL::Status
GqNGL<View>::status(const Space&) const {
if (x.min() >= n)
return NGL::SUBSUMED;
else if (x.max() < n)
return NGL::FAILED;
else
return NGL::NONE;
}
template<class View>
ExecStatus
GqNGL<View>::prune(Space& home) {
return me_failed(x.le(home,n)) ? ES_FAILED : ES_OK;
}
}}}
// STATISTICS: int-branch
Gecode::Int::Branch::EqNGL::status
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition ngl.hpp:51
Gecode::Int::Branch::EqNGL::copy
virtual NGL * copy(Space &home)
Create copy.
Definition ngl.hpp:46
Gecode::Int::Branch::EqNGL::prune
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition ngl.hpp:59
Gecode::Int::Branch::EqNGL::EqNGL
EqNGL(Space &home, View x, int n)
Constructor for creation.
Definition ngl.hpp:38
Gecode::Int::Branch::GqNGL::copy
virtual NGL * copy(Space &home)
Create copy.
Definition ngl.hpp:132
Gecode::Int::Branch::GqNGL::status
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition ngl.hpp:137
Gecode::Int::Branch::GqNGL::GqNGL
GqNGL(Space &home, View x, int n)
Constructor for creation.
Definition ngl.hpp:124
Gecode::Int::Branch::GqNGL::prune
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition ngl.hpp:147
Gecode::Int::Branch::LqNGL::copy
virtual NGL * copy(Space &home)
Create copy.
Definition ngl.hpp:102
Gecode::Int::Branch::LqNGL::status
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition ngl.hpp:107
Gecode::Int::Branch::LqNGL::prune
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition ngl.hpp:117
Gecode::Int::Branch::LqNGL::LqNGL
LqNGL(Space &home, View x, int n)
Constructor for creation.
Definition ngl.hpp:94
Gecode::Int::Branch::NqNGL::NqNGL
NqNGL(Space &home, View x, int n)
Constructor for creation.
Definition ngl.hpp:66
Gecode::Int::Branch::NqNGL::prune
virtual ExecStatus prune(Space &home)
Propagate the negation of the no-good literal.
Definition ngl.hpp:87
Gecode::Int::Branch::NqNGL::copy
virtual NGL * copy(Space &home)
Create copy.
Definition ngl.hpp:74
Gecode::Int::Branch::NqNGL::status
virtual NGL::Status status(const Space &home) const
Test the status of the no-good literal.
Definition ngl.hpp:79
Gecode::NGL
No-good literal recorded during search.
Definition core.hpp:1340
Gecode::NGL::Status
Status
The status of a no-good literal.
Definition core.hpp:1346
Gecode::NGL::SUBSUMED
@ SUBSUMED
The literal is subsumed.
Definition core.hpp:1348
Gecode::NGL::FAILED
@ FAILED
The literal is failed.
Definition core.hpp:1347
Gecode::NGL::NONE
@ NONE
The literal is neither failed nor subsumed.
Definition core.hpp:1349
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::View
Gecode::ViewValNGL< View, int, PC_INT_VAL >::x
View x
Definition view-val.hpp:64
Gecode::ViewValNGL< View, int, PC_INT_VAL >::n
int n
Definition view-val.hpp:66
Gecode::ViewValNGL< View, int, PC_INT_VAL >::ViewValNGL
ViewValNGL(Space &home, View x, int n)
Definition view-val.hpp:183
Gecode::me_failed
bool me_failed(ModEvent me)
Check whether modification event me is failed.
Definition modevent.hpp:54
Gecode::Int::Branch
Integer branchers.
Gecode::Int
Finite domain integers.
Gecode::Int::PC_INT_VAL
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value).
Definition var-type.hpp:82
Gecode::Int::PC_INT_BND
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition var-type.hpp:91
Gecode::Int::PC_INT_DOM
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:100
Gecode
Gecode toplevel namespace
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
Gecode::ES_OK
@ ES_OK
Execution is okay.
Definition core.hpp:476
Gecode::ES_FAILED
@ ES_FAILED
Execution has resulted in failure.
Definition core.hpp:474
forceinline
#define forceinline
Definition config.hpp:187