Class ConstraintManager

java.lang.Object
neqsim.process.ml.ConstraintManager
All Implemented Interfaces:
Serializable

public class ConstraintManager extends Object implements Serializable
Unified constraint management for process equipment.

Provides centralized constraint handling for:

  • Safe RL exploration (action space projection)
  • Multi-agent coordination (global constraint satisfaction)
  • Explainable control (constraint violation explanations)
  • Safety system integration (HIPPS, ESD triggers)
Version:
1.0
Author:
ESOL
See Also:
  • Field Details

  • Constructor Details

    • ConstraintManager

      public ConstraintManager()
      Create an empty constraint manager.
  • Method Details

    • add

      public ConstraintManager add(Constraint constraint)
      Add a constraint.
      Parameters:
      constraint - constraint to add
      Returns:
      this ConstraintManager for chaining
    • addHardUpperBound

      public ConstraintManager addHardUpperBound(String name, String variableName, double maxValue, String unit)
      Add a hard upper-bound constraint.
      Parameters:
      name - constraint name
      variableName - variable to constrain
      maxValue - maximum allowed value
      unit - physical unit
      Returns:
      this ConstraintManager for chaining
    • addHardLowerBound

      public ConstraintManager addHardLowerBound(String name, String variableName, double minValue, String unit)
      Add a hard lower-bound constraint.
      Parameters:
      name - constraint name
      variableName - variable to constrain
      minValue - minimum allowed value
      unit - physical unit
      Returns:
      this ConstraintManager for chaining
    • addHardRange

      public ConstraintManager addHardRange(String name, String variableName, double minValue, double maxValue, String unit)
      Add a hard range constraint.
      Parameters:
      name - constraint name
      variableName - variable to constrain
      minValue - minimum allowed value
      maxValue - maximum allowed value
      unit - physical unit
      Returns:
      this ConstraintManager for chaining
    • addSoftRange

      public ConstraintManager addSoftRange(String name, String variableName, double minValue, double maxValue, String unit)
      Add a soft range constraint.
      Parameters:
      name - constraint name
      variableName - variable to constrain
      minValue - minimum preferred value
      maxValue - maximum preferred value
      unit - physical unit
      Returns:
      this ConstraintManager for chaining
    • addViolationListener

      public void addViolationListener(ConstraintManager.ConstraintViolationListener listener)
      Register a violation listener.
      Parameters:
      listener - listener to notify on violations
    • evaluate

      public List<Constraint> evaluate(StateVector state)
      Evaluate all constraints against a state vector.
      Parameters:
      state - current state
      Returns:
      list of violated constraints
    • hasHardViolation

      public boolean hasHardViolation()
      Check if any hard constraints are violated.
      Returns:
      true if any hard constraint is violated
    • getTotalViolationPenalty

      public double getTotalViolationPenalty()
      Get total violation penalty (for RL reward shaping).
      Returns:
      sum of normalized violations
    • getMinHardMargin

      public double getMinHardMargin()
      Get minimum margin to any hard constraint.
      Returns:
      smallest margin (negative if violated)
    • getViolations

      public List<Constraint> getViolations()
      Get all violated constraints.
      Returns:
      list of currently violated constraints
    • getViolationsByCategory

      public List<Constraint> getViolationsByCategory(Constraint.Category category)
      Get violations by category.
      Parameters:
      category - constraint category to filter
      Returns:
      list of violated constraints in category
    • explainViolations

      public String explainViolations()
      Generate human-readable explanation of current violations.
      Returns:
      explanation string
    • get

      public Constraint get(String name)
      Get constraint by name.
      Parameters:
      name - constraint name
      Returns:
      constraint or null if not found
    • getAll

      public List<Constraint> getAll()
      Get all constraints.
      Returns:
      list of all constraints
    • size

      public int size()
      Get number of constraints.
      Returns:
      constraint count
    • clear

      public void clear()
      Clear all constraints.
    • toString

      public String toString()
      Overrides:
      toString in class Object