Skip to content

andygreenslitt-constraintbased/cas-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CAS Engine

Constraint Alignment System — a pure, multi-domain constraint health engine.

What It Does

CAS maps any observable system into a unified four-dimensional state:

Dimension Variable Meaning
Hard admissibility A_hard Binary gate — constraint is either installed or it is not
Structure H Coherence of the governing framework
Circulation Csigma Flow of resources and information through the system
Transfer T Ability to execute across system boundaries
Pressure P Combined external + internal load (weighted merge)

From those five values CAS derives a failure signature, a priority classification, and a composite value score V.

Domains Supported

Domain Entry point
Horse racing map_racing_to_cas()
FSI (bug/constraint) map_fsi_to_cas()
Reseller margin map_reseller_to_cas()
AEGIS (AI governance) map_aegis_to_cas()

Each domain mapper normalizes its raw inputs into the [0, 1] CAS space and returns a DomainProjectionResult with a full observation trace.

Quick Start

from cas_engine import map_racing_to_cas, evaluate_cas_priority, derive_V_from_CAS

result = map_racing_to_cas({
    "speed_figure": 105,
    "route_confidence": 0.80,
    "entropy": 0.25,
    "jockey_edge": 0.60,
    "trainer_form": 0.70,
    "pace_fit": 0.75,
    "class_drop": 0.55,
    "field_size": 9,
    "surface_match": True,
    "distance_match": True,
})

print(evaluate_cas_priority(result.cas_state))
print(derive_V_from_CAS(result.cas_state))

Key Utilities

Function Purpose
compute_failure_signature() Returns sigma values for all five dimensions
classify_failure_mode() Dominant failure mode string
distinguish_Csigma_vs_T() Separates circulation failure from transfer failure
split_Ahard_vs_Asoft() Hard constraint vs soft constraint gap
simulate_parameter_shift() What-if: shift one input and measure V change
run_batch_evaluation() Compare CAS win-rate vs baseline across a case set
validate_cas_invariants() Confirm all state values are in [0, 1]

Running Tests

python test_cas_engine.py

17 tests covering: state construction, failure signature, monotonicity, domain mappings, validation, batch evaluation, parameter shift, and invariant checking.

Architecture Notes

  • Zero external dependencies (pure stdlib)
  • All weights are in CASCalibrationConfig — transparent, adjustable, not baked in
  • CASObservationTrace records every mapping step for auditability
  • Frozen dataclasses throughout — state is immutable

Claim Boundary

CAS measures constraint alignment. It does not predict outcomes or prescribe actions. All thresholds and targets are provided by the analyst, not embedded in the engine.


Engineering tool. Not a guarantee of any outcome.

About

Constraint Alignment System — multi-domain constraint health engine mapping admissibility, structure, circulation, transfer, and pressure to a unified CAS state.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages