LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::lqn::nlp_detail Namespace Reference

Classes

struct  LldEvalError
 An evaluation failure, carrying the python exception name the message reports. More...
struct  LldSyntaxError
 A parse failure: the text is not an expression of the grammar. More...
class  LldExpr
 An lld expression, parsed once and evaluated over std::complex<double>. More...
struct  ForkBlock
 One AND-fork/join block, in absolute LQN indices. More...

Typedefs

using cplx = std::complex<double>

Functions

std::string fmt (const char *f, double v)
std::string py_repr (double v)
 Python's repr of a float: the shortest round-tripping digits, in python's layout.
std::string py_repr (const cplx &z)
 Python's repr of a value that may be complex.
double re (double x)
double re (const cplx &z)
template<class S>
S softmin (const S &a, const S &b, double alpha)
 Smooth stand-in for min(a, b), verbatim python _SOFTMIN_SRC; real or complex.
std::string check_lld (const std::string &src, std::shared_ptr< const LldExpr > &out)
 Why an lld expression cannot be used, or empty: python _check_lld verbatim.
std::vector< double > lstsq_min_norm (const Matrix< double > &A, const std::vector< double > &b)
 One-sided Jacobi SVD of A (m x n), returning the min-norm least-squares solution of A x = b.
double norm2 (const std::vector< double > &v)
UnsupportedError nlp_error (const std::string &msg)
template<class T>
std::string elem (const LqnStruct< T > &lqn, std::size_t idx)
template<class T>
std::string callnm (const LqnStruct< T > &lqn, std::size_t c)
template<class T>
double hostdem_mean (const LqnStruct< T > &lqn, std::size_t a)
template<class T>
bool is_post_and (const LqnStruct< T > &lqn, std::size_t a)
template<class T>
bool is_pre_and (const LqnStruct< T > &lqn, std::size_t a)
template<class T>
std::size_t quorum_of (const LqnStruct< T > &lqn, std::size_t a)
template<class T>
std::string read_block (const LqnStruct< T > &lqn, const std::vector< std::size_t > &A, const std::vector< std::size_t > &H, const std::vector< std::size_t > &srcs, const std::map< std::size_t, std::vector< std::size_t > > &succ, const std::map< std::size_t, std::vector< std::size_t > > &prd, ForkBlock &blk)
 python _read_block: one candidate block, or the reason it is not one.
template<class T>
std::vector< ForkBlock > fork_blocks (const LqnStruct< T > &lqn, const std::string &fork, std::vector< std::string > &bad)
 python _fork_blocks: the well-formed blocks, and every AND marking outside one.
template<class T>
std::vector< ForkBlock > scope_check (const LqnStruct< T > &lqn, const std::string &fork)
 python _scope_check: the blocks, or LINE:unsupported:NlpExport naming every offender.
double tot (const std::vector< double > &pops)
double delta (double t)
std::string strip (const std::string &s)

Typedef Documentation

◆ cplx

using line::lqn::nlp_detail::cplx = std::complex<double>

Definition at line 100 of file lqn_export_nlp.h.

Function Documentation

◆ callnm()

template<class T>
std::string line::lqn::nlp_detail::callnm ( const LqnStruct< T > & lqn,
std::size_t c )

Definition at line 1223 of file lqn_export_nlp.h.

References callnm().

Referenced by callnm(), and scope_check().

◆ check_lld()

std::string line::lqn::nlp_detail::check_lld ( const std::string & src,
std::shared_ptr< const LldExpr > & out )
inline

Why an lld expression cannot be used, or empty: python _check_lld verbatim.

Real and positive at n = 1, 2.5, 10, and analytic, which a complex step compared against a central difference at n = 2.5 verifies.

Definition at line 510 of file lqn_export_nlp.h.

References check_lld(), fmt(), line::lqn::nlp_detail::LldEvalError::kind, and py_repr().

Referenced by check_lld().

◆ delta()

double line::lqn::nlp_detail::delta ( double t)
inline

Definition at line 1506 of file lqn_export_nlp.h.

References delta().

Referenced by delta().

◆ elem()

template<class T>
std::string line::lqn::nlp_detail::elem ( const LqnStruct< T > & lqn,
std::size_t idx )

Definition at line 1217 of file lqn_export_nlp.h.

References elem().

Referenced by elem(), fork_blocks(), read_block(), and scope_check().

◆ fmt()

std::string line::lqn::nlp_detail::fmt ( const char * f,
double v )
inline

Definition at line 102 of file lqn_export_nlp.h.

References fmt().

Referenced by check_lld(), fmt(), scope_check(), and line::lqn::NlpProgram::solve().

◆ fork_blocks()

template<class T>
std::vector< ForkBlock > line::lqn::nlp_detail::fork_blocks ( const LqnStruct< T > & lqn,
const std::string & fork,
std::vector< std::string > & bad )

python _fork_blocks: the well-formed blocks, and every AND marking outside one.

Definition at line 1362 of file lqn_export_nlp.h.

References elem(), fork_blocks(), is_post_and(), is_pre_and(), and read_block().

Referenced by fork_blocks(), and scope_check().

◆ hostdem_mean()

