Problems, Presets, And Environments

User-facing finite update-support problem object.

exception updatesupport.problem.TooManyPartitions[source]

Bases: RuntimeError

Raised when exhaustive support enumeration would be too large.

class updatesupport.problem.FiniteProblem(states, public, estimand, environments=None, tol=1e-09)[source]

Bases: object

Finite hidden-state update-support problem.

Parameters mirror the paper’s finite setup:

  • states is the hidden state space D.

  • public is the projection pi: D -> O.

  • estimand is a fixed target functional over hidden distributions.

  • environments is the admissible class Q.

Parameters:
states: Sequence[Hashable]
public: Mapping[Hashable, Hashable] | Callable[[Hashable], Hashable]
estimand: Mapping[Hashable, float] | Sequence[float] | Callable[[Hashable], float] | LinearTarget | UncertainLinearTarget | MomentTransformTarget | ProcedureTarget | RatioTarget
environments: Environment | None = None
tol: float = 1e-09
property target_contract: TargetContract
property has_linear_target: bool
property has_ratio_target: bool
public_partition()[source]
Return type:

Partition

discrete_support()[source]
Return type:

Partition

estimand_partition()[source]

The saturated least support: quotient by joint values of (public, h).

Return type:

Partition

psi(distribution)[source]
Parameters:

distribution (Mapping[Hashable, float] | Sequence[float])

Return type:

float

public_law(distribution)[source]
Parameters:

distribution (Mapping[Hashable, float] | Sequence[float])

Return type:

dict[Hashable, float]

support_law(distribution, support)[source]
Parameters:
Return type:

tuple[float, …]

fiber_ranges()[source]
Return type:

dict[Hashable, float]

