profiles#

Normalize named MIP profiles and compile their aggregate constraints.

Classes

BoundValue

One absolute value or teacher-relative ratio.

DepthSelection

One total-prefix or typed-prefix depth scenario.

HomogeneousPolicy

Retention and ranking policy for homogeneous Cartesian candidates.

MIPProfile

One concrete run/variant/matrix/objective solve.

ObjectiveSpec

One independent additive objective solve.

ProfileConstraint

One normalized aggregate constraint, optionally bound to a workload.

SolverOptions

Backend-neutral MIP solution-pool controls.

Functions

compile_profile_constraints

Resolve percentages and produce direct additive MIP constraints.

normalize_mip_profiles

Validate and compile public mip.runs into concrete solve specs.

class BoundValue#

Bases: object

One absolute value or teacher-relative ratio.

__init__(value, relative=False)#
Parameters:
  • value (float)

  • relative (bool)

Return type:

None

relative: bool = False#
value: float#
class DepthSelection#

Bases: object

One total-prefix or typed-prefix depth scenario.

__init__(counts)#
Parameters:

counts (tuple[tuple[str, int], ...])

Return type:

None

as_dict()#
Return type:

dict[str, int]

counts: tuple[tuple[str, int], ...]#
property slug: str#
property total: int#
classmethod total_prefix(count)#
Parameters:

count (int)

Return type:

DepthSelection

class HomogeneousPolicy#

Bases: object

Retention and ranking policy for homogeneous Cartesian candidates.

__init__(enabled=False, keep=-1, rank_by='objective', constraint_weights=())#
Parameters:
  • enabled (bool)

  • keep (int)

  • rank_by (str)

  • constraint_weights (tuple[tuple[str, float], ...])

Return type:

None

constraint_weights: tuple[tuple[str, float], ...] = ()#
enabled: bool = False#
keep: int = -1#
property num_solutions: int#
rank_by: str = 'objective'#
class MIPProfile#

Bases: object

One concrete run/variant/matrix/objective solve.

__init__(profile_id, run_id, variant_id, objective, solver, homogeneous, constraints, workloads, depths, depth_selections, embedding_widths, axes_default, axis_options)#
Parameters:
Return type:

None

axes_default: str#
axis_options: dict[str, Any]#
property base_profile_id: str#

Compatibility label used by existing MIP artifact reports.

constraints: tuple[ProfileConstraint, ...]#
depth_selections: tuple[DepthSelection, ...]#
depths: tuple[int, ...]#
embedding_widths: tuple[int, ...]#
homogeneous: HomogeneousPolicy#
property num_homogeneous_solutions: int#
objective: ObjectiveSpec#
profile_id: str#
property required_workloads: tuple[str, ...]#
run_id: str#
solver: SolverOptions#
variant_id: str#
workloads: dict[str, dict[str, Any]]#
class ObjectiveSpec#

Bases: object

One independent additive objective solve.

__init__(metric, direction)#
Parameters:
  • metric (str)

  • direction (str)

Return type:

None

property bigger_is_better: bool#
direction: str#
metric: str#
class ProfileConstraint#

Bases: object

One normalized aggregate constraint, optionally bound to a workload.

__init__(metric, stat_name, workload, minimum, maximum)#
Parameters:
  • metric (str)

  • stat_name (str)

  • workload (str | None)

  • minimum (BoundValue | None)

  • maximum (BoundValue | None)

Return type:

None

maximum: BoundValue | None#
metric: str#
minimum: BoundValue | None#
stat_name: str#
workload: str | None#
class SolverOptions#

Bases: object

Backend-neutral MIP solution-pool controls.

__init__(backend='pulp', num_solutions=1, min_hamming_distance=1, max_seconds_per_solution=60.0)#
Parameters:
  • backend (str)

  • num_solutions (int)

  • min_hamming_distance (int)

  • max_seconds_per_solution (float | None)

Return type:

None

backend: str = 'pulp'#
max_seconds_per_solution: float | None = 60.0#
min_hamming_distance: int = 1#
num_solutions: int = 1#
compile_profile_constraints(profile, *, teacher_totals)#

Resolve percentages and produce direct additive MIP constraints.

Parameters:
  • profile (MIPProfile)

  • teacher_totals (Mapping[str | None, Mapping[str, float]])

Return type:

dict[str, float | tuple[float | None, float | None]]

normalize_mip_profiles(mip_cfg, *, available_depths, available_embeddings, available_depth_counts=None, depth_granularity='subblock')#

Validate and compile public mip.runs into concrete solve specs.

Parameters:
  • mip_cfg (Mapping[str, Any])

  • available_depths (Iterable[int])

  • available_embeddings (Iterable[int])

  • available_depth_counts (Mapping[str, int] | None)

  • depth_granularity (str)

Return type:

tuple[MIPProfile, …]