Class ProcessSimulationEvaluator.ConstraintDefinition
java.lang.Object
neqsim.process.util.optimizer.ProcessSimulationEvaluator.ConstraintDefinition
- All Implemented Interfaces:
Serializable, ProcessConstraint
- Enclosing class:
ProcessSimulationEvaluator
public static class ProcessSimulationEvaluator.ConstraintDefinition
extends Object
implements Serializable, ProcessConstraint
Definition of a constraint for external optimizer integration.
Supports lower-bound, upper-bound, range, and equality constraints. Implements the unified
ProcessConstraint interface so constraints are portable between internal NeqSim
optimizers and external solvers.
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumConstraint type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate ToDoubleFunction<ProcessSystem> private booleanprivate doubleprivate Stringprivate doubleprivate static final longprivate Stringprivate double -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ConstraintDefinition(String name, ToDoubleFunction<ProcessSystem> evaluator, double lowerBound) Constructor for lower bound constraint (g(x) >= bound).ConstraintDefinition(String name, ToDoubleFunction<ProcessSystem> evaluator, double lowerBound, double upperBound) Constructor for range constraint. -
Method Summary
Modifier and TypeMethodDescriptiondoubleevaluate(ProcessSystem process) Evaluates the constraint value.doubledoublegetName()Returns the name of this constraint.doubleReturns the penalty weight for this constraint.Returns the severity of this constraint.getType()getUnit()doublebooleanisHard()Checks if this is a hard constraint that makes the solution infeasible when violated.booleanisSatisfied(ProcessSystem process) Checks if constraint is satisfied.doublemargin(ProcessSystem process) Calculates the constraint margin (positive = satisfied, negative = violated).doublepenalty(ProcessSystem process) Calculates penalty for constraint violation.voidsetEqualityTolerance(double equalityTolerance) voidsetEvaluator(ToDoubleFunction<ProcessSystem> evaluator) voidsetHard(boolean hard) voidsetLowerBound(double lowerBound) voidvoidsetPenaltyWeight(double penaltyWeight) voidvoidvoidsetUpperBound(double upperBound) Converts this constraint to aProductionOptimizer.OptimizationConstraintfor use with the internal optimizer.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ProcessConstraint
getDescription
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
name
-
type
-
lowerBound
private double lowerBound -
upperBound
private double upperBound -
equalityTolerance
private double equalityTolerance -
unit
-
isHard
private boolean isHard -
penaltyWeight
private double penaltyWeight -
evaluator
-
-
Constructor Details
-
ConstraintDefinition
public ConstraintDefinition()Default constructor. -
ConstraintDefinition
public ConstraintDefinition(String name, ToDoubleFunction<ProcessSystem> evaluator, double lowerBound) Constructor for lower bound constraint (g(x) >= bound).- Parameters:
name- constraint nameevaluator- evaluation functionlowerBound- lower bound value
-
ConstraintDefinition
public ConstraintDefinition(String name, ToDoubleFunction<ProcessSystem> evaluator, double lowerBound, double upperBound) Constructor for range constraint.- Parameters:
name- constraint nameevaluator- evaluation functionlowerBound- lower boundupperBound- upper bound
-
-
Method Details
-
getName
Description copied from interface:ProcessConstraintReturns the name of this constraint.- Specified by:
getNamein interfaceProcessConstraint- Returns:
- constraint name, never null
-
setName
-
getType
-
setType
-
getLowerBound
public double getLowerBound() -
setLowerBound
public void setLowerBound(double lowerBound) -
getUpperBound
public double getUpperBound() -
setUpperBound
public void setUpperBound(double upperBound) -
getEqualityTolerance
public double getEqualityTolerance() -
setEqualityTolerance
public void setEqualityTolerance(double equalityTolerance) -
getUnit
-
setUnit
-
isHard
public boolean isHard()Description copied from interface:ProcessConstraintChecks if this is a hard constraint that makes the solution infeasible when violated.- Specified by:
isHardin interfaceProcessConstraint- Returns:
- true if CRITICAL or HARD severity
-
setHard
public void setHard(boolean hard) -
getPenaltyWeight
public double getPenaltyWeight()Description copied from interface:ProcessConstraintReturns the penalty weight for this constraint.Higher weight means constraint violations are penalized more strongly in penalty-based optimization methods.
- Specified by:
getPenaltyWeightin interfaceProcessConstraint- Returns:
- penalty weight (non-negative)
-
setPenaltyWeight
public void setPenaltyWeight(double penaltyWeight) -
getEvaluator
-
setEvaluator
-
evaluate
Evaluates the constraint value.- Parameters:
process- the process system- Returns:
- constraint value g(x)
-
margin
Calculates the constraint margin (positive = satisfied, negative = violated).- Specified by:
marginin interfaceProcessConstraint- Parameters:
process- the process system- Returns:
- constraint margin
-
isSatisfied
Checks if constraint is satisfied.- Specified by:
isSatisfiedin interfaceProcessConstraint- Parameters:
process- the process system- Returns:
- true if satisfied
-
penalty
Calculates penalty for constraint violation.- Specified by:
penaltyin interfaceProcessConstraint- Parameters:
process- the process system- Returns:
- penalty (0 if satisfied, positive if violated)
-
getSeverityLevel
Returns the severity of this constraint.Uses the unified
ConstraintSeverityLevelenum that maps across all constraint types.- Specified by:
getSeverityLevelin interfaceProcessConstraint- Returns:
- constraint severity level
-
toOptimizationConstraint
Converts this constraint to aProductionOptimizer.OptimizationConstraintfor use with the internal optimizer.Only LOWER_BOUND and UPPER_BOUND types can be converted directly. RANGE constraints are converted to an UPPER_BOUND constraint (using the tightest bound). EQUALITY constraints are approximated as a tight range.
- Returns:
- equivalent OptimizationConstraint
- Throws:
IllegalStateException- if the evaluator function is null
-