check_support(support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

check_public()[source]
Return type:

AdequacyResult

is_public_adequate()[source]
Return type:

bool

adequate_supports(*, max_states=9)[source]
Parameters:

max_states (int)

Return type:

tuple[Partition, …]

minimal_supports(*, max_states=9)[source]
Parameters:

max_states (int)

Return type:

tuple[Partition, …]

least_support(*, max_states=9)[source]
Parameters:

max_states (int)

Return type:

LeastSupportResult

local_transport_modulus(public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport_modulus()[source]
Return type:

TransportResult

public_descent_gap()[source]
Return type:

float

partial_identification_interval(public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

moment_bounds(public_law=None)[source]

Return exact linear moment bounds under a fixed public law.

Parameters:

public_law (Mapping[Hashable, float] | None)

Return type:

dict[str, tuple[float, float]]

moment_transform_endpoint(*, minimize, public_law=None)[source]

Solve one exact convex-compatible moment-transform endpoint.

Parameters:
Return type:

TransportResult

uncertain_linear_confidence_core(*, public_law=None)[source]

Return the SOCP common confidence core for an uncertain linear target.

Parameters:

public_law (Mapping[Hashable, float] | None)

Return type:

UncertainLinearConfidenceCoreResult

cardinal_gap()[source]
Return type:

CardinalGapResult

report()[source]
Return type:

ProblemReport

class updatesupport.problem.ProblemReport(problem: 'FiniteProblem')[source]

Bases: object

Parameters:

problem (FiniteProblem)

problem: FiniteProblem
to_markdown()[source]
Return type:

str

Named admissible-environment presets.

class updatesupport.presets.QPreset(name, radius=None, cost=None, backend=None, solver=None, solver_options=None, settings=None)[source]

Bases: object

Reusable preset for constructing an admissible environment Q.

Parameters:
name: str
radius: float | None = None
cost: Any | None = None
backend: str | None = None
solver: str | None = None
solver_options: Mapping[str, Any] | None = None
settings: Mapping[str, Any] | None = None
class updatesupport.presets.QEnvironment(environment: 'Environment', preset: 'QPreset | None', name: 'str', description: 'str')[source]

Bases: object

Parameters:
environment: Environment
preset: QPreset | None
name: str
description: str
class updatesupport.presets.CvxpyAdmissibleSetSpec(preset, fixed_public_law, constraint_builders=(), parameterized_constraint_builders=(), parameter_values=<factory>, solver=None, solver_options=None, name=None, description=None)[source]

Bases: object

Reusable CVXPY constraints for one admissible Q preset.

Parameters:
preset: QPreset
fixed_public_law: Mapping[Hashable, float]
constraint_builders: Sequence[Callable[[Any, Any, tuple[Hashable, ...], Mapping[Hashable, int]], Sequence[Any]]] = ()
parameterized_constraint_builders: Sequence[Callable[[Any, Any, tuple[Hashable, ...], Mapping[Hashable, int], Callable[[...], Any]], Sequence[Any]]] = ()
parameter_values: Mapping[str, Any]
solver: str | None = None
solver_options: Mapping[str, Any] | None = None
name: str | None = None
description: str | None = None
intersect(*others, name=None, description=None, solver=None, solver_options=None)[source]

Conjoin this admissible set’s constraints with other specs.

Parameters:
Return type:

CvxpyAdmissibleSetSpec

environment(backend='cvxpy')[source]

Materialize this constraint spec as a CVXPY-compatible environment.

Parameters:

backend (str)

Return type:

Environment

convex_admissible_set(problem)[source]

Build a concrete CVXPY admissible set for problem.

Return type:

ConvexAdmissibleSet

support_interval(problem, direction=None)[source]

Evaluate [-sigma_Q(-h), sigma_Q(h)] for this preset spec.

Parameters:

direction (Sequence[float] | None)

Return type:

SupportFunctionIntervalResult

as_dict()[source]
Return type:

dict[str, Any]

updatesupport.presets.q_saturated()[source]

Allow arbitrary hidden reweighting inside each observed public fiber.

Return type:

QPreset

updatesupport.presets.q_observed()[source]

Use only the observed hidden distribution.

Return type:

QPreset

updatesupport.presets.q_intersection(*components, backend=None, solver=None, solver_options=None)[source]

Intersect several admissible Q presets.

The first implementation slice supports convex CVXPY-compatible component presets plus saturated and observed. Mixed-integer components are deliberately rejected by the CVXPY admissible-set compiler.

Parameters:
Return type:

QPreset

updatesupport.presets.q_bounded_shift(radius=0.5)[source]

Limit each hidden-cell mass to a relative band around its observed mass.

Parameters:

radius (float)

Return type:

QPreset

updatesupport.presets.q_fiber_support_floor(min_active, *, min_share, max_active=None, backend='cvxpy', solver='SCIP', solver_options=None)[source]

Require each public fiber to keep several active hidden cells.

The preset is mixed-integer: inside every retained public fiber, at least min_active hidden cells must carry at least min_share of that public fiber’s mass. max_active optionally caps the number of active hidden cells in each public fiber. Use a MIP-capable CVXPY solver such as SCIP.

Parameters:
Return type:

QPreset

updatesupport.presets.q_tv_budget(radius, *, backend='cvxpy', solver=None, solver_options=None)[source]

Constrain total variation distance from the observed hidden distribution.

Parameters:
Return type:

QPreset

updatesupport.presets.q_chi_square_budget(radius, *, backend='cvxpy', solver=None, solver_options=None)[source]

Constrain Pearson chi-square divergence from the observed distribution.

Parameters:
Return type:

QPreset

updatesupport.presets.q_kl_budget(radius, *, backend='cvxpy', solver=None, solver_options=None)[source]

Constrain KL divergence from the observed hidden distribution.

Parameters:
Return type:

QPreset

updatesupport.presets.q_l2_budget(radius, *, backend='cvxpy', solver=None, solver_options=None)[source]

Constrain L2 distance from the observed hidden distribution.

Parameters:
Return type:

QPreset

updatesupport.presets.q_covariate_balance(radius, moments, *, baseline=None, scale=None, backend='cvxpy', solver=None, solver_options=None)[source]

Constrain standardized hidden covariate-moment drift.

moments maps moment names to values on retained hidden cells, or supplies a row-by-cell matrix in hidden-state order. By default the baseline and scale are computed from the observed hidden distribution.

Parameters:
Return type:

QPreset

updatesupport.presets.q_mahalanobis_budget(radius, *, covariance, backend='cvxpy', solver=None, solver_options=None)[source]

Constrain Mahalanobis distance from the observed hidden distribution.

Parameters:
Return type:

QPreset

updatesupport.presets.q_wasserstein(cost, radius, *, backend='cvxpy', solver=None, solver_options=None)[source]

Constrain Wasserstein distance using an explicit hidden-cell cost matrix.

Parameters:
Return type:

QPreset

updatesupport.presets.cvxpy_admissible_set_spec(q, *, public_law, public_map, cell_weights, q_radius=None)[source]

Expose CVXPY admissible-set constraints for a compatible Q preset.

Parameters:
Return type:

CvxpyAdmissibleSetSpec

updatesupport.presets.resolve_q_environment(q, *, public_law, public_map, cell_weights, q_radius=None)[source]

Build an environment from a preset or pass through a custom environment.

Parameters:
Return type:

QEnvironment

updatesupport.presets.normalize_q_preset(q, *, q_radius=None)[source]
Parameters:
Return type:

QPreset | None

updatesupport.presets.q_name(q, *, q_radius=None)[source]
Parameters:
Return type:

str

updatesupport.presets.q_description(q, *, q_radius=None)[source]
Parameters:
Return type:

str

Admissible environment classes for finite update-support problems.

exception updatesupport.environments.LPError[source]

Bases: RuntimeError

Raised when a linear program cannot be solved successfully.

exception updatesupport.environments.CvxpyError[source]

Bases: RuntimeError

Raised when a CVXPY optimization problem cannot be solved successfully.

class updatesupport.environments.Environment(*args, **kwargs)[source]

Bases: Protocol

name: str
check_support(problem, support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

class updatesupport.environments.CvxpyConstraintMetadata(constraint, name, kind='custom', sense=None, variable=None, state=None, public_value=None, states=(), public_values=())[source]

Bases: object

CVXPY constraint plus metadata used for dual diagnostics.

Parameters:
constraint: Any
name: str
kind: str = 'custom'
sense: str | None = None
variable: str | None = None
state: Hashable | None = None
public_value: Hashable | None = None
states: tuple[Hashable, ...] = ()
public_values: tuple[Hashable, ...] = ()
updatesupport.environments.cvxpy_constraint(constraint, *, name, kind='custom', sense=None, variable=None, state=None, public_value=None, states=(), public_values=())[source]

Attach diagnostic metadata to a custom CVXPY constraint.

Parameters:
Return type:

CvxpyConstraintMetadata

class updatesupport.environments.SupportFunctionResult(direction, value, vector)[source]

Bases: object

Value and optimizer for one support-function evaluation.

Parameters:
direction: tuple[float, ...]
value: float
vector: tuple[float, ...]
as_dict()[source]
Return type:

dict[str, Any]

class updatesupport.environments.SupportFunctionIntervalResult(direction, lower, upper, diameter, lower_vector, upper_vector, lower_support_value, upper_support_value, lower_support_result, upper_support_result, lower_duals=(), upper_duals=())[source]

Bases: object

Lower/upper interval from support-function evaluations.

Parameters:
direction: tuple[float, ...]
lower: float
upper: float
diameter: float
lower_vector: tuple[float, ...]
upper_vector: tuple[float, ...]
lower_support_value: float
upper_support_value: float
lower_support_result: SupportFunctionResult
upper_support_result: SupportFunctionResult
lower_duals: tuple[ConstraintDual, ...] = ()
upper_duals: tuple[ConstraintDual, ...] = ()
property duals: tuple[ConstraintDual, ...]
dual_summary(*, top=10, min_magnitude=0.0)[source]
Parameters:
  • top (int | None)

  • min_magnitude (float)

Return type:

tuple[ConstraintDual, …]

as_dict()[source]
Return type:

dict[str, Any]

class updatesupport.environments.SupportFunctionTargetInterval(name, direction, lower, upper, diameter, lower_distribution, upper_distribution, lower_support_value, upper_support_value, lower_duals=(), upper_duals=())[source]

Bases: object

Support-function interval for one named linear target direction.

Parameters:
name: str
direction: tuple[float, ...]
lower: float
upper: float
diameter: float
lower_distribution: Mapping[Hashable, float]
upper_distribution: Mapping[Hashable, float]
lower_support_value: float
upper_support_value: float
lower_duals: tuple[ConstraintDual, ...] = ()
upper_duals: tuple[ConstraintDual, ...] = ()
property duals: tuple[ConstraintDual, ...]
dual_summary(*, top=10, min_magnitude=0.0)[source]
Parameters:
  • top (int | None)

  • min_magnitude (float)

Return type:

tuple[ConstraintDual, …]

as_dict()[source]
Return type:

dict[str, Any]

class updatesupport.environments.SupportFunctionReport(title, targets, states, public_values, public_law=None, backend='support-function-cvxpy')[source]

Bases: ReportArtifactMixin

Multi-target support-function interval and dual diagnostic report.

Parameters:
title: str
targets: tuple[SupportFunctionTargetInterval, ...]
states: tuple[Hashable, ...]
public_values: tuple[Hashable, ...]
public_law: Mapping[Hashable, float] | None = None
backend: str = 'support-function-cvxpy'
property target_count: int
property state_count: int
property public_cell_count: int
property max_diameter: float
dual_summary(*, top=10, min_magnitude=0.0)[source]
Parameters:
  • top (int | None)

  • min_magnitude (float)

Return type:

tuple[dict[str, Any], …]

as_dict()[source]
Return type:

dict[str, Any]

to_tables()[source]
Return type:

dict[str, tuple[dict[str, Any], …]]

to_markdown(*, top_duals=10, min_dual_magnitude=0.0)[source]
Parameters:
  • top_duals (int)

  • min_dual_magnitude (float)

Return type:

str

class updatesupport.environments.ConvexAdmissibleSet(variable, constraints, records=(), name='convex admissible set')[source]

Bases: object

A CVXPY-defined convex admissible set over hidden distributions.

Parameters:
variable: Any
constraints: Sequence[Any]
records: Sequence[CvxpyConstraintMetadata] = ()
name: str = 'convex admissible set'
support_function()[source]

Return CVXPY’s support-function transform for this set.

Return type:

Any

support_expression(direction)[source]

Return the CVXPY expression sigma_Q(direction).

Parameters:

direction (Sequence[float])

Return type:

Any

support_value(direction, *, solver=None, solver_options=None)[source]

Evaluate sup_{q in Q} <direction, q> with CVXPY.

Parameters:
Return type:

SupportFunctionResult

support_interval(direction, *, solver=None, solver_options=None, tol=1e-09)[source]

Evaluate [-sigma_Q(-h), sigma_Q(h)] for direction h.

Parameters:
Return type:

SupportFunctionIntervalResult

class updatesupport.environments.LinearConstraint(coefficients, sense, rhs, name=None)[source]

Bases: object

A linear constraint over state probabilities.

Parameters:
coefficients: Mapping[Hashable, float] | Sequence[float]
sense: str
rhs: float
name: str | None = None
updatesupport.environments.linear_constraint(coefficients, sense, rhs, *, name=None)[source]
Parameters:
Return type:

LinearConstraint

updatesupport.environments.leq(coefficients, rhs, *, name=None)[source]
Parameters:
Return type:

LinearConstraint

updatesupport.environments.geq(coefficients, rhs, *, name=None)[source]
Parameters:
Return type:

LinearConstraint

updatesupport.environments.eq(coefficients, rhs, *, name=None)[source]
Parameters:
Return type:

LinearConstraint

class updatesupport.environments.PublicFiberSaturated(public_marginals=None, name='public-fiber-saturated')[source]

Bases: object

All conditional reweightings inside public fibers are admissible.

public_marginals=None means the full simplex over public values. A mapping fixes a single public law. A sequence of mappings is interpreted as vertices of a finite public-marginal polytope for global closed-form maximization.

Parameters:
public_marginals: Mapping[Hashable, float] | Sequence[Mapping[Hashable, float]] | None = None
name: str = 'public-fiber-saturated'
classmethod fixed(public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

PublicFiberSaturated

classmethod vertices(public_laws)[source]
Parameters:

public_laws (Sequence[Mapping[Hashable, float]])

Return type:

PublicFiberSaturated

check_support(problem, support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

least_support(problem)[source]

Return the saturated least support for the configured public laws.

Return type:

Partition

local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

class updatesupport.environments.FiniteEnvironments(distributions, name='finite')[source]

Bases: object

A finite enumerated environment class Q.

Parameters:
distributions: Sequence[Mapping[Hashable, float] | Sequence[float]]
name: str = 'finite'
check_support(problem, support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

class updatesupport.environments.LineSegment(center, direction, radius, name='line-segment')[source]

Bases: object

Continuous environments q(t) = center + t * direction with bounded t.

Parameters:
center: Mapping[Hashable, float] | Sequence[float]
direction: Mapping[Hashable, float] | Sequence[float]
radius: float
name: str = 'line-segment'
check_support(problem, support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

class updatesupport.environments.PolytopeEnvironments(constraints=(), bounds=None, method='highs', name='polytope')[source]

Bases: object

A finite-linear polytope Q solved with scipy.optimize.linprog.

The probability simplex is implicit: every environment has nonnegative coordinates and total mass one. Additional constraints are linear equalities or inequalities over the state probabilities.

Parameters:
constraints: Sequence[LinearConstraint | tuple[Mapping[Hashable, float] | Sequence[float], str, float]] = ()
bounds: Mapping[Hashable, tuple[float | None, float | None]] | Sequence[tuple[float | None, float | None]] | None = None
method: str = 'highs'
name: str = 'polytope'
check_support(problem, support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

class updatesupport.environments.CvxpyEnvironments(constraints=(), constraint_builders=(), fixed_public_law=None, solver=None, solver_options=None, name='cvxpy')[source]

Bases: object

A convex finite environment class Q solved with CVXPY.

The probability simplex is implicit. Linear constraints use the same helper objects accepted by PolytopeEnvironments. Extra convex restrictions can be supplied as builders receiving (cp, q, states, state_index) and returning CVXPY constraints for the probability vector q.

Parameters:
constraints: Sequence[LinearConstraint | tuple[Mapping[Hashable, float] | Sequence[float], str, float]] = ()
constraint_builders: Sequence[Callable[[Any, Any, tuple[Hashable, ...], Mapping[Hashable, int]], Sequence[Any]]] = ()
fixed_public_law: Mapping[Hashable, float] | None = None
solver: str | None = None
solver_options: Mapping[str, Any] | None = None
name: str = 'cvxpy'
check_support(problem, support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

convex_admissible_set(problem, *, public_law=None)[source]

Build the CVXPY admissible distribution set for this problem.

Parameters:

public_law (Mapping[Hashable, float] | None)

Return type:

ConvexAdmissibleSet

moment_transform_endpoint(problem, *, public_law, maximize)[source]

Solve one convex-compatible MomentTransformTarget endpoint.

Parameters:
Return type:

TransportResult

uncertain_linear_confidence_core(problem, *, public_law)[source]

Solve the SOCP common confidence core for an uncertain linear target.

Parameters:

public_law (Mapping[Hashable, float])

Return type:

UncertainLinearConfidenceCoreResult

class updatesupport.environments.SupportFunctionBackend(constraints=(), constraint_builders=(), fixed_public_law=None, solver=None, solver_options=None, name='support-function-cvxpy')[source]

Bases: CvxpyEnvironments

CVXPY backend that evaluates linear intervals via support functions.

Parameters:
name: str = 'support-function-cvxpy'
local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

support_value(problem, direction, *, public_law=None)[source]

Evaluate the support function of this backend’s admissible set.

Parameters:
Return type:

SupportFunctionResult

support_interval(problem, direction=None, *, public_law=None)[source]

Evaluate a support-function interval for a direction or target.

Parameters:
Return type:

SupportFunctionIntervalResult

multi_target_intervals(problem, targets, *, public_law=None, title='Support-Function Multi-Target Report')[source]

Evaluate support-function intervals for several linear directions.

Parameters:
Return type:

SupportFunctionReport

updatesupport.environments.support_function_report(problem, targets, *, public_law=None, title='Support-Function Multi-Target Report')[source]

Evaluate several linear target directions with a support-function backend.

Parameters:
Return type:

SupportFunctionReport

class updatesupport.environments.BatchedCvxpyEnvironments(constraints=(), constraint_builders=(), fixed_public_law=None, solver=None, solver_options=None, name='batched-cvxpy', scenario_constraint_builders=None, scenario_names=())[source]

Bases: CvxpyEnvironments

CVXPY environment with batched local interval solves.

batched_local_transport solves independent fixed-public-law lower/upper endpoint problems with variables shaped (scenario, state). Existing one-dimensional custom CVXPY constraint builders are applied to each scenario slice, so current TV, chi-square, KL, and Wasserstein presets can be reused before specialized tensor builders are needed.

Parameters:
scenario_constraint_builders: Sequence[Sequence[Callable[[Any, Any, tuple[Hashable, ...], Mapping[Hashable, int]], Sequence[Any]]]] | None = None
scenario_names: Sequence[str] = ()
name: str = 'batched-cvxpy'
batched_local_transport(problem, public_laws)[source]
Parameters:

public_laws (Sequence[Mapping[Hashable, float]])

Return type:

tuple[TransportResult, …]

class updatesupport.environments.ParameterizedCvxpyEnvironments(constraints=(), constraint_builders=(), fixed_public_law=None, solver=None, solver_options=None, name='parameterized-cvxpy', parameterized_constraint_builders=(), parameter_values=<factory>)[source]

Bases: CvxpyEnvironments

CVXPY environment with cached problems and mutable parameters.

This backend is intended for sensitivity sweeps over a fixed finite state space. The objective and public-law equalities are CVXPY parameters, and custom parameterized constraints can add scalar/vector parameters such as a divergence radius.

Parameters:
parameterized_constraint_builders: Sequence[Callable[[Any, Any, tuple[Hashable, ...], Mapping[Hashable, int], Callable[[...], Any]], Sequence[Any]]] = ()
parameter_values: Mapping[str, Any]
name: str = 'parameterized-cvxpy'
set_parameter(name, value)[source]

Set a parameter value in-place and return self for chaining.

Parameters:
Return type:

ParameterizedCvxpyEnvironments

with_parameters(**values)[source]

Return a copy with updated parameter values and an empty problem cache.

Parameters:

values (Any)

Return type:

ParameterizedCvxpyEnvironments

clear_cache()[source]

Discard cached CVXPY problem objects.

Return type:

None

cache_info()[source]
Return type:

dict[str, int]

check_support(problem, support)[source]
Parameters:

support (Partition)

Return type:

AdequacyResult

local_transport(problem, public_law)[source]
Parameters:

public_law (Mapping[Hashable, float])

Return type:

TransportResult

global_transport(problem)[source]
Return type:

TransportResult

moment_transform_endpoint(problem, *, public_law, maximize)[source]

Solve one convex-compatible MomentTransformTarget endpoint.

Parameters:
Return type:

TransportResult

uncertain_linear_confidence_core(problem, *, public_law)[source]

Solve the SOCP common confidence core for an uncertain linear target.

Parameters:

public_law (Mapping[Hashable, float])

Return type:

UncertainLinearConfidenceCoreResult

Structured result objects returned by the public API.

class updatesupport.results.Witness(q1, q2, psi_q1, psi_q2, gap, public_law, support_law=None)[source]

Bases: object

Two admissible environments that the observed support cannot distinguish.

Parameters:
q1: Mapping[Hashable, float]
q2: Mapping[Hashable, float]
psi_q1: float
psi_q2: float
gap: float
public_law: Mapping[Hashable, float]
support_law: tuple[float, ...] | None = None
class updatesupport.results.AdequacyResult(adequate: 'bool', support: 'Partition', gap: 'float' = 0.0, witness: 'Witness | None' = None, reason: 'str | None' = None)[source]

Bases: object

Parameters:
adequate: bool
support: Partition
gap: float = 0.0
witness: Witness | None = None
reason: str | None = None
class updatesupport.results.LeastSupportResult(exists: 'bool', support: 'Partition | None', minimal_supports: 'tuple[Partition, ...]', common_coarsening: 'Partition | None' = None, failure_witness: 'Witness | None' = None, reason: 'str | None' = None)[source]

Bases: object

Parameters:
  • exists (bool)

  • support (Partition | None)

  • minimal_supports (tuple[Partition, ...])

  • common_coarsening (Partition | None)

  • failure_witness (Witness | None)

  • reason (str | None)

exists: bool
support: Partition | None
minimal_supports: tuple[Partition, ...]
common_coarsening: Partition | None = None
failure_witness: Witness | None = None
reason: str | None = None
class updatesupport.results.ConstraintDual(solve, name, kind, magnitude, signed_value=None, sense=None, variable=None, state=None, public_value=None, index=None, residual=None)[source]

Bases: object

Dual multiplier diagnostic for one solved optimization constraint.

Parameters:
solve: str
name: str
kind: str
magnitude: float
signed_value: float | None = None
sense: str | None = None
variable: str | None = None
state: Hashable | None = None
public_value: Hashable | None = None
index: tuple[int, ...] | None = None
residual: float | None = None
as_dict()[source]
Return type:

dict[str, Any]

class updatesupport.results.TransportResult(lower: 'float', upper: 'float', diameter: 'float', public_law: 'Mapping[Hashable, float] | None' = None, q_lower: 'Distribution | None' = None, q_upper: 'Distribution | None' = None, duals: 'tuple[ConstraintDual, ...]' = (), bound_type: 'str' = 'exact', lower_bound_type: 'str' = 'exact', upper_bound_type: 'str' = 'exact', notes: 'tuple[str, ...]' = ())[source]

Bases: object

Parameters:
lower: float
upper: float
diameter: float
public_law: Mapping[Hashable, float] | None = None
q_lower: Mapping[Hashable, float] | None = None
q_upper: Mapping[Hashable, float] | None = None
duals: tuple[ConstraintDual, ...] = ()
bound_type: str = 'exact'
lower_bound_type: str = 'exact'
upper_bound_type: str = 'exact'
notes: tuple[str, ...] = ()
dual_summary(*, top=10, min_magnitude=0.0)[source]
Parameters:
  • top (int | None)

  • min_magnitude (float)

Return type:

tuple[ConstraintDual, …]

class updatesupport.results.UncertainLinearConfidenceCoreResult(lower, upper, diameter, empty_gap, public_law, q_lower, q_upper, duals=(), method='socp_confidence_core')[source]

Bases: object

Common confidence-core interval for an uncertain linear target.

The lower endpoint is the maximum lower confidence bound over admissible hidden compositions. The upper endpoint is the minimum upper confidence bound. If lower > upper, the composition-specific confidence bands have no common overlap and empty_gap records the separation.

Parameters:
lower: float
upper: float
diameter: float
empty_gap: float
public_law: Mapping[Hashable, float]
q_lower: Mapping[Hashable, float]
q_upper: Mapping[Hashable, float]
duals: tuple[ConstraintDual, ...] = ()
method: str = 'socp_confidence_core'
property nonempty: bool
property empty: bool
as_dict()[source]
Return type:

dict[str, Any]

class updatesupport.results.CardinalGapResult(max_gap_bits: 'float', total_gap_bits: 'float', blocks_by_public_value: 'Mapping[Hashable, int]')[source]

Bases: object

Parameters:
max_gap_bits: float
total_gap_bits: float
blocks_by_public_value: Mapping[Hashable, int]