sktopt.core.optimizers.oc
- class sktopt.core.optimizers.oc.OC_Config(dst_path: str = './result/pytests', interpolation: Literal['SIMP'] = 'SIMP', record_times: int = 20, max_iters: int = 200, p_init: float = 1.0, p: float = 3.0, p_step: int = -1, vol_frac_init: float = 0.8, vol_frac: float = 0.4, vol_frac_step: int = -3, beta_init: float = 1.0, beta: float = 2, beta_step: int = -1, beta_curvature: float = 2.0, beta_eta: float = 0.5, eta: float = 0.5, percentile_init: float = 60, percentile: float = -90, percentile_step: int = -1, filter_radius_init: float = 2.0, filter_radius: float = 1.2, filter_radius_step: int = -3, E0: float = 210000000000.0, E_min: float = 210000000.0, rho_min: float = 0.01, rho_max: float = 1.0, move_limit_init: float = 0.3, move_limit: float = 0.1, move_limit_step: int = -3, restart: bool = False, restart_from: int = -1, export_img: bool = False, export_img_opaque: bool = False, design_dirichlet: bool = False, lambda_lower: float = 1e-07, lambda_upper: float = 10000000.0, sensitivity_filter: bool = False, solver_option: Literal['spsolve', 'cg_pyamg'] = 'spsolve', scaling: bool = False, eta_init: float = 0.1, eta_step: int = 3)
Bases:
DensityMethodConfig
- eta: float = 0.5
- eta_init: float = 0.1
- eta_step: int = 3
- interpolation: Literal['SIMP'] = 'SIMP'
- class sktopt.core.optimizers.oc.OC_Optimizer(cfg: OC_Config, tsk: TaskConfig)
Bases:
DensityMethod
Topology optimization solver using the classic Optimality Criteria (OC) method. This class implements the standard OC algorithm for compliance minimization problems. It uses a multiplicative density update formula derived from Karush-Kuhn-Tucker (KKT) optimality conditions under volume constraints.
- The update rule typically takes the form:
ρ_new = clamp(ρ * sqrt(-dC / λ), ρ_min, ρ_max)
- where:
dC is the sensitivity of the compliance objective,
λ is a Lagrange multiplier for the volume constraint.
This method is widely used in structural optimization due to its simplicity, interpretability, and solid theoretical foundation.
Advantages
Simple and easy to implement
Intuitive update rule based on physical insight
Well-established and widely validated in literature
- config
Configuration object specifying the interpolation method, volume fraction, continuation settings, filter radius, and other numerical parameters.
- Type:
DensityMethodConfig
- mesh, basis, etc.
FEM components required for simulation, including boundary conditions and loads.
- Type:
inherited from common.DensityMethod
- init_schedulers(export: bool = True)
- rho_update(iter_loop: int, rho_candidate: ndarray, rho_projected: ndarray, dC_drho_ave: ndarray, u_dofs: ndarray, strain_energy_ave: ndarray, scaling_rate: ndarray, move_limit: float, eta: float, beta: float, tmp_lower: ndarray, tmp_upper: ndarray, percentile: float, elements_volume_design: ndarray, elements_volume_design_sum: float, vol_frac: float)
- sktopt.core.optimizers.oc.bisection_with_projection(dC, rho_e, rho_min, rho_max, move_limit, eta, eps, vol_frac, beta, beta_eta, scaling_rate, rho_candidate, tmp_lower, tmp_upper, elements_volume, elements_volume_sum, max_iter: int = 100, tolerance: float = 0.0001, l1: float = 1e-07, l2: float = 10000000.0)