Solvers¶
Solvers to solve topology optimization problems.
Todo
- Make TopOptSolver an abstract class
- Rename the current TopOptSolver to MMASolver(TopOptSolver)
- Create a TopOptSolver using originality criterion
Base Solver¶
-
class
topopt.solvers.
TopOptSolver
(problem, volfrac, filter, gui, maxeval=2000, ftol_rel=0.001)[source]¶ Solver for topology optimization problems using NLopt’s MMA solver.
-
__init__
(problem, volfrac, filter, gui, maxeval=2000, ftol_rel=0.001)[source]¶ Create a solver to solve the problem.
Parameters: - problem (
topopt.problems.Problem
) – The topology optimization problem to solve. - volfrac (float) – The maximum fraction of the volume to use.
- filter (
topopt.filters.Filter
) – A filter for the solutions to reduce artefacts. - gui (
topopt.guis.GUI
) – The graphical user interface to visualize intermediate results. - maxeval (int) – The maximum number of evaluations to perform.
- ftol (float) – A floating point tolerance for relative change.
- problem (
-
filter_variables
(x)[source]¶ Filter the variables and impose values on passive/active variables.
Parameters: x ( ndarray
) – The variables to be filtered.Returns: The filtered “physical” variables. Return type: numpy.ndarray
-
objective_function
(x, dobj)[source]¶ Compute the objective value and gradient.
Parameters: Returns: The objective value.
Return type:
-
objective_function_fdiff
(x, dobj, epsilon=1e-06)[source]¶ Compute the objective value and gradient using finite differences.
Parameters: Returns: The objective value.
Return type:
-
optimize
(x)[source]¶ Optimize the problem.
Parameters: x ( ndarray
) – The initial value for the design variables.Returns: The optimal value of x found. Return type: numpy.ndarray
-