template<class T>
double line::lqn::nlp_detail::hostdem_mean ( const LqnStruct< T > & lqn,
std::size_t a )

Definition at line 1229 of file lqn_export_nlp.h.

References hostdem_mean().

Referenced by hostdem_mean(), and read_block().

◆ is_post_and()

template<class T>
bool line::lqn::nlp_detail::is_post_and ( const LqnStruct< T > & lqn,
std::size_t a )

Definition at line 1244 of file lqn_export_nlp.h.

References is_post_and(), and line::lang::POST_AND.

Referenced by fork_blocks(), is_post_and(), and read_block().

◆ is_pre_and()

template<class T>
bool line::lqn::nlp_detail::is_pre_and ( const LqnStruct< T > & lqn,
std::size_t a )

Definition at line 1248 of file lqn_export_nlp.h.

References is_pre_and(), and line::lang::PRE_AND.

Referenced by fork_blocks(), is_pre_and(), and read_block().

◆ lstsq_min_norm()

std::vector< double > line::lqn::nlp_detail::lstsq_min_norm ( const Matrix< double > & A,
const std::vector< double > & b )
inline

One-sided Jacobi SVD of A (m x n), returning the min-norm least-squares solution of A x = b.

Definition at line 547 of file lqn_export_nlp.h.

References line::Matrix< T >::cols(), lstsq_min_norm(), and line::Matrix< T >::rows().

Referenced by lstsq_min_norm(), and line::lqn::NlpProgram::polish().

◆ nlp_error()

UnsupportedError line::lqn::nlp_detail::nlp_error ( const std::string & msg)
inline

Definition at line 1212 of file lqn_export_nlp.h.

References nlp_error(), and line::UnsupportedError::UnsupportedError().

Referenced by nlp_error(), and scope_check().

◆ norm2()

double line::lqn::nlp_detail::norm2 ( const std::vector< double > & v)
inline

Definition at line 607 of file lqn_export_nlp.h.

References norm2().

Referenced by line::lqn::NlpProgram::lm_fallback(), norm2(), and line::lqn::NlpProgram::polish().

◆ py_repr() [1/2]

std::string line::lqn::nlp_detail::py_repr ( const cplx & z)
inline

Python's repr of a value that may be complex.

Definition at line 151 of file lqn_export_nlp.h.

References py_repr(), and re().

◆ py_repr() [2/2]

std::string line::lqn::nlp_detail::py_repr ( double v)
inline

Python's repr of a float: the shortest round-tripping digits, in python's layout.

Definition at line 109 of file lqn_export_nlp.h.

References py_repr().

Referenced by check_lld(), py_repr(), and py_repr().

◆ quorum_of()

template<class T>
std::size_t line::lqn::nlp_detail::quorum_of ( const LqnStruct< T > & lqn,
std::size_t a )

Definition at line 1252 of file lqn_export_nlp.h.

References quorum_of().

Referenced by quorum_of(), and read_block().

◆ re() [1/2]

double line::lqn::nlp_detail::re ( const cplx & z)
inline

Definition at line 488 of file lqn_export_nlp.h.

References re().

◆ re() [2/2]

double line::lqn::nlp_detail::re ( double x)
inline

Definition at line 487 of file lqn_export_nlp.h.

References re().

Referenced by py_repr(), re(), re(), and softmin().

◆ read_block()

template<class T>
std::string line::lqn::nlp_detail::read_block ( const LqnStruct< T > & lqn,
const std::vector< std::size_t > & A,
const std::vector< std::size_t > & H,
const std::vector< std::size_t > & srcs,
const std::map< std::size_t, std::vector< std::size_t > > & succ,
const std::map< std::size_t, std::vector< std::size_t > > & prd,
ForkBlock & blk )

python _read_block: one candidate block, or the reason it is not one.

Definition at line 1258 of file lqn_export_nlp.h.

References elem(), hostdem_mean(), is_post_and(), is_pre_and(), quorum_of(), and read_block().

Referenced by fork_blocks(), and read_block().

◆ scope_check()

template<class T>
std::vector< ForkBlock > line::lqn::nlp_detail::scope_check ( const LqnStruct< T > & lqn,
const std::string & fork )

python _scope_check: the blocks, or LINE:unsupported:NlpExport naming every offender.

Definition at line 1433 of file lqn_export_nlp.h.

References callnm(), elem(), fmt(), fork_blocks(), nlp_error(), and scope_check().

Referenced by scope_check().

◆ softmin()

template<class S>
S line::lqn::nlp_detail::softmin ( const S & a,
const S & b,
double alpha )

Smooth stand-in for min(a, b), verbatim python _SOFTMIN_SRC; real or complex.

Definition at line 492 of file lqn_export_nlp.h.

References re(), and softmin().

Referenced by line::lqn::NlpRate::operator()(), line::lqn::NlpRate::operator()(), and softmin().

◆ strip()

std::string line::lqn::nlp_detail::strip ( const std::string & s)
inline

Definition at line 1511 of file lqn_export_nlp.h.

References strip().

Referenced by strip().

◆ tot()

double line::lqn::nlp_detail::tot ( const std::vector< double > & pops)
inline

Definition at line 1497 of file lqn_export_nlp.h.

References tot().

Referenced by tot().