API reference#

Task instance schema from proposal.md; independent of legacy interfaces.

class src.core.problem.VariableSpec(name, description, unit, role, sampling=None)[source]#
Parameters:
  • name (str)

  • description (str)

  • unit (str | None)

  • role (Literal['target', 'input', 'internal', 'auxiliary'])

  • sampling (dict[str, float | str] | None)

name: str#
description: str#
unit: str | None#
role: Literal['target', 'input', 'internal', 'auxiliary']#
sampling: dict[str, float | str] | None = None#
__init__(name, description, unit, role, sampling=None)#
Parameters:
  • name (str)

  • description (str)

  • unit (str | None)

  • role (Literal['target', 'input', 'internal', 'auxiliary'])

  • sampling (dict[str, float | str] | None)

Return type:

None

class src.core.problem.MechanismItem(formula_str, formula, role, description)[source]#
Parameters:
  • formula_str (str)

  • formula (Expr)

  • role (str)

  • description (str)

formula_str: str#
formula: Expr#
role: str#
description: str#
__init__(formula_str, formula, role, description)#
Parameters:
  • formula_str (str)

  • formula (Expr)

  • role (str)

  • description (str)

Return type:

None

class src.core.problem.MechanismProbe(probe, description, answer)[source]#
Parameters:
  • probe (str)

  • description (str)

  • answer (str)

probe: str#
description: str#
answer: str#
__init__(probe, description, answer)#
Parameters:
  • probe (str)

  • description (str)

  • answer (str)

Return type:

None

class src.core.problem.Task(task_name, task_description, mutation, mechanism_model, phenomenal_model, variables, mechanism_probes, solution=<factory>)[source]#
Parameters:
  • task_name (str)

  • task_description (str)

  • mutation (str)

  • mechanism_model (list[MechanismItem])

  • phenomenal_model (str)

  • variables (list[VariableSpec])

  • mechanism_probes (list[MechanismProbe])

  • solution (dict[str, Expr])

task_name: str#
task_description: str#
mutation: str#
mechanism_model: list[MechanismItem]#
phenomenal_model: str#
variables: list[VariableSpec]#
mechanism_probes: list[MechanismProbe]#
solution: dict[str, Expr]#
by_role(*roles)[source]#
Return type:

list[VariableSpec]

Parameters:

roles (str)

property target: VariableSpec#
property observed: list[VariableSpec]#
__init__(task_name, task_description, mutation, mechanism_model, phenomenal_model, variables, mechanism_probes, solution=<factory>)#
Parameters:
  • task_name (str)

  • task_description (str)

  • mutation (str)

  • mechanism_model (list[MechanismItem])

  • phenomenal_model (str)

  • variables (list[VariableSpec])

  • mechanism_probes (list[MechanismProbe])

  • solution (dict[str, Expr])

Return type:

None

Load, validate and solve proposal tasks and submitted algebraic models.

Formula parsing uses an AST allowlist, never eval/sympify on untrusted text. Algebraic ambiguity is an error: no fitting, branch guessing or numeric fallback.

exception src.validate_problem.ValidationError[source]#
src.validate_problem.expression_tree(text)[source]#
Return type:

expr

Parameters:

text (str)

src.validate_problem.parse_expression(text, symbols=None)[source]#
Return type:

Expr

Parameters:

text (str)

src.validate_problem.split_equation(text)[source]#
Return type:

tuple[str, str]

Parameters:

text (str)

src.validate_problem.parse_equation(text, symbols=None)[source]#
Return type:

Expr

Parameters:

text (str)

src.validate_problem.symbols_for(variables)[source]#
Return type:

dict[str, Symbol]

Parameters:

variables (list[VariableSpec])

src.validate_problem.solve_model(formulas, source_variables, *, required=())[source]#

Solve all non-source symbols explicitly in terms of source symbols.

Submissions define their own internal names, without access to answer metadata. All equations must hold, including redundant equations and source-only constraints.

Return type:

dict[str, Expr]

Parameters:
  • formulas (list[str])

  • source_variables (list[VariableSpec])

src.validate_problem.expand_expression(text, task, *, lhs=None)[source]#
Return type:

Expr

Parameters:
  • text (str)

  • task (Task)

  • lhs (str | None)

src.validate_problem.task_from_dict(raw)[source]#
Return type:

Task

Parameters:

raw (dict)

class src.validate_problem.TaskLoader(stream)[source]#

Recognize proposal-style scientific notation (YAML 1.2), reject duplicate keys.

yaml_constructors = {'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:map': <function _unique_mapping>, 'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function SafeConstructor.construct_yaml_str>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>, None: <function SafeConstructor.construct_undefined>}#
yaml_implicit_resolvers = {'': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], '!': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '&': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '*': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '+': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '-': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '.': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '0': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '1': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '2': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '3': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '4': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '5': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '6': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '7': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '8': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '9': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE)), ('tag:yaml.org,2002:float', re.compile('^[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)[eE][+-]?[0-9]+$'))], '<': [('tag:yaml.org,2002:merge', re.compile('^(?:<<)$'))], '=': [('tag:yaml.org,2002:value', re.compile('^(?:=)$'))], 'F': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'N': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 'O': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'T': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'Y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'f': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'n': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 'o': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 't': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], '~': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))]}#
src.validate_problem.load_task(path, *, validate=True, check_filename=True)[source]#
Return type:

