view-sel.cpp
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.
*
*/
#include <gecode/float/branch.hh>
namespace Gecode { namespace Float { namespace Branch {
ViewSel<FloatView>*
viewsel(Space& home, const FloatVarBranch& fvb) {
switch (fvb.select()) {
case FloatVarBranch::SEL_NONE:
return new (home) ViewSelNone<FloatView>(home,fvb);
case FloatVarBranch::SEL_RND:
return new (home) ViewSelRnd<FloatView>(home,fvb);
default: break;
}
if (fvb.tbl() != NULL) {
switch (fvb.select()) {
case FloatVarBranch::SEL_MERIT_MIN:
return new (home) ViewSelMinTbl<MeritFunction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_MERIT_MAX:
return new (home) ViewSelMaxTbl<MeritFunction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_MIN_MIN:
return new (home) ViewSelMinTbl<MeritMin>(home,fvb);
case FloatVarBranch::SEL_MIN_MAX:
return new (home) ViewSelMaxTbl<MeritMin>(home,fvb);
case FloatVarBranch::SEL_MAX_MIN:
return new (home) ViewSelMinTbl<MeritMax>(home,fvb);
case FloatVarBranch::SEL_MAX_MAX:
return new (home) ViewSelMaxTbl<MeritMax>(home,fvb);
case FloatVarBranch::SEL_SIZE_MIN:
return new (home) ViewSelMinTbl<MeritSize>(home,fvb);
case FloatVarBranch::SEL_SIZE_MAX:
return new (home) ViewSelMaxTbl<MeritSize>(home,fvb);
case FloatVarBranch::SEL_DEGREE_MIN:
return new (home) ViewSelMinTbl<MeritDegree<FloatView>>(home,fvb);
case FloatVarBranch::SEL_DEGREE_MAX:
return new (home) ViewSelMaxTbl<MeritDegree<FloatView>>(home,fvb);
case FloatVarBranch::SEL_AFC_MIN:
return new (home) ViewSelMinTbl<MeritAFC<FloatView>>(home,fvb);
case FloatVarBranch::SEL_AFC_MAX:
return new (home) ViewSelMaxTbl<MeritAFC<FloatView>>(home,fvb);
case FloatVarBranch::SEL_ACTION_MIN:
return new (home) ViewSelMinTbl<MeritAction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_ACTION_MAX:
return new (home) ViewSelMaxTbl<MeritAction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_CHB_MIN:
return new (home) ViewSelMinTbl<MeritCHB<FloatView>>(home,fvb);
case FloatVarBranch::SEL_CHB_MAX:
return new (home) ViewSelMaxTbl<MeritCHB<FloatView>>(home,fvb);
case FloatVarBranch::SEL_DEGREE_SIZE_MIN:
return new (home) ViewSelMinTbl<MeritDegreeSize>(home,fvb);
case FloatVarBranch::SEL_DEGREE_SIZE_MAX:
return new (home) ViewSelMaxTbl<MeritDegreeSize>(home,fvb);
case FloatVarBranch::SEL_AFC_SIZE_MIN:
return new (home) ViewSelMinTbl<MeritAFCSize>(home,fvb);
case FloatVarBranch::SEL_AFC_SIZE_MAX:
return new (home) ViewSelMaxTbl<MeritAFCSize>(home,fvb);
case FloatVarBranch::SEL_ACTION_SIZE_MIN:
return new (home) ViewSelMinTbl<MeritActionSize>(home,fvb);
case FloatVarBranch::SEL_ACTION_SIZE_MAX:
return new (home) ViewSelMaxTbl<MeritActionSize>(home,fvb);
case FloatVarBranch::SEL_CHB_SIZE_MIN:
return new (home) ViewSelMinTbl<MeritCHBSize>(home,fvb);
case FloatVarBranch::SEL_CHB_SIZE_MAX:
return new (home) ViewSelMaxTbl<MeritCHBSize>(home,fvb);
default:
throw UnknownBranching("Float::branch");
}
} else {
switch (fvb.select()) {
case FloatVarBranch::SEL_MERIT_MIN:
return new (home) ViewSelMin<MeritFunction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_MERIT_MAX:
return new (home) ViewSelMax<MeritFunction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_MIN_MIN:
return new (home) ViewSelMin<MeritMin>(home,fvb);
case FloatVarBranch::SEL_MIN_MAX:
return new (home) ViewSelMax<MeritMin>(home,fvb);
case FloatVarBranch::SEL_MAX_MIN:
return new (home) ViewSelMin<MeritMax>(home,fvb);
case FloatVarBranch::SEL_MAX_MAX:
return new (home) ViewSelMax<MeritMax>(home,fvb);
case FloatVarBranch::SEL_SIZE_MIN:
return new (home) ViewSelMin<MeritSize>(home,fvb);
case FloatVarBranch::SEL_SIZE_MAX:
return new (home) ViewSelMax<MeritSize>(home,fvb);
case FloatVarBranch::SEL_DEGREE_MIN:
return new (home) ViewSelMin<MeritDegree<FloatView>>(home,fvb);
case FloatVarBranch::SEL_DEGREE_MAX:
return new (home) ViewSelMax<MeritDegree<FloatView>>(home,fvb);
case FloatVarBranch::SEL_AFC_MIN:
return new (home) ViewSelMin<MeritAFC<FloatView>>(home,fvb);
case FloatVarBranch::SEL_AFC_MAX:
return new (home) ViewSelMax<MeritAFC<FloatView>>(home,fvb);
case FloatVarBranch::SEL_ACTION_MIN:
return new (home) ViewSelMin<MeritAction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_ACTION_MAX:
return new (home) ViewSelMax<MeritAction<FloatView>>(home,fvb);
case FloatVarBranch::SEL_CHB_MIN:
return new (home) ViewSelMin<MeritCHB<FloatView>>(home,fvb);
case FloatVarBranch::SEL_CHB_MAX:
return new (home) ViewSelMax<MeritCHB<FloatView>>(home,fvb);
case FloatVarBranch::SEL_DEGREE_SIZE_MIN:
return new (home) ViewSelMin<MeritDegreeSize>(home,fvb);
case FloatVarBranch::SEL_DEGREE_SIZE_MAX:
return new (home) ViewSelMax<MeritDegreeSize>(home,fvb);
case FloatVarBranch::SEL_AFC_SIZE_MIN:
return new (home) ViewSelMin<MeritAFCSize>(home,fvb);
case FloatVarBranch::SEL_AFC_SIZE_MAX:
return new (home) ViewSelMax<MeritAFCSize>(home,fvb);
case FloatVarBranch::SEL_ACTION_SIZE_MIN:
return new (home) ViewSelMin<MeritActionSize>(home,fvb);
case FloatVarBranch::SEL_ACTION_SIZE_MAX:
return new (home) ViewSelMax<MeritActionSize>(home,fvb);
case FloatVarBranch::SEL_CHB_SIZE_MIN:
return new (home) ViewSelMin<MeritCHBSize>(home,fvb);
case FloatVarBranch::SEL_CHB_SIZE_MAX:
return new (home) ViewSelMax<MeritCHBSize>(home,fvb);
default:
throw UnknownBranching("Float::branch");
}
}
GECODE_NEVER;
return NULL;
}
}}}
// STATISTICS: float-branch
Gecode::FloatVarBranch
Which variable to select for branching.
Definition float.hh:1668
Gecode::FloatVarBranch::select
Select select(void) const
Return selection strategy.
Definition var.hpp:69
Gecode::FloatVarBranch::SEL_ACTION_SIZE_MIN
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition float.hh:1694
Gecode::FloatVarBranch::SEL_ACTION_SIZE_MAX
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition float.hh:1695
Gecode::FloatVarBranch::SEL_MIN_MIN
@ SEL_MIN_MIN
With smallest min.
Definition float.hh:1684
Gecode::FloatVarBranch::SEL_AFC_SIZE_MIN
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition float.hh:1692
Gecode::FloatVarBranch::SEL_MAX_MAX
@ SEL_MAX_MAX
With largest max.
Definition float.hh:1687
Gecode::FloatVarBranch::SEL_AFC_SIZE_MAX
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition float.hh:1693
Gecode::FloatVarBranch::SEL_CHB_MAX
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition float.hh:1683
Gecode::FloatVarBranch::SEL_DEGREE_SIZE_MIN
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition float.hh:1690
Gecode::FloatVarBranch::SEL_MIN_MAX
@ SEL_MIN_MAX
With largest min.
Definition float.hh:1685
Gecode::FloatVarBranch::SEL_CHB_SIZE_MIN
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition float.hh:1696
Gecode::FloatVarBranch::SEL_NONE
@ SEL_NONE
First unassigned.
Definition float.hh:1672
Gecode::FloatVarBranch::SEL_MERIT_MIN
@ SEL_MERIT_MIN
With least merit.
Definition float.hh:1674
Gecode::FloatVarBranch::SEL_ACTION_MAX
@ SEL_ACTION_MAX
With highest action.
Definition float.hh:1681
Gecode::FloatVarBranch::SEL_CHB_MIN
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition float.hh:1682
Gecode::FloatVarBranch::SEL_DEGREE_MAX
@ SEL_DEGREE_MAX
With largest degree.
Definition float.hh:1677
Gecode::FloatVarBranch::SEL_DEGREE_SIZE_MAX
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition float.hh:1691
Gecode::FloatVarBranch::SEL_DEGREE_MIN
@ SEL_DEGREE_MIN
With smallest degree.
Definition float.hh:1676
Gecode::FloatVarBranch::SEL_MERIT_MAX
@ SEL_MERIT_MAX
With highest merit.
Definition float.hh:1675
Gecode::FloatVarBranch::SEL_MAX_MIN
@ SEL_MAX_MIN
With smallest max.
Definition float.hh:1686
Gecode::FloatVarBranch::SEL_CHB_SIZE_MAX
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition float.hh:1697
Gecode::FloatVarBranch::SEL_RND
@ SEL_RND
Random (uniform, for tie breaking).
Definition float.hh:1673
Gecode::FloatVarBranch::SEL_AFC_MAX
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition float.hh:1679
Gecode::FloatVarBranch::SEL_SIZE_MAX
@ SEL_SIZE_MAX
With largest domain size.
Definition float.hh:1689
Gecode::FloatVarBranch::SEL_AFC_MIN
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition float.hh:1678
Gecode::FloatVarBranch::SEL_ACTION_MIN
@ SEL_ACTION_MIN
With lowest action.
Definition float.hh:1680
Gecode::FloatVarBranch::SEL_SIZE_MIN
@ SEL_SIZE_MIN
With smallest domain size.
Definition float.hh:1688
Gecode::Float::UnknownBranching
Exception: Unknown value or variable selection passed as argument
Definition exception.hpp:109
Gecode::MeritAFC
Merit class for AFC.
Definition merit.hpp:108
Gecode::MeritAction
Merit class for action.
Definition merit.hpp:130
Gecode::MeritCHB
Merit class for CHB.
Definition merit.hpp:153
Gecode::MeritDegree
Merit class for degree.
Definition merit.hpp:93
Gecode::MeritFunction
Merit class for user-defined merit function.
Definition merit.hpp:68
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarBranch::tbl
BranchTbl tbl(void) const
Return tie-break limit function.
Definition var.hpp:168
Gecode::ViewSelMaxTbl
Select view with largest merit taking tie-break limit into account.
Definition view-sel.hpp:355
Gecode::ViewSelMax
Select view with largest merit.
Definition view-sel.hpp:335
Gecode::ViewSelMinTbl
Select view with least merit taking tie-break limit into account.
Definition view-sel.hpp:315
Gecode::ViewSelMin
Select view with least merit.
Definition view-sel.hpp:295
Gecode::ViewSelNone
Select the first unassigned view.
Definition view-sel.hpp:109
Gecode::ViewSelRnd
Select a view randomly.
Definition view-sel.hpp:149
branch.hh
Gecode::Float::Branch
Float branchers.
Gecode::Float::Branch::viewsel
ViewSel< FloatView > * viewsel(Space &home, const FloatVarBranch &fvb)
Return view selectors for float views.
Definition view-sel.cpp:39
Gecode::Float
Floating point numbers.
Gecode
Gecode toplevel namespace
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56