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:
  • Field Details

  • 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 name
      evaluator - evaluation function
      lowerBound - lower bound value
    • ConstraintDefinition

      public ConstraintDefinition(String name, ToDoubleFunction<ProcessSystem> evaluator, double lowerBound, double upperBound)
      Constructor for range constraint.
      Parameters:
      name - constraint name
      evaluator - evaluation function
      lowerBound - lower bound
      upperBound - upper bound
  • Method Details

    • getName

      public String getName()
      Description copied from interface: ProcessConstraint
      Returns the name of this constraint.
      Specified by:
      getName in interface ProcessConstraint
      Returns:
      constraint name, never null
    • setName

      public void setName(String name)
    • 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

      public String getUnit()
    • setUnit

      public void setUnit(String unit)
    • isHard

      public boolean isHard()
      Description copied from interface: ProcessConstraint
      Checks if this is a hard constraint that makes the solution infeasible when violated.
      Specified by:
      isHard in interface ProcessConstraint
      Returns:
      true if CRITICAL or HARD severity
    • setHard

      public void setHard(boolean hard)
    • getPenaltyWeight

      public double getPenaltyWeight()
      Description copied from interface: ProcessConstraint
      Returns the penalty weight for this constraint.

      Higher weight means constraint violations are penalized more strongly in penalty-based optimization methods.

      Specified by:
      getPenaltyWeight in interface ProcessConstraint
      Returns:
      penalty weight (non-negative)
    • setPenaltyWeight

      public void setPenaltyWeight(double penaltyWeight)
    • getEvaluator

      public ToDoubleFunction<ProcessSystem> getEvaluator()
    • setEvaluator

      public void setEvaluator(ToDoubleFunction<ProcessSystem> evaluator)
    • evaluate

      public double evaluate(ProcessSystem process)
      Evaluates the constraint value.
      Parameters:
      process - the process system
      Returns:
      constraint value g(x)
    • margin

      public double margin(ProcessSystem process)
      Calculates the constraint margin (positive = satisfied, negative = violated).
      Specified by:
      margin in interface ProcessConstraint
      Parameters:
      process - the process system
      Returns:
      constraint margin
    • isSatisfied

      public boolean isSatisfied(ProcessSystem process)
      Checks if constraint is satisfied.
      Specified by:
      isSatisfied in interface ProcessConstraint
      Parameters:
      process - the process system
      Returns:
      true if satisfied
    • penalty

      public double penalty(ProcessSystem process)
      Calculates penalty for constraint violation.
      Specified by:
      penalty in interface ProcessConstraint
      Parameters:
      process - the process system
      Returns:
      penalty (0 if satisfied, positive if violated)
    • getSeverityLevel

      public ConstraintSeverityLevel getSeverityLevel()
      Returns the severity of this constraint.

      Uses the unified ConstraintSeverityLevel enum that maps across all constraint types.

      Specified by:
      getSeverityLevel in interface ProcessConstraint
      Returns:
      constraint severity level
    • toOptimizationConstraint

      public ProductionOptimizer.OptimizationConstraint toOptimizationConstraint()
      Converts this constraint to a ProductionOptimizer.OptimizationConstraint for 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