Task

Parameters:

path (str | Path)

src.validate_problem.validate_sampling(variable)[source]#
Parameters:

variable (VariableSpec)

src.validate_problem.parse_unit(text)[source]#
Return type:

dict[str, Rational]

Parameters:

text (str)

src.validate_problem.check_units(task)[source]#
Return type:

dict[str, str]

Parameters:

task (Task)

src.validate_problem.validate_task(task, *, path=None, seen=None)[source]#
Return type:

dict

Parameters:
  • task (Task)

  • path (Path | None)

  • seen (set[str] | None)

src.validate_problem.discover_tasks(paths)[source]#
src.validate_problem.get_parser(parser=None)[source]#
src.validate_problem.main(args)[source]#

Generate reproducible feature-by-sample ID/OOD arrays for proposal tasks.

src.synthetic_data.evaluate_expression(expression, values, count)[source]#
Return type:

ndarray

Parameters:
  • expression (Expr)

  • values (dict[str, ndarray])

  • count (int)

src.synthetic_data.generate_synthetic_data(task, *, seed=0, train_samples=1000, id_test_samples=1000, ood_test_samples=1000)[source]#
Return type:

dict[str, ndarray]

Parameters:

task (Task)

src.synthetic_data.get_parser(parser=None)[source]#
src.synthetic_data.main(args)[source]#

Export public observation tasks and private evaluation answers.

No mechanism, mutation, internal variable, sampling range or probe is exported into the public problem JSON. NPY rows follow public data_columns.

src.export_problems.task_to_dict(task)[source]#
Return type:

dict

Parameters:

task (Task)

src.export_problems.public_problem(task)[source]#
Return type:

dict

Parameters:

task (Task)

src.export_problems.export_task(task, output_dir, *, force=False, **sampling)[source]#
Return type:

dict[str, Path]

Parameters:
  • task (Task)

  • output_dir (str | Path)

src.export_problems.get_parser(parser=None)[source]#
src.export_problems.main(args)[source]#

Concurrent file-upload feedback service with bounded content-addressed cache.

POST /evaluate multipart/form-data with problem, train_data, submission files. GET /health returns a protocol marker for runner startup/reuse checks.

class src.feedback_server.FeedbackCache(max_entries=128, workers=4)[source]#

LRU completed results and single-flight coalescing of duplicate requests.

__init__(max_entries=128, workers=4)[source]#
evaluate(files)[source]#
src.feedback_server.parse_upload(body, content_type)[source]#
Return type:

dict[str, bytes]

Parameters:
  • body (bytes)

  • content_type (str)

src.feedback_server.create_server(host='127.0.0.1', port=8000, *, cache_size=128, workers=4)[source]#
src.feedback_server.get_parser(parser=None)[source]#
src.feedback_server.main(args)[source]#

Objective phenomenal and independent mechanism-probe evaluation.

src.evaluate.load_answer(path)[source]#
Parameters:

path (str | Path)

src.evaluate.numerical_constant_equations(task)[source]#

Return named mechanism equations whose right-hand sides are numeric.

This is deliberately a syntactic disclosure rule for probe prompts, not a distinct equation type in the task model. Equations such as a = 1.2 continue to be loaded, validated, and solved exactly like every other mechanism equation.

Return type:

list[str]

Parameters:

task (Task)

src.evaluate.numerical_literal_context(task)[source]#

List embedded numeric values, labelled only by their equation’s LHS.

Return type:

list[str]

Parameters:

task (Task)

src.evaluate.format_probe(task, probe, submission)[source]#
Return type:

str

Parameters:
  • task (Task)

  • submission (list[str])

src.evaluate.expand_probe_reply(formula, probe_name, sources, solution)[source]#
Return type:

Expr

Parameters:
  • formula (str)

  • probe_name (str)

src.evaluate.evaluate(args, answer_file, submission, make_ask)[source]#
Return type:

dict

Parameters:
  • answer_file (str | Path)

  • submission (list[str])

  • make_ask (Callable[[], Callable])

Run an algorithm against an exported task and evaluate its frozen checkpoint.

src.run_experiment.get_parser(parser=None, argv=None)[source]#
src.run_experiment.build_argparser(argv=None)[source]#
src.run_experiment.sanitize_filename(value)[source]#
src.run_experiment.feedback_service(args)[source]#
src.run_experiment.run_experiment(args)[source]#
src.run_experiment.main(args)[source]#

Codex CLI baseline with persisted end-of-run checkpoints.

The evaluator requests a fresh callable for every probe. Each callable restores the exact saved rollout into a fresh CODEX_HOME, so no probe turns are appended to the original checkpoint or seen by another probe.

src.algorithms.codex.update_parser(parser)[source]#

Add Algorithm-specific arguments to the parser.

src.algorithms.codex.run(args, problem_file, train_data_npy_file, feedback_server_url)[source]#
Return type:

tuple[list[str], Any]

Parameters:
  • problem_file (Path)

  • train_data_npy_file (Path)

src.algorithms.codex.get_ask(args, checkpoint)[source]#

Create a fresh probe callable from one frozen Codex checkpoint.

Return type:

Callable

Parameters:

checkpoint (Any)