//! # Inverse Control & Optimization
//!
//! This module implements the constraint-based inverse control system for thermodynamic
//! simulation. Instead of using external optimizers, constraints are embedded directly
//! into the residual system for "One-Shot" solving.
//!
//! # Mathematical Foundation
//!
//! A constraint is defined as:
//!
//! $$r_{constraint} = f(x) - y_{target} = 0$$
//!
//! where:
//! - $f(x)$ is a measurable system output (function of state vector $x$)
//! - $y_{target}$ is the desired target value
//! - $r_{constraint}$ is the constraint residual
//!
//! Bounded control variables ensure Newton steps stay physically possible:
//!
//! $$x_{new} = \text{clip}(x_{current} + \Delta x, x_{min}, x_{max})$$
//!
//! # Example
//!
//! ```rust,ignore
//! use entropyk_solver::inverse::{Constraint, ConstraintId, ComponentOutput};
//! use entropyk_solver::inverse::{BoundedVariable, BoundedVariableId};
//!
//! // Define a superheat constraint: superheat = 5K
//! let constraint = Constraint::new(
//!     ConstraintId::new("superheat_control"),
//!     ComponentOutput::Superheat { component_id: "evaporator".into() },
//!     5.0,  // target: 5K superheat
//! );
//!
//! // Define a bounded control variable (valve position)
//! let valve = BoundedVariable::new(
//!     BoundedVariableId::new("expansion_valve"),
//!     0.5,   // initial: 50% open
//!     0.0,   // min: fully closed
//!     1.0,   // max: fully open
//! )?;
//! ```

pub mod bounded;
pub mod calibration;
pub mod constraint;
pub mod embedding;
pub mod expr;
pub mod override_network;
pub mod saturated_control;

pub use bounded::{
    clip_step, BoundedVariable, BoundedVariableError, BoundedVariableId, SaturationInfo,
    SaturationType,
};
pub use calibration::{
    CalibFactor, CalibRequest, CalibrationError, CalibrationMode, CalibrationProblem,
    CalibrationResult, CalibrationTarget,
};
pub use constraint::{ComponentOutput, Constraint, ConstraintError, ConstraintId};
pub use embedding::{ControlMapping, DoFError, InverseControlConfig};
pub use expr::{parse_expr, AlgebraicEquation, Expr};
pub use override_network::{eval_error_signal, eval_error_weights, Combine, Objective};
pub use saturated_control::{SaturatedControlError, SaturatedController, Saturation};
