16 #ifndef PAAL_IR_COMPONENTS_HPP
17 #define PAAL_IR_COMPONENTS_HPP
27 #include <boost/optional.hpp>
28 #include <boost/range/iterator_range.hpp>
29 #include <boost/tuple/tuple.hpp>
49 template <
typename Problem,
typename LP>
53 double r = std::round(x);
79 template <
int arg,
int... args>
90 template <
typename Problem,
typename LP>
98 template <
typename LP>
99 boost::optional<double>
get(
const LP & lp,
double x) {
100 if (this->m_compare.e(x, arg)) {
123 template <
typename LP> boost::optional<double>
get(
const LP &lp,
double x) {
145 template <
typename Problem,
typename LP>
169 : m_bound(b), m_compare(epsilon) {}
198 template <
typename Problem,
typename LP>
200 return lp.solve_simplex(lp::PRIMAL);
209 template <
typename Problem,
typename LP>
211 return lp.resolve_simplex(lp::PRIMAL);
228 template <
typename Problem,
typename LP>
232 if (!
m_compare.
e(col_val, std::round(col_val))) {
263 class RoundCondition;
264 class RelaxCondition;
269 class RelaxationsLimit;
284 template <
typename... Args>
290 template <
typename... Args>
299 #endif // PAAL_IR_COMPONENTS_HPP
lp::problem_type operator()(Problem &, LP &lp)
Finds an extreme point solution to the LP.
Checks if the relaxations limit was reached.
boost::optional< double > operator()(Problem &, const LP &lp, lp::col_id col)
Rounds the column if its value is integral.
The common LP solvers base class. Responsible for:
problem_type
LP problem type.
bool operator()(double x)
Checks if a variable is greater or equal than a fixed bound.
lp::problem_type operator()(Problem &, LP &lp)
Finds an extreme point solution to the LP.
Finds an extreme point solution to the LP.
boost::optional< double > operator()(Problem &, const LP &lp, lp::col_id col)
static type< special_decay_t< components >...> make_components(components &&...comps)
make function for components
bool operator()(int relaxed)
Checks if the relaxations limit was reached.
Column rounding component. Rounds a column if its value is equal to one of the template parameter val...
This structure can be passed on Names list and represents Name and the default type value...
This file contains set of simple useful functors or functor adapters.
const utils::compare< double > m_compare
Double comparison object.
boost::optional< double > operator()(Problem &, const LP &lp, lp::col_id col)
Rounds a column if its value satisfies a fixed condition.
Finds an extreme point solution to the LP.
Default stop condition component.
default_round_condition(double epsilon=utils::compare< double >::default_epsilon())
constructor takes epsilon used in double comparison.
Checks if a variable is greater or equal than a fixed bound.
Column rounding component. A variable is rounded up to 1, if it has value at least half in the soluti...
const utils::compare< double > m_compare
Double comparison object.
bool ge(T a, T b) const
greater equals
Class for comparing floating point.
Column rounding component. Rounds a column if its value satisfies a fixed condition. The column is rounded to a value defined by a fixed function.
typename components::type< Args...> IRcomponents
Iterative rounding components.
bool operator()(Problem &, const LP &lp)
Checks if the current LP solution has got only integer values.
const utils::compare< double > m_compare
Double comparison object.
relaxations_limit_condition(int limit=1)
Constructor.
const ColSet & get_columns() const
double get_col_value(col_id col) const
round_condition_to_fun(Cond c=Cond(), F f=F())
Constructor. Takes the rounding condition and the rounding function.
round_condition_equals(double epsilon=utils::compare< double >::default_epsilon())
constructor takes epsilon used in double comparison.
bool e(T a, T b) const
equals
Default column rounding condition component.
round_condition_greater_than_half(double epsilon=utils::compare< double >::default_epsilon())
constructor takes epsilon used in double comparison.
round_condition_equals(double epsilon=utils::compare< double >::default_epsilon())
constructor takes epsilon used in double comparison.
auto make_IRcomponents(Args &&...args) -> decltype(components::make_components(std::forward< Args >(args)...))
Returns iterative rounding components.
default_stop_condition(double epsilon=utils::compare< double >::default_epsilon())
Constructor. Takes epsilon used in double comparison.
cond_bigger_equal_than(double b, double epsilon=utils::compare< double >::default_epsilon())
constructor takes epsilon used in double comparison.