Class Constraint

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

public class Constraint extends Object implements Serializable
Represents a physical or operational constraint for process equipment.

Constraints are used for:

  • Safe RL exploration (projecting actions to feasible space)
  • Multi-agent coordination (respecting global limits)
  • Explainable control (understanding why actions are limited)
Version:
1.0
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • name

      private final String name
    • description

      private final String description
    • type

      private final Constraint.Type type
    • category

      private final Constraint.Category category
    • variableName

      private final String variableName
    • lowerBound

      private final double lowerBound
    • upperBound

      private final double upperBound
    • unit

      private final String unit
    • currentValue

      private double currentValue
    • violated

      private boolean violated
  • Constructor Details

    • Constraint

      public Constraint(String name, String description, Constraint.Type type, Constraint.Category category, String variableName, double lowerBound, double upperBound, String unit)
      Create a constraint.
      Parameters:
      name - short identifier
      description - human-readable description
      type - constraint type (HARD, SOFT, INFO)
      category - constraint category
      variableName - state variable this constrains
      lowerBound - lower limit
      upperBound - upper limit
      unit - physical unit
  • Method Details

    • upperBound

      public static Constraint upperBound(String name, String variableName, double maxValue, String unit, Constraint.Type type)
      Create a simple upper-bound constraint.
      Parameters:
      name - constraint name
      variableName - variable to constrain
      maxValue - maximum allowed value
      unit - physical unit
      type - constraint type
      Returns:
      new Constraint
    • lowerBound

      public static Constraint lowerBound(String name, String variableName, double minValue, String unit, Constraint.Type type)
      Create a simple lower-bound constraint.
      Parameters:
      name - constraint name
      variableName - variable to constrain
      minValue - minimum allowed value
      unit - physical unit
      type - constraint type
      Returns:
      new Constraint
    • range

      public static Constraint range(String name, String variableName, double minValue, double maxValue, String unit, Constraint.Type type)
      Create a range constraint.
      Parameters:
      name - constraint name
      variableName - variable to constrain
      minValue - minimum allowed value
      maxValue - maximum allowed value
      unit - physical unit
      type - constraint type
      Returns:
      new Constraint
    • evaluate

      public Constraint evaluate(double value)
      Evaluate constraint with current value.
      Parameters:
      value - current value of the constrained variable
      Returns:
      this Constraint (updated)
    • getViolation

      public double getViolation()
      Get constraint violation amount (0 if satisfied).
      Returns:
      violation magnitude (positive = violated)
    • getNormalizedViolation

      public double getNormalizedViolation()
      Get normalized violation in [0, 1] range.
      Returns:
      normalized violation (0 = satisfied, 1 = severely violated)
    • getMargin

      public double getMargin()
      Get margin to nearest bound (negative if violated).
      Returns:
      distance to nearest constraint boundary
    • project

      public double project(double value)
      Project a value to the feasible range.
      Parameters:
      value - value to project
      Returns:
      value clamped to [lowerBound, upperBound]
    • getName

      public String getName()
    • getDescription

      public String getDescription()
    • getType

      public Constraint.Type getType()
    • getCategory

      public Constraint.Category getCategory()
    • getVariableName

      public String getVariableName()
    • getLowerBound

      public double getLowerBound()
    • getUpperBound

      public double getUpperBound()
    • getUnit

      public String getUnit()
    • getCurrentValue

      public double getCurrentValue()
    • isViolated

      public boolean isViolated()
    • isHard

      public boolean isHard()
    • toString

      public String toString()
      Overrides:
      toString in class Object