LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
wf_auto_integration.h File Reference

Workflow-aware solver recommendation: the port of jar/src/main/java/jline/api/wf/Wf_auto_integration.java. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <string>
#include <vector>
#include "line/api/wf/wf_analyzer.h"
#include "line/lang/qn/network_struct.h"
#include "line/num/number.h"
#include "line/util/matrix.h"
Include dependency graph for wf_auto_integration.h:

Go to the source code of this file.

Classes

struct  line::wf::WorkflowFeatures< T >
 The flat feature vector the recommendation reads. More...
struct  line::wf::ExtendedSolverRecommendation< T >
 What the recommendation returns: the choice and why. More...
struct  line::wf::WfModelFacts< T >
 The four model facts the base recommendation reads, i.e. More...
struct  line::wf::OptimizationInsights
 The advisory text the reference's getOptimizationInsights assembles. More...

Namespaces

namespace  line
namespace  line::wf

Enumerations

enum class  line::wf::WfSolver {
  line::wf::MVA = 0 , line::wf::NC , line::wf::SSA , line::wf::FLUID ,
  line::wf::JMT , line::wf::CTMC , line::wf::AUTO
}
 The solvers the reference chooses among. More...

Functions

std::string line::wf::wf_solver_name (WfSolver s)
 The reference's own spelling of each choice.
template<class T>
WfModelFacts< T > line::wf::wf_model_facts (const qn::NetworkStruct< T > &sn)
 Read the base facts off a NetworkStruct.
template<class T>
WfSolver line::wf::wf_base_recommendation (const WfModelFacts< T > &f)
 The AUTO heuristic before the workflow features amend it.
template<class T>
WorkflowFeatures< T > line::wf::extract_workflow_features (const WorkflowAnalysis< T > &a)
 Flatten the analysis into the feature vector the heuristic reads.
template<class T>
ExtendedSolverRecommendation< T > line::wf::enhance_recommendation_with_workflow (WfSolver base, const WorkflowFeatures< T > &f, const WorkflowAnalysis< T > &a)
 Amend the base recommendation with what the workflow analysis found.
template<class T>
ExtendedSolverRecommendation< T > line::wf::recommend_solver_with_workflow_analysis (const qn::NetworkStruct< T > &sn)
 The entry point: analyse the workflow, then let it amend the base choice.
template<class T>
WfSolver line::wf::create_optimal_solver (const qn::NetworkStruct< T > &sn)
 The chosen solver alone, i.e.
template<class T>
std::vector< std::string > line::wf::generate_pattern_insights (const DetectedPatterns< T > &p)
 Pattern-level advice; the strings are the reference's, verbatim.
template<class T>
std::vector< std::string > line::wf::generate_performance_predictions (const WorkflowAnalysis< T > &a)
 Solve-time advice keyed off the collapse ratio and the pattern mix.
template<class T>
OptimizationInsights line::wf::get_optimization_insights (const qn::NetworkStruct< T > &sn)
 All three advisory blocks for one model.
template<class T>
bool line::wf::validate_workflow_enhancement (const qn::NetworkStruct< T > &sn)
 The reference's self-check: a usable recommendation over a valid analysis.

Detailed Description

Workflow-aware solver recommendation: the port of jar/src/main/java/jline/api/wf/Wf_auto_integration.java.

The routine takes the pattern analysis of wf_analyzer.h, turns it into a flat feature vector, and lets those features amend the recommendation the AUTO heuristic would give from the model alone. It is a HEURISTIC, not an analysis: the numbers below (0.7 seed confidence, the 5-way parallelism threshold, the 0.8 and 0.5 loop-probability bands, the 1.5 and 0.5 entropy bands, the 50-node size gate) are the reference's constants and are ported verbatim, because a caller comparing the two codebases compares the ADVICE, and advice that differs by a tuned constant is a different answer.

TWO DELIBERATE DEPARTURES FROM THE JAVA, both structural rather than behavioural:

  1. The feature bag is a TYPED STRUCT, not a Map<String, Object>. The Java reads each feature back with an instanceof test and substitutes 0 when the cast fails, so a mistyped or missing key degrades silently into a neutral value. Every one of those defaults is reproduced here by the struct's initializer, and the present flags below stand in for the Java's key-absent case – the arms guarded by !patterns.X.isEmpty() never populate their keys otherwise.
  2. createOptimalSolver returns a CHOICE, not a constructed solver. The C++ solvers are free functions over a NetworkStruct rather than a runtime polymorphic family, so there is no NetworkSolver to hand back; the caller dispatches on the enum. Returning the choice also keeps api/ from depending on solvers/, which is the tree's layering.

The JAR reaches branchNodes by REFLECTION in generatePatternInsights, which is a workaround for its own generics and silently yields 0 on any exception; here it is a plain member read, so the insight fires when it should.

ARITHMETIC: field, plus what the branch entropy needs (gated in wf_branch_detector.h).

Definition in file wf_auto_integration.h.