WeldedBeamFunction#
- class WeldedBeamFunction(P: float = 6000.0, L: float = 14.0, E: float = 30000000.0, G: float = 12000000.0, tau_max: float = 13600.0, sigma_max: float = 30000.0, delta_max: float = 0.25, 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]#
Welded beam design optimization problem.
This is one of the most widely used engineering benchmark problems in optimization literature. The goal is to design a welded beam for minimum fabrication cost while satisfying constraints on shear stress, bending stress, buckling load, and end deflection.
Problem Description
A rigid member is welded to a beam, which is attached to a wall. The beam must support a load P applied at the end. The weld and beam geometry must be optimized to minimize cost.
|<------ L ------->| | | ========+==================+ <- beam (t x b) ========| | weld ->| | (h x l) | | | * <- P (load) --------+------------------+ WALL
The weld has dimensions h (height) and l (length). The beam has dimensions t (thickness) and b (height/depth).
Design Variables
- hfloat
Weld height (thickness of weld bead). Bounds: [0.125, 5.0] inches
- lfloat
Weld length (along the beam). Bounds: [0.1, 10.0] inches
- tfloat
Beam depth (height). Bounds: [0.1, 10.0] inches
- bfloat
Beam width (thickness). Bounds: [0.125, 5.0] inches
Objective Function
Minimize fabrication cost:
\[f(h, l, t, b) = 1.10471 h^2 l + 0.04811 t b (14.0 + l)\]The first term represents weld cost (proportional to weld volume), and the second term represents beam material cost.
Constraints
Shear stress in weld must not exceed allowable (tau <= tau_max)
Bending stress in beam must not exceed allowable (sigma <= sigma_max)
Beam thickness must not exceed weld height (h >= t)
Buckling load must exceed applied load (P <= P_c)
End deflection must not exceed limit (delta <= delta_max)
- Parameters:
P (float, default=6000.0) – Applied load (lb).
L (float, default=14.0) – Beam length from wall to load (inches).
E (float, default=30e6) – Elastic modulus (psi).
G (float, default=12e6) – Shear modulus (psi).
tau_max (float, default=13600.0) – Maximum allowable shear stress (psi).
sigma_max (float, default=30000.0) – Maximum allowable bending stress (psi).
delta_max (float, default=0.25) – Maximum allowable deflection (inches).
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.
- x_global[source]#
Best known solution: [0.2057296398, 3.4704886656, 9.0366239104, 0.2057296398].
- Type:
ndarray
References
Examples
>>> from surfaces.test_functions.engineering import WeldedBeamFunction >>> func = WeldedBeamFunction() >>> # Evaluate at a point >>> result = func({"h": 0.2, "l": 3.5, "t": 9.0, "b": 0.2}) >>> # Check constraint violations >>> violations = func.constraint_violations({"h": 0.2, "l": 3.5, "t": 9.0, "b": 0.2})
- __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.
- constraint_violations(params: Dict[str, Any]) List[float][source]#
Calculate constraint violations (positive values only).
- property meta: MetaSpec[source]#
Instance display/identity metadata (a frozen MetaSpec).
Metadata is fully static today, so this returns the class-level
MetaSpecresolved at class-definition time.
- 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:
- 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.
- property search_space: Dict[str, Any][source]#
Search space for this function (read-only public API).
- property spec: FunctionSpec[source]#
Instance-resolved function specification (a frozen FunctionSpec).
type(self)._specis the static class-level template. This property overlays the fields that genuinely vary per instance (n_dim,n_objectives,f_global,x_global) by lifting them off the instance, so thatfunc.spec.n_dimreflects this instance’s value. It is resolved on every access rather than cached, because some functions (e.g. BBOB) readspecduring__init__before the optimum has been computed, and a cached early value would go stale.