20#ifndef LIBMESH_OPTIMIZATION_SYSTEM_H
21#define LIBMESH_OPTIMIZATION_SYSTEM_H
24#include "libmesh/implicit_system.h"
33template<
typename T>
class OptimizationSolver;
51 const std::string &
name,
52 const unsigned int number);
231 virtual void clear ()
override;
242 virtual void reinit ()
override;
247 virtual void solve ()
override;
268 virtual std::string
system_type ()
const override {
return "Optimization"; }
278 std::unique_ptr<NumericVector<Number>>
C_eq;
288 std::unique_ptr<NumericVector<Number>>
C_ineq;
This is the EquationSystems class.
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Abstract base class to be used to calculate the Jacobian of the equality constraints.
virtual void equality_constraints_jacobian(const NumericVector< Number > &X, SparseMatrix< Number > &C_eq_jac, sys_type &S)=0
This function will be called to evaluate the Jacobian of C_eq(X).
virtual ~ComputeEqualityConstraintsJacobian()=default
Abstract base class to be used to calculate the equality constraints.
virtual ~ComputeEqualityConstraints()=default
virtual void equality_constraints(const NumericVector< Number > &X, NumericVector< Number > &C_eq, sys_type &S)=0
This function will be called to evaluate the equality constraints vector C_eq(X).
Abstract base class to be used to calculate the gradient of an objective function.
virtual ~ComputeGradient()=default
virtual void gradient(const NumericVector< Number > &X, NumericVector< Number > &grad_f, sys_type &S)=0
This function will be called to compute the gradient of the objective function, and must be implement...
Abstract base class to be used to calculate the Hessian of an objective function.
virtual ~ComputeHessian()=default
virtual void hessian(const NumericVector< Number > &X, SparseMatrix< Number > &H_f, sys_type &S)=0
This function will be called to compute the Hessian of the objective function, and must be implemente...
Abstract base class to be used to calculate the Jacobian of the inequality constraints.
virtual void inequality_constraints_jacobian(const NumericVector< Number > &X, SparseMatrix< Number > &C_ineq_jac, sys_type &S)=0
This function will be called to evaluate the Jacobian of C_ineq(X).
virtual ~ComputeInequalityConstraintsJacobian()=default
Abstract base class to be used to calculate the inequality constraints.
virtual ~ComputeInequalityConstraints()=default
virtual void inequality_constraints(const NumericVector< Number > &X, NumericVector< Number > &C_ineq, sys_type &S)=0
This function will be called to evaluate the equality constraints vector C_ineq(X).
Abstract base class to be used to calculate the lower and upper bounds for all dofs in the system.
virtual void lower_and_upper_bounds(sys_type &S)=0
This function should update the following two vectors: this->get_vector("lower_bounds"),...
virtual ~ComputeLowerAndUpperBounds()=default
Abstract base class to be used to calculate the objective function for optimization.
virtual ~ComputeObjective()=default
virtual Number objective(const NumericVector< Number > &X, sys_type &S)=0
This function will be called to compute the objective function to be minimized, and must be implement...
This System subclass enables us to assemble an objective function, gradient, Hessian and bounds for o...
std::unique_ptr< NumericVector< Number > > C_ineq
The vector that stores inequality constraints.
OptimizationSystem sys_type
The type of system.
void initialize_equality_constraints_storage(const std::vector< std::set< numeric_index_type > > &constraint_jac_sparsity)
Initialize storage for the equality constraints, and the corresponding Jacobian.
std::unique_ptr< NumericVector< Number > > lambda_ineq
virtual void solve() override
Solves the optimization problem.
virtual ~OptimizationSystem()
std::vector< std::set< numeric_index_type > > eq_constraint_jac_sparsity
A copy of the equality and inequality constraint Jacobian sparsity patterns.
std::vector< std::set< numeric_index_type > > ineq_constraint_jac_sparsity
std::unique_ptr< SparseMatrix< Number > > C_eq_jac
The sparse matrix that stores the Jacobian of C_eq.
std::unique_ptr< NumericVector< Number > > C_eq
The vector that stores equality constraints.
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
OptimizationSystem & operator=(const OptimizationSystem &)=delete
OptimizationSystem(const OptimizationSystem &)=delete
Special functions.
void initialize_inequality_constraints_storage(const std::vector< std::set< numeric_index_type > > &constraint_jac_sparsity)
Initialize storage for the inequality constraints, as per initialize_equality_constraints_storage.
std::unique_ptr< SparseMatrix< Number > > C_ineq_jac
The sparse matrix that stores the Jacobian of C_ineq.
OptimizationSystem(OptimizationSystem &&)=default
virtual void init_data() override
Initializes new data members of the system.
std::unique_ptr< NumericVector< Number > > lambda_eq
Vectors to store the dual variables associated with equality and inequality constraints.
virtual void clear() override
Clear all the data structures associated with the system.
virtual std::string system_type() const override
std::unique_ptr< OptimizationSolver< Number > > optimization_solver
The OptimizationSolver that is used for performing the optimization.
ImplicitSystem Parent
The type of the parent.
const std::string & name() const
unsigned int number() const
The libMesh namespace provides an interface to certain functionality in the library.