ldsb.hh
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christopher Mears <chris.mears@monash.edu>
*
* Copyright:
* Christopher Mears, 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.
*
*/
#ifndef __GECODE_SET_LDSB_HH__
#define __GECODE_SET_LDSB_HH__
#include <gecode/set.hh>
#include <gecode/int/ldsb.hh>
namespace Gecode { namespace Set { namespace LDSB {
using namespace Int::LDSB;
template<class View, int n, class Val, unsigned int a,
class Filter, class Print>
class LDSBSetBrancher : public LDSBBrancher<View,n,Val,a,Filter,Print> {
public:
using typename LDSBBrancher<View,n,Val,a,Filter,Print>::Var;
int _prevPos;
int _nNonValueSymmetries;
int _nValueSymmetries;
ValueSymmetryImp<View>** _copiedSyms;
int _nCopiedSyms;
IntSet _leftBranchValues;
bool _stable;
LDSBSetBrancher(Space& home, LDSBSetBrancher& b);
LDSBSetBrancher(Home home,
ViewArray<View>& x,
ViewSel<View>* vs[n],
ValSelCommitBase<View,Val>* vsc,
SymmetryImp<View>** syms, int nsyms,
BranchFilter<Var> bf,
VarValPrint<Var,Val> vvp);
virtual const Choice* choice(Space& home);
virtual ExecStatus commit(Space& home, const Choice& c, unsigned int b);
virtual Actor* copy(Space& home);
static void post(Home home,
ViewArray<View>& x,
ViewSel<View>* vs[n],
ValSelCommitBase<View,Val>* vsc,
SymmetryImp<View>** _syms,
int _nsyms,
BranchFilter<Var> bf,
VarValPrint<Var,Val> vvp);
template<class View0, int n0, class Val0, unsigned int a0>
void postldsbsetbrancher(Home home,
ViewArray<View0>& x,
ViewSel<View0>* vs[n0],
ValSelCommitBase<View0,Val0>* vsc,
SymmetryImp<View0>** syms, int nsyms,
BranchFilter<typename View0::VarType> bf,
VarValPrint<typename View0::VarType,Val0> vvp);
void updatePart1(Space& home, int choicePos);
};
}}}
namespace Gecode { namespace Int { namespace LDSB {
template <>
ArgArray<Literal>
VariableSequenceSymmetryImp<Set::SetView>
::symmetric(Literal l, const ViewArray<Set::SetView>& x) const;
}}}
#include <gecode/set/ldsb/brancher.hpp>
#endif
// STATISTICS: set-branch
Gecode::Actor
Base-class for both propagators and branchers.
Definition core.hpp:628
Gecode::Brancher::Space
friend class Space
Definition core.hpp:1444
Gecode::Brancher::Choice
friend class Choice
Definition core.hpp:1445
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::IntSet
Integer sets.
Definition int.hh:174
Gecode::Int::LDSB::LDSBBrancher::_nsyms
int _nsyms
Number of symmetry implementations.
Definition ldsb.hh:338
Gecode::Int::LDSB::LDSBBrancher::_syms
SymmetryImp< View > ** _syms
Array of symmetry implementations.
Definition ldsb.hh:336
Gecode::Int::LDSB::LDSBBrancher::LDSBBrancher
LDSBBrancher(Space &home, LDSBBrancher &b)
Constructor for cloning b.
Gecode::Int::LDSB::Literal
A Literal is a pair of variable index and value.
Definition ldsb.hh:46
Gecode::Int::LDSB::SymmetryImp
Implementation of a single symmetry.
Definition ldsb.hh:162
Gecode::Int::LDSB::ValueSymmetryImp
Implementation of a value symmetry.
Definition ldsb.hh:204
Gecode::Set::LDSB::LDSBSetBrancher::_stable
bool _stable
Is the state of the brancher "stable"?
Definition ldsb.hh:82
Gecode::Set::LDSB::LDSBSetBrancher::_nCopiedSyms
int _nCopiedSyms
Number of copied symmetries.
Definition ldsb.hh:71
Gecode::Set::LDSB::LDSBSetBrancher::_prevPos
int _prevPos
Position of previous variable that was branched on.
Definition ldsb.hh:62
Gecode::Set::LDSB::LDSBSetBrancher::_copiedSyms
ValueSymmetryImp< View > ** _copiedSyms
Copy of value symmetries from the first node where the current variable was branched on.
Definition ldsb.hh:69
Gecode::Set::LDSB::LDSBSetBrancher::copy
virtual Actor * copy(Space &home)
Perform cloning.
Definition brancher.hpp:249
Gecode::Set::LDSB::LDSBSetBrancher::commit
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int b)
Perform commit for choice c and alternative b.
Definition brancher.hpp:204
Gecode::Set::LDSB::LDSBSetBrancher::_leftBranchValues
IntSet _leftBranchValues
Set of values used on left branches for the current variable.
Definition ldsb.hh:73
Gecode::Set::LDSB::LDSBSetBrancher::_nNonValueSymmetries
int _nNonValueSymmetries
Number of non-value symmetries.
Definition ldsb.hh:64
Gecode::Set::LDSB::LDSBSetBrancher::postldsbsetbrancher
void postldsbsetbrancher(Home home, ViewArray< View0 > &x, ViewSel< View0 > *vs[n0], ValSelCommitBase< View0, Val0 > *vsc, SymmetryImp< View0 > **syms, int nsyms, BranchFilter< typename View0::VarType > bf, VarValPrint< typename View0::VarType, Val0 > vvp)
Post LDSB brancher.
Gecode::Set::LDSB::LDSBSetBrancher::LDSBSetBrancher
LDSBSetBrancher(Space &home, LDSBSetBrancher &b)
Constructor for cloning b.
Gecode::Set::LDSB::LDSBSetBrancher::updatePart1
void updatePart1(Space &home, int choicePos)
Part one of the update phase.
Definition brancher.hpp:134
Gecode::Set::LDSB::LDSBSetBrancher::_nValueSymmetries
int _nValueSymmetries
Number of value symmetries.
Definition ldsb.hh:66
Gecode::Set::LDSB::LDSBSetBrancher::post
static void post(Home home, ViewArray< View > &x, ViewSel< View > *vs[n], ValSelCommitBase< View, Val > *vsc, SymmetryImp< View > **_syms, int _nsyms, BranchFilter< Var > bf, VarValPrint< Var, Val > vvp)
Brancher post function.
Definition brancher.hpp:258
Gecode::Set::LDSB::LDSBSetBrancher::LDSBSetBrancher
LDSBSetBrancher(Home home, ViewArray< View > &x, ViewSel< View > *vs[n], ValSelCommitBase< View, Val > *vsc, SymmetryImp< View > **syms, int nsyms, BranchFilter< Var > bf, VarValPrint< Var, Val > vvp)
Constructor for creation.
Gecode::Set::LDSB::LDSBSetBrancher::choice
virtual const Choice * choice(Space &home)
Return choice.
Definition brancher.hpp:184
Gecode::ValSelCommitBase
Base class for value selection and commit.
Definition val-sel-commit.hpp:44
Gecode::ViewArray
View arrays.
Definition array.hpp:253
Gecode::ViewBrancher::x
ViewArray< View > x
Views to branch on.
Definition view.hpp:83
Gecode::ViewBrancher::vs
ViewSel< View > * vs[n]
View selection objects.
Definition view.hpp:87
Gecode::ViewSel
Abstract class for view selection.
Definition view-sel.hpp:44
Gecode::ViewValBrancher::vsc
ValSelCommitBase< View, Val > * vsc
Value selection and commit object.
Definition view-val.hpp:99
set.hh
ldsb.hh
Gecode::Set::LDSB
Symmetry breaking for set variables.
Definition ldsb.cpp:65
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode
Gecode toplevel namespace
Gecode::VarValPrint
std::function< void(const Space &home, const Brancher &b, unsigned int a, Var x, int i, const Val &m, std::ostream &o)> VarValPrint
Function type for printing variable and value selection.
Definition print.hpp:40
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
Gecode::BranchFilter
std::function< bool(const Space &home, Var x, int i)> BranchFilter
Function type for branch filter functions.
Definition filter.hpp:40
Test::Float::Arithmetic::a
Gecode::FloatVal a(-8, 5)
brancher.hpp