val-sel-commit.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 {
ValSelCommitBase<FloatView,FloatNumBranch>*
valselcommit(Space& home, const FloatValBranch& fvb) {
switch (fvb.select()) {
case FloatValBranch::SEL_SPLIT_MIN:
return new (home) ValSelCommit<ValSelLq,ValCommitLqGq>(home,fvb);
case FloatValBranch::SEL_SPLIT_MAX:
return new (home) ValSelCommit<ValSelGq,ValCommitLqGq>(home,fvb);
case FloatValBranch::SEL_SPLIT_RND:
return new (home) ValSelCommit<ValSelRnd,ValCommitLqGq>(home,fvb);
case FloatValBranch::SEL_VAL_COMMIT:
if (!fvb.commit()) {
return new (home)
ValSelCommit<ValSelFunction<FloatView>,ValCommitLqGq>(home,fvb);
} else {
return new (home)
ValSelCommit<ValSelFunction<FloatView>,ValCommitFunction<FloatView> >(home,fvb);
}
default:
throw UnknownBranching("Float::branch");
}
}
ValSelCommitBase<FloatView,FloatNumBranch>*
valselcommit(Space& home, const FloatAssign& fa) {
switch (fa.select()) {
case FloatAssign::SEL_MIN:
return new (home) ValSelCommit<ValSelLq,ValCommitLqGq>(home,fa);
case FloatAssign::SEL_MAX:
return new (home) ValSelCommit<ValSelGq,ValCommitLqGq>(home,fa);
case FloatAssign::SEL_RND:
return new (home) ValSelCommit<ValSelRnd,ValCommitLqGq>(home,fa);
case FloatAssign::SEL_VAL_COMMIT:
if (!fa.commit()) {
return new (home)
ValSelCommit<ValSelFunction<FloatView>,ValCommitLqGq>(home,fa);
} else {
return new (home)
ValSelCommit<ValSelFunction<FloatView>,ValCommitFunction<FloatView> >(home,fa);
}
default:
throw UnknownBranching("Float::assign");
}
}
}}}
// STATISTICS: float-branch
Gecode::FloatAssign
Which values to select for assignment.
Definition float.hh:1874
Gecode::FloatAssign::SEL_MAX
@ SEL_MAX
Select median value of the upper part.
Definition float.hh:1879
Gecode::FloatAssign::SEL_VAL_COMMIT
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1881
Gecode::FloatAssign::SEL_RND
@ SEL_RND
Select median value of a randomly chosen part.
Definition float.hh:1880
Gecode::FloatAssign::SEL_MIN
@ SEL_MIN
Select median value of the lower part.
Definition float.hh:1878
Gecode::FloatAssign::select
Select select(void) const
Return selection strategy.
Definition assign.hpp:49
Gecode::FloatValBranch
Which values to select for branching first.
Definition float.hh:1820
Gecode::FloatValBranch::select
Select select(void) const
Return selection strategy.
Definition val.hpp:49
Gecode::FloatValBranch::SEL_SPLIT_RND
@ SEL_SPLIT_RND
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition float.hh:1826
Gecode::FloatValBranch::SEL_SPLIT_MIN
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition float.hh:1824
Gecode::FloatValBranch::SEL_VAL_COMMIT
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1827
Gecode::FloatValBranch::SEL_SPLIT_MAX
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition float.hh:1825
Gecode::Float::Branch::ValCommitLqGq
Value commit class for less or equal or greater or equal.
Definition branch.hh:298
Gecode::Float::UnknownBranching
Exception: Unknown value or variable selection passed as argument
Definition exception.hpp:109
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::ValBranch::commit
BranchCommit commit(void) const
Return commit function.
Definition val.hpp:102
Gecode::ValCommitFunction
Class for user-defined value commit.
Definition val-commit.hpp:67
Gecode::ValSelCommitBase
Base class for value selection and commit.
Definition val-sel-commit.hpp:44
Gecode::ValSelCommit
Class for value selection and commit.
Definition val-sel-commit.hpp:91
Gecode::ValSelFunction
User-defined value selection.
Definition val-sel.hpp:67
branch.hh
Gecode::Float::Branch
Float branchers.
Gecode::Float::Branch::valselcommit
ValSelCommitBase< FloatView, FloatNumBranch > * valselcommit(Space &home, const FloatValBranch &svb)
Return value and commit for float views.
Definition val-sel-commit.cpp:39
Gecode::Float
Floating point numbers.
Gecode
Gecode toplevel namespace