Camargue
Namespaces
solver_loops.cpp File Reference

Private Solver methods with loop calls or utility functions. More...

#include "config.hpp"
#include "solver.hpp"
#include "separator.hpp"
#include "err_util.hpp"
#include <array>
#include <iostream>
#include <limits>
#include <stdexcept>
#include <functional>
#include <vector>
#include <cmath>
#include <cstdio>
Include dependency graph for solver_loops.cpp:

Namespaces

 CMR
 The namespace for this project.
 

Macros

Convenience macros for separation routines in Solver::cut_and_piv.

These macros are meant to be used in the body of the main while loop in Solver::cut_and_piv to invoke a separation routine using Solver::call_separator, and then restart or advance the loop as needed.

This saves the use of repetitive boilerplate which can make it hard to navigate the loop at a glance, given the return and continue statements which may not be easy to abstract into a real function template.

#define CUT_PIV_CALL(sep_ptr, find_fn, cuts_q, sep_name)
 Macro for invoking a conventional separation routine. More...
 
#define META_SEP_PIV_CALL(meta_type, sep_name)
 Macro for invoking cut metamorphosis separation. More...
 

Detailed Description

Private Solver methods with loop calls or utility functions.

Macro Definition Documentation

#define CUT_PIV_CALL (   sep_ptr,
  find_fn,
  cuts_q,
  sep_name 
)
Value:
try { \
reset_separator(sep_ptr); \
if (call_separator([&sep_ptr, this]() \
{ return sep_ptr->find_fn; }, \
sep_ptr->cuts_q(), sep_name, piv, piv_stats)) { \
if (return_pivot(piv)) \
return piv; \
\
if (restart_loop(piv, piv_stats.delta_ratio)) \
continue; \
} \
} CMR_CATCH_PRINT_THROW(sep_name, err);
#define CMR_CATCH_PRINT_THROW(msg, new_ex)
Macro for handling errors in function with multiple failure points.
Definition: err_util.hpp:25

Macro for invoking a conventional separation routine.

In the body of Solver::cut_and_piv, this can be used to invoke a straightforward separation routine which is just called and used to update stats. See below for example usage.

#define META_SEP_PIV_CALL (   meta_type,
  sep_name 
)
Value:
try { \
reset_separator(meta_sep); \
if (call_separator([&meta_sep]() \
{ return meta_sep->find_cuts(meta_type); }, \
meta_sep->metacuts_q(), sep_name, piv, \
piv_stats)) { \
if (return_pivot(piv)) \
return piv; \
\
if (restart_loop(piv, piv_stats.delta_ratio)) \
continue; \
} \
} CMR_CATCH_PRINT_THROW(sep_name, err);
#define CMR_CATCH_PRINT_THROW(msg, new_ex)
Macro for handling errors in function with multiple failure points.
Definition: err_util.hpp:25

Macro for invoking cut metamorphosis separation.

This can be used for a straightforward invocation of one of the Sep::MetaCuts separation routines. See below for example usage.