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>
*
* Contributing authors:
* Gabor Szokoli <szokoli@gecode.org>
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Christian Schulte, 2012
* Gabor Szokoli, 2004
* Guido Tack, 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.
*
*/
namespace Gecode { namespace Set { namespace Branch {
forceinline
ValCommitInc::ValCommitInc(Space& home, const ValBranch<Var>& vb)
: ValCommit<SetView,int>(home,vb) {}
forceinline
ValCommitInc::ValCommitInc(Space& home, ValCommitInc& vc)
: ValCommit<SetView,int>(home,vc) {}
forceinline ModEvent
ValCommitInc::commit(Space& home, unsigned int a, SetView x, int, int n) {
return (a == 0) ? x.include(home,n) : x.exclude(home,n);
}
forceinline NGL*
ValCommitInc::ngl(Space& home, unsigned int a, SetView x, int n) const {
if (a == 0)
return new (home) IncNGL(home,x,n);
else
return NULL;
}
forceinline void
ValCommitInc::print(const Space&, unsigned int a, SetView, int i, int n,
std::ostream& o) const {
o << "var[" << i << "]."
<< ((a == 0) ? "include" : "exclude") << "(" << n << ")";
}
forceinline
ValCommitExc::ValCommitExc(Space& home, const ValBranch<Var>& vb)
: ValCommit<SetView,int>(home,vb) {}
forceinline
ValCommitExc::ValCommitExc(Space& home, ValCommitExc& vc)
: ValCommit<SetView,int>(home,vc) {}
forceinline ModEvent
ValCommitExc::commit(Space& home, unsigned int a, SetView x, int, int n) {
return (a == 0) ? x.exclude(home,n) : x.include(home,n);
}
forceinline NGL*
ValCommitExc::ngl(Space& home, unsigned int a, SetView x, int n) const {
if (a == 0)
return new (home) ExcNGL(home,x,n);
else
return NULL;
}
forceinline void
ValCommitExc::print(const Space&, unsigned int a, SetView, int i, int n,
std::ostream& o) const {
o << "var[" << i << "]."
<< ((a == 0) ? "exclude" : "include") << "(" << n << ")";
}
}}}
// STATISTICS: set-branch
Gecode::NGL
No-good literal recorded during search.
Definition core.hpp:1340
Gecode::Set::Branch::ExcNGL
No-good literal for exclusion.
Definition branch.hh:319
Gecode::Set::Branch::IncNGL
No-good literal for inclusion.
Definition branch.hh:301
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::SetView
Set view for set variables
Definition view.hpp:56
Gecode::Set::SetView::include
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition set.hpp:126
Gecode::Set::SetView::exclude
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition set.hpp:156
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::Set::Branch
Set branchings
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode
Gecode toplevel namespace
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
forceinline
#define forceinline
Definition config.hpp:187