Class Constraint
java.lang.Object
neqsim.process.ml.Constraint
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumConstraint category for grouping.static enumConstraint type enumeration. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Constraint.Categoryprivate doubleprivate final Stringprivate final doubleprivate final Stringprivate static final longprivate final Constraint.Typeprivate final Stringprivate final doubleprivate final Stringprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionConstraint(String name, String description, Constraint.Type type, Constraint.Category category, String variableName, double lowerBound, double upperBound, String unit) Create a constraint. -
Method Summary
Modifier and TypeMethodDescriptionevaluate(double value) Evaluate constraint with current value.doubledoubledoubleGet margin to nearest bound (negative if violated).getName()doubleGet normalized violation in [0, 1] range.getType()getUnit()doubledoubleGet constraint violation amount (0 if satisfied).booleanisHard()booleanstatic ConstraintlowerBound(String name, String variableName, double minValue, String unit, Constraint.Type type) Create a simple lower-bound constraint.doubleproject(double value) Project a value to the feasible range.static Constraintrange(String name, String variableName, double minValue, double maxValue, String unit, Constraint.Type type) Create a range constraint.toString()static ConstraintupperBound(String name, String variableName, double maxValue, String unit, Constraint.Type type) Create a simple upper-bound constraint.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
name
-
description
-
type
-
category
-
variableName
-
lowerBound
private final double lowerBound -
upperBound
private final double upperBound -
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 identifierdescription- human-readable descriptiontype- constraint type (HARD, SOFT, INFO)category- constraint categoryvariableName- state variable this constrainslowerBound- lower limitupperBound- upper limitunit- 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 namevariableName- variable to constrainmaxValue- maximum allowed valueunit- physical unittype- 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 namevariableName- variable to constrainminValue- minimum allowed valueunit- physical unittype- 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 namevariableName- variable to constrainminValue- minimum allowed valuemaxValue- maximum allowed valueunit- physical unittype- constraint type- Returns:
- new Constraint
-
evaluate
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
-
getDescription
-
getType
-
getCategory
-
getVariableName
-
getLowerBound
public double getLowerBound() -
getUpperBound
public double getUpperBound() -
getUnit
-
getCurrentValue
public double getCurrentValue() -
isViolated
public boolean isViolated() -
isHard
public boolean isHard() -
toString
-