-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Summary
Agent-level expression constraints are currently evaluated post hoc and counted in stats, but not enforced during sampling. Invalid agent combinations can pass through to the final sample.
Why This Matters
This creates silent quality failures (e.g., age/education/employment inconsistencies) despite constraints being present in spec.
Current Behavior (Code)
In /Users/adithyasrinivasan/Projects/extropy/extropy/population/sampler/core.py:
_check_expression_constraints(...)computes violation counts (line ~870+)- violations stored in
stats.constraint_violations - no repair, no resample, no fail-fast
Expected Behavior
Expression constraints should be enforceable runtime gates, not telemetry-only.
Proposed Fix
Implement deterministic enforcement policy for expression constraints:
- During sampling (or per-agent finalize), evaluate expression constraints.
- On violation, apply bounded repair strategy:
- resample violating attribute(s) with max attempts, OR
- deterministic repair hooks where defined.
- If unresolved after max attempts, raise
SamplingError(strict failure). - Keep violation stats for diagnostics.
Optional: configurable policy (warn|repair|fail) with fail available for production-quality runs.
Tests
Add tests showing:
- violating samples are corrected or rejected
- unresolved violations fail with clear error context
- valid constraints remain unaffected
Acceptance Criteria
- No final sampled agent violates declared expression constraints in strict mode.
- Failure paths are explicit and actionable (attribute + constraint + agent context).
Pipeline Impact
Directly improves step 3 sample correctness and reduces downstream contradiction cleanup.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels