sktopt.core.optimizers.logmoc
- class sktopt.core.optimizers.logmoc.LogMOC_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.6, 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, mu_p: float = 300.0, lambda_v: float = 10.0, lambda_decay: float = 0.9)
Bases:
DensityMethodConfig
Configuration for log-space gradient update with optional mean-centering.
This configuration supports a variant of log-space Lagrangian descent used in topology optimization. The update is performed in the logarithmic domain to ensure strictly positive densities and to simulate multiplicative behavior. Optionally, the computed update direction can be centered (mean-subtracted) to improve numerical stability.
This method differs from standard OC-based updates: it adds the volume constraint penalty directly to the compliance sensitivity and applies the gradient step in log(ρ)-space:
log(ρ_new) = log(ρ) - η · (∂C/∂ρ + λ)
Optionally (when enabled), the update direction is centered as:
Δ = (∂C/∂ρ + λ) - mean(∂C/∂ρ + λ)
- interpolation
Interpolation scheme used for material penalization. Currently only “SIMP” is supported.
- Type:
Literal[“SIMP”]
- mu_p
Penalty weight for the volume constraint. This controls how strongly the constraint influences the descent direction.
- Type:
float
- lambda_v
Initial Lagrange multiplier for the volume constraint.
- Type:
float
- lambda_decay
Factor by which lambda_v decays over iterations. Smaller values cause λ to adapt more rapidly.
- Type:
float
- interpolation: Literal['SIMP'] = 'SIMP'
- lambda_decay: float = 0.9
- lambda_v: float = 10.0
- mu_p: float = 300.0
- class sktopt.core.optimizers.logmoc.LogMOC_Optimizer(cfg: LogMOC_Config, tsk: TaskConfig)
Bases:
DensityMethod
Topology optimization solver using log-space Lagrangian gradient descent.
This optimizer performs sensitivity-based topology optimization by applying gradient descent on the Lagrangian (compliance + volume penalty) in the logarithmic domain. The update is computed in log(ρ)-space to ensure positive densities and simulate multiplicative behavior.
Unlike traditional Optimality Criteria (OC) methods, this approach adds the volume constraint penalty λ directly to the compliance sensitivity, rather than forming a multiplicative ratio. The update is then applied as:
log(ρ_new) = log(ρ) - η · (∂C/∂ρ + λ)
which is equivalent to:
ρ_new = ρ · exp( - η · (∂C/∂ρ + λ) )
This method maintains positivity of the density field without explicit clipping and offers improved numerical robustness for problems involving low volume fractions or sharp sensitivity gradients.
Advantages
Ensures positive densities via log-space formulation
Simulates OC-like multiplicative update behavior
Straightforward gradient descent formulation
Limitations
Not derived from strict OC/KKT conditions
May still require step size tuning and clipping for stability
Involves logarithmic and exponential operations at each iteration
- config
Configuration object specifying parameters such as mu_p, lambda_v, decay schedules, and interpolation settings (currently SIMP only).
- Type:
LogGradientUpdateConfig
- mesh, basis, etc.
FEM components used to evaluate sensitivities and apply boundary conditions.
- Type:
inherited from common.DensityMethod
- 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.logmoc.moc_log_update_logspace(rho, dC, lambda_v, scaling_rate, eta, move_limit, tmp_lower, tmp_upper, rho_min, rho_max)