Class ConstraintManager
java.lang.Object
neqsim.process.ml.ConstraintManager
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener interface for constraint violation events. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, Constraint> private final List<ConstraintManager.ConstraintViolationListener> private static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Constraint constraint) Add a constraint.addHardLowerBound(String name, String variableName, double minValue, String unit) Add a hard lower-bound constraint.addHardRange(String name, String variableName, double minValue, double maxValue, String unit) Add a hard range constraint.addHardUpperBound(String name, String variableName, double maxValue, String unit) Add a hard upper-bound constraint.addSoftRange(String name, String variableName, double minValue, double maxValue, String unit) Add a soft range constraint.voidRegister a violation listener.voidclear()Clear all constraints.evaluate(StateVector state) Evaluate all constraints against a state vector.Generate human-readable explanation of current violations.Get constraint by name.getAll()Get all constraints.doubleGet minimum margin to any hard constraint.doubleGet total violation penalty (for RL reward shaping).Get all violated constraints.getViolationsByCategory(Constraint.Category category) Get violations by category.booleanCheck if any hard constraints are violated.intsize()Get number of constraints.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
constraints
-
listeners
-
-
Constructor Details
-
ConstraintManager
public ConstraintManager()Create an empty constraint manager.
-
-
Method Details
-
add
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 namevariableName- variable to constrainmaxValue- maximum allowed valueunit- 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 namevariableName- variable to constrainminValue- minimum allowed valueunit- 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 namevariableName- variable to constrainminValue- minimum allowed valuemaxValue- maximum allowed valueunit- 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 namevariableName- variable to constrainminValue- minimum preferred valuemaxValue- maximum preferred valueunit- physical unit- Returns:
- this ConstraintManager for chaining
-
addViolationListener
Register a violation listener.- Parameters:
listener- listener to notify on violations
-
evaluate
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
Get all violated constraints.- Returns:
- list of currently violated constraints
-
getViolationsByCategory
Get violations by category.- Parameters:
category- constraint category to filter- Returns:
- list of violated constraints in category
-
explainViolations
Generate human-readable explanation of current violations.- Returns:
- explanation string
-
get
Get constraint by name.- Parameters:
name- constraint name- Returns:
- constraint or null if not found
-
getAll
-
size
public int size()Get number of constraints.- Returns:
- constraint count
-
clear
public void clear()Clear all constraints. -
toString
-