PressureVesselFunction#

class PressureVesselFunction(min_volume: float = 750.0, objective: str = 'minimize', modifiers: List[BaseModifier] | None = None, memory: bool = False, collect_data: bool = True, callbacks=None, catch_errors=None, penalty_coefficient: float = 1000000.0)[source]#

Cylindrical pressure vessel design optimization problem.

This problem involves designing a compressed air storage tank with a working pressure of 3000 psi and a minimum volume of 750 cubic feet. The vessel is cylindrical with hemispherical end caps.

Problem Description

The tank consists of a cylindrical shell with two hemispherical heads. Both the shell and heads are made from rolled steel plate, which is available in discrete thicknesses (multiples of 0.0625 inches).

    |<-------- L -------->|
    _______________________
 /                         \
(                           )  <- hemispherical
|                           |     head (Th)
|                           |
|       cylindrical         |  <- shell (Ts)
|         shell             |
|                           |
|           R               |  <- inner radius
|<--------->|               |
(                           )
 \_______________________//

The objective is to minimize the total cost, which includes material cost, forming cost, and welding cost.

Design Variables

Tsfloat

Shell thickness. Bounds: [0.0625, 6.1875] inches (integer multiples of 0.0625)

Thfloat

Head thickness. Bounds: [0.0625, 6.1875] inches (integer multiples of 0.0625)

Rfloat

Inner radius of the vessel. Bounds: [10.0, 200.0] inches

Lfloat

Length of the cylindrical section (not including heads). Bounds: [10.0, 200.0] inches

Objective Function

Minimize total cost:

\[f(T_s, T_h, R, L) = 0.6224 T_s R L + 1.7781 T_h R^2 + 3.1661 T_s^2 L + 19.84 T_s^2 R\]

The terms represent: - Cylindrical shell material and welding - Hemispherical head material - Shell forming cost - Head-to-shell welding cost

Constraints

  1. Shell thickness must satisfy hoop stress requirement

  2. Head thickness must satisfy stress requirement

  3. Volume must meet minimum requirement (750 ft^3)

Parameters:
  • min_volume (float, default=750.0) – Minimum required volume in cubic feet.

  • objective (str, default="minimize") – Either “minimize” or “maximize”.

  • sleep (float, default=0) – Artificial delay in seconds.

  • penalty_coefficient (float, default=1e6) – Penalty coefficient for constraint violations.

f_global[source]#

Best known objective value: approximately 6059.71.

Type:

float

x_global[source]#

Best known solution: [0.8125, 0.4375, 42.0984, 176.6366].

Type:

ndarray

Notes

In the original problem formulation, Ts and Th are constrained to be integer multiples of 0.0625 inches (standard plate thicknesses). This continuous relaxation allows any value within bounds.

References

Examples

>>> from surfaces.test_functions.engineering import PressureVesselFunction
>>> func = PressureVesselFunction()
>>> # Evaluate at a point
>>> result = func({"Ts": 0.8, "Th": 0.4, "R": 42.0, "L": 180.0})
>>> # Check if design meets volume requirement
>>> func.is_feasible({"Ts": 0.8125, "Th": 0.4375, "R": 42.0984, "L": 176.6366})
True
x_global: ndarray | None = array([  0.8125,   0.4375,  42.0984, 176.6366])[source]#
__call__(params: Dict[str, Any] | ndarray | list | tuple | None = None, *, fidelity: float | None = None, **kwargs)[source]#

Evaluate the objective function.

Args:

params: Parameter values as dict, array, list, or tuple fidelity: Optional fidelity level in (0, 1]. Controls evaluation

cost vs accuracy trade-off for multi-fidelity optimization (e.g. Hyperband, BOHB). None means full-fidelity evaluation. Only supported by ML test functions; ignored by algebraic functions.

**kwargs: Parameters as keyword arguments (only with dict input)

Returns:

The objective function value

batch(X: ArrayLike) ArrayLike[source]#

Evaluate multiple parameter sets in a single call.

Parameters:

X (ArrayLike) – 2D array of shape (n_points, n_dim) where each row is a parameter set.

Returns:

1D array of shape (n_points,) with evaluation results.

Return type:

ArrayLike

Raises:
  • NotImplementedError – If the function does not implement _batch_objective.

  • ValueError – If X has wrong number of dimensions or wrong n_dim.

property callbacks[source]#

Callback management (CallbackAccessor).

constraint_violations(params: Dict[str, Any]) List[float][source]#

Calculate constraint violations (positive values only).

Parameters:

params (dict) – Design variable values.

Returns:

Violation amounts. Zero means constraint is satisfied.

Return type:

list of float

constraints(params: Dict[str, Any]) List[float][source]#

Public API: evaluate constraint functions.

property data[source]#

Evaluation data (DataAccessor).

property errors[source]#

Error handler management (ErrorAccessor).

is_feasible(params: Dict[str, Any]) bool[source]#

Check if a solution satisfies all constraints.

Parameters:

params (dict) – Design variable values.

Returns:

True if all constraints are satisfied.

Return type:

bool

property memory[source]#

Memory cache management (MemoryAccessor).

property meta[source]#

Function metadata (MetaAccessor).

property modifiers[source]#

Modifier management (ModifierAccessor).

property n_dim: int[source]#

Number of design variables.

penalty(params: Dict[str, Any]) float[source]#

Calculate total penalty for constraint violations.

Parameters:

params (dict) – Design variable values.

Returns:

Penalty value (sum of squared violations times coefficient).

Return type:

float

property plot[source]#

Access plotting methods for this function.

pure(params: Dict[str, Any] | ndarray | list | tuple | None = None, *, fidelity: float | None = None, **kwargs)[source]#

Evaluate the function without modifiers.

Returns the true (deterministic) function value, bypassing any configured modifiers. Does not update search_data, n_evaluations, or callbacks. Ignores memory caching.

Parameters:
  • params (dict, array, list, or tuple) – Parameter values to evaluate.

  • fidelity (float or None) – Fidelity level in (0, 1] for multi-fidelity evaluation.

  • **kwargs (dict) – Parameters as keyword arguments.

Returns:

The true function value without modifiers, with direction applied.

Return type:

float or np.ndarray

raw_objective(params: Dict[str, Any]) float[source]#

Public API: evaluate raw objective without penalties.

reset() None[source]#

Reset all state including collected data and memory cache.

property search_space: Dict[str, Any][source]#

Search space for this function (read-only public API).

property spec[source]#

Function characteristics (SpecAccessor).