ddg.optimize.he.minimize module

ddg.optimize.he.minimize.minimization_history(x, history, functional=None)[source]

Saves the minimization history in the given iterable (history). Entries are dictionary’s linking indices of interior cells to the value after the minimizing steps.

Parameters:
x: numpy.ndarray

Flattened output of scipy.minimize.

history: list

List to store the results after each minimization step. Entries are dictionary’s (see above).

functionalddg.optimize.he.functional.HalfEdgeFunctional

Half-edge functional of minimization process.

Returns:
None
ddg.optimize.he.minimize.function_decorator_flatten(function, functional)[source]

Returns a function that wraps the given function to be able to handle flat inputs.

Parameters:
function:

Function of functional that handles multidimensional input.

functionalddg.optimize.he.functional.HalfEdgeFunctional

Half-edge functional of minimization process.

Returns:
function
ddg.optimize.he.minimize.result_decorator_unflatten(x, functional)[source]

Reshapes the given (flat) array x to the multidimensional shape that was given by the functional.

Parameters:
x: numpy.ndarray of shape (n, )

Flat input array.

functionalddg.optimize.he.functional.HalfEdgeFunctional

Functional of minimization process.

Returns:
function
ddg.optimize.he.minimize.write_to_attribute(multi_dim_result, functional)[source]

Takes the multidimensional result of the minimization process (i.e. given by result_decorator_unflatten) and writes it to the corresponding cells given by the functional.

Parameters:
multi_dim_result: np.ndarray of shape(n, dim)

Where n is the number of (interior-) cells in the minimization process and dim the dimension of the minimization attribute.

functionalddg.optimize..he.functional.HalfEdgeFunctional

Functional of minimization process.

Returns:
None
ddg.optimize.he.minimize.minimizer(functional, return_history=False, **kwargs)[source]

Minimizer for a given functional. Minimizes value of interior cells where these cells are being computed as the complement of fucntional.boundary_cells. The values must be stored in a cell attribute, referenced by functional.attr_name. The scipy.optimize.minimize function only accepts functionals with 1-dimensional input. For functionals that have multidimensional input, the minimizer acts as a decorator and wraps the functional to convert the input to a multidimensional one. The current values are being used as starting values and the methods functional.gradient and functional.hessian are being used in optimization if they are implemented. The history keyword allows to store the result of the minimization process after each step.

Parameters:
functionalddg.optimize.functional.he.HalfEdgeFunctional

functional to minimize

history: bool (default=False)
**kwargs: keyword arguments for scipy.optimize.minimize

By default jac=functional.gradient and hess=functional.hessian if existent

Returns:
scipy.optimize.OptimizeResult

and updates the desired values of the surface

Warning

If history argument is True, a callback function will be initialized to store the step wise results of the minimization. This will overwrite any callback function that might be given by the **kwargs input.

See also

ddg.optimize.minimize.minimization_history