ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
provsql::EvalContext Struct Reference

Per-evaluation circuit state threaded to a method's evaluate(). More...

Collaboration diagram for provsql::EvalContext:

Public Member Functions

void ensureMultivaluedRewritten ()
void ensureDnfShape () const
void ensureTreewidthProxy () const
double featureCost (Feature f) const
 Heuristic acquisition cost of f, in the same work units as a method's estimatedCost (so the chooser can compare "run this method" against "acquire this feature").
bool hasFeature (Feature f) const
void acquireFeature (Feature f)

Public Attributes

GenericCircuit * gc
gate_t gc_root
pg_uuid_t token
BooleanCircuit & c
gate_t gate
std::unordered_map< gate_t, gate_t > * gc_to_bc
bool inv_free_cert
const std::string & args
bool explicitly_named
 invoked via byName (vs the default chain)
size_t n_inputs = 0
 input count N (O(1) cost feature)
size_t circuit_size = 0
 gate count S, the circuit-size parameter (O(1))
double cost_budget = std::numeric_limits<double>::infinity()
 Speculative-execution budget: the estimated cost (in the chooser's ms-ish units) of the next-cheapest admissible method.
double outside_cost = std::numeric_limits<double>::infinity()
 Cost of an evaluation outside this Boolean view (sampling the equation systems of a recursion directly): the chooser gives up, throwing, rather than run a method or acquire a feature dearer than it.
bool multivalued_rewritten = false
std::string actual_method
bool linked_group = false
bool fold_component = false
bool dnf_computed_ = false
bool dnf_ok_ = false
std::size_t dnf_num_clauses_ = 0
bool tw_computed_ = false
unsigned tw_proxy_ = 0
double dtree_cost_floor_ = 0.
 Lower bound on the d-tree's cost, raised each time it overruns a budget.
double treedec_cost_floor_ = 0.
 Lower bound on tree-decomposition's cost, raised when the parts it builds (islands, folded groups, residual) overrun a budget together.
double treedec_spent_ = 0.
 Cost of the parts tree-decomposition has built in the current attempt.
double compilation_cost_floor_ = 0.
 Lower bound on compilation's cost, raised when the external compiler is stopped for running past its time limit.
double compilation_spent_ms_ = 0.
 Time, in ms, the external compiler has run in the current attempt.
unsigned tw_max_degree_ = 0

Detailed Description

Per-evaluation circuit state threaded to a method's evaluate().

The Boolean view c is built once in probability_evaluate_internal; methods that need the multivalued rewrite trigger it (idempotently) through this context, so the rewrite fires exactly for the methods that need it.

Definition at line 898 of file probability_evaluate.cpp.

Member Function Documentation

◆ acquireFeature()

void provsql::EvalContext::acquireFeature ( Feature f)
inline

Definition at line 1004 of file probability_evaluate.cpp.

Here is the call graph for this function:

◆ ensureDnfShape()

void provsql::EvalContext::ensureDnfShape ( ) const
inline

Definition at line 946 of file probability_evaluate.cpp.

Here is the caller graph for this function:

◆ ensureMultivaluedRewritten()

void provsql::EvalContext::ensureMultivaluedRewritten ( )
inline

Definition at line 931 of file probability_evaluate.cpp.

Here is the caller graph for this function:

◆ ensureTreewidthProxy()

void provsql::EvalContext::ensureTreewidthProxy ( ) const
inline

Definition at line 972 of file probability_evaluate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ featureCost()

double provsql::EvalContext::featureCost ( Feature f) const
inline

Heuristic acquisition cost of f, in the same work units as a method's estimatedCost (so the chooser can compare "run this method" against "acquire this feature").

Definition at line 986 of file probability_evaluate.cpp.

◆ hasFeature()

bool provsql::EvalContext::hasFeature ( Feature f) const
inline

Definition at line 996 of file probability_evaluate.cpp.

Member Data Documentation

◆ actual_method

std::string provsql::EvalContext::actual_method

Definition at line 927 of file probability_evaluate.cpp.

◆ args

const std::string& provsql::EvalContext::args

Definition at line 910 of file probability_evaluate.cpp.

◆ c

BooleanCircuit& provsql::EvalContext::c

Definition at line 906 of file probability_evaluate.cpp.

◆ circuit_size

size_t provsql::EvalContext::circuit_size = 0

gate count S, the circuit-size parameter (O(1))

Definition at line 913 of file probability_evaluate.cpp.

◆ compilation_cost_floor_

double provsql::EvalContext::compilation_cost_floor_ = 0.

Lower bound on compilation's cost, raised when the external compiler is stopped for running past its time limit.

Definition at line 967 of file probability_evaluate.cpp.

◆ compilation_spent_ms_

double provsql::EvalContext::compilation_spent_ms_ = 0.

Time, in ms, the external compiler has run in the current attempt.

Definition at line 969 of file probability_evaluate.cpp.

◆ cost_budget

double provsql::EvalContext::cost_budget = std::numeric_limits<double>::infinity()

Speculative-execution budget: the estimated cost (in the chooser's ms-ish units) of the next-cheapest admissible method.

A budget-aware method (the d-tree, tree-decomposition) stops once its own work would exceed this and throws MethodRepricedException, so the chooser re-ranks it at a higher cost and tries the next method – keeping wasted work within a constant factor of what the method finally spends. Infinity = no budget (the method is the last resort, or budgeting is off).

Definition at line 921 of file probability_evaluate.cpp.

◆ dnf_computed_

bool provsql::EvalContext::dnf_computed_ = false
mutable

Definition at line 942 of file probability_evaluate.cpp.

◆ dnf_num_clauses_

std::size_t provsql::EvalContext::dnf_num_clauses_ = 0
mutable

Definition at line 944 of file probability_evaluate.cpp.

◆ dnf_ok_

bool provsql::EvalContext::dnf_ok_ = false
mutable

Definition at line 943 of file probability_evaluate.cpp.

◆ dtree_cost_floor_

double provsql::EvalContext::dtree_cost_floor_ = 0.

Lower bound on the d-tree's cost, raised each time it overruns a budget.

Definition at line 959 of file probability_evaluate.cpp.

◆ explicitly_named

bool provsql::EvalContext::explicitly_named

invoked via byName (vs the default chain)

Definition at line 911 of file probability_evaluate.cpp.

◆ fold_component

bool provsql::EvalContext::fold_component = false

Definition at line 929 of file probability_evaluate.cpp.

◆ gate

gate_t provsql::EvalContext::gate

Definition at line 907 of file probability_evaluate.cpp.

◆ gc

GenericCircuit* provsql::EvalContext::gc

Definition at line 903 of file probability_evaluate.cpp.

◆ gc_root

gate_t provsql::EvalContext::gc_root

Definition at line 904 of file probability_evaluate.cpp.

◆ gc_to_bc

std::unordered_map<gate_t, gate_t>* provsql::EvalContext::gc_to_bc

Definition at line 908 of file probability_evaluate.cpp.

◆ inv_free_cert

bool provsql::EvalContext::inv_free_cert

Definition at line 909 of file probability_evaluate.cpp.

◆ linked_group

bool provsql::EvalContext::linked_group = false

Definition at line 928 of file probability_evaluate.cpp.

◆ multivalued_rewritten

bool provsql::EvalContext::multivalued_rewritten = false

Definition at line 926 of file probability_evaluate.cpp.

◆ n_inputs

size_t provsql::EvalContext::n_inputs = 0

input count N (O(1) cost feature)

Definition at line 912 of file probability_evaluate.cpp.

◆ outside_cost

double provsql::EvalContext::outside_cost = std::numeric_limits<double>::infinity()

Cost of an evaluation outside this Boolean view (sampling the equation systems of a recursion directly): the chooser gives up, throwing, rather than run a method or acquire a feature dearer than it.

Infinity = none.

Definition at line 925 of file probability_evaluate.cpp.

◆ token

pg_uuid_t provsql::EvalContext::token

Definition at line 905 of file probability_evaluate.cpp.

◆ treedec_cost_floor_

double provsql::EvalContext::treedec_cost_floor_ = 0.

Lower bound on tree-decomposition's cost, raised when the parts it builds (islands, folded groups, residual) overrun a budget together.

Definition at line 962 of file probability_evaluate.cpp.

◆ treedec_spent_

double provsql::EvalContext::treedec_spent_ = 0.

Cost of the parts tree-decomposition has built in the current attempt.

Definition at line 964 of file probability_evaluate.cpp.

◆ tw_computed_

bool provsql::EvalContext::tw_computed_ = false
mutable

Definition at line 956 of file probability_evaluate.cpp.

◆ tw_max_degree_

unsigned provsql::EvalContext::tw_max_degree_ = 0
mutable

Definition at line 970 of file probability_evaluate.cpp.

◆ tw_proxy_

unsigned provsql::EvalContext::tw_proxy_ = 0
mutable

Definition at line 957 of file probability_evaluate.cpp.


The documentation for this struct was generated from the following file: