20 #ifndef LIBMESH_OPTIMIZATION_SYSTEM_H 21 #define LIBMESH_OPTIMIZATION_SYSTEM_H 24 #include "libmesh/implicit_system.h" 33 template<
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;
312 #endif // LIBMESH_OPTIMIZATION_SYSTEM_H virtual ~ComputeLowerAndUpperBounds()=default
Abstract base class to be used to calculate the inequality constraints.
This is the EquationSystems class.
virtual ~ComputeHessian()=default
OptimizationSystem sys_type
The type of system.
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.
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 objective function for optimization.
std::unique_ptr< NumericVector< Number > > lambda_ineq
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...
ImplicitSystem Parent
The type of the parent.
virtual void solve() override
Solves the optimization problem.
virtual void init_data() override
Initializes new data members of the system.
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).
std::unique_ptr< NumericVector< Number > > C_eq
The vector that stores equality constraints.
The libMesh namespace provides an interface to certain functionality in the library.
virtual ~ComputeGradient()=default
std::unique_ptr< SparseMatrix< Number > > C_ineq_jac
The sparse matrix that stores the Jacobian of C_ineq.
virtual std::string system_type() const override
virtual ~ComputeObjective()=default
virtual ~ComputeEqualityConstraintsJacobian()=default
unsigned int number() const
Abstract base class to be used to calculate the equality constraints.
OptimizationSystem & operator=(const OptimizationSystem &)=delete
This System subclass enables us to assemble an objective function, gradient, Hessian and bounds for o...
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
virtual ~ComputeInequalityConstraintsJacobian()=default
std::vector< std::set< numeric_index_type > > ineq_constraint_jac_sparsity
std::vector< std::set< numeric_index_type > > eq_constraint_jac_sparsity
A copy of the equality and inequality constraint Jacobian sparsity patterns.
std::unique_ptr< SparseMatrix< Number > > C_eq_jac
The sparse matrix that stores the Jacobian of C_eq.
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). ...
std::unique_ptr< OptimizationSolver< Number > > optimization_solver
The OptimizationSolver that is used for performing the optimization.
std::unique_ptr< NumericVector< Number > > lambda_eq
Vectors to store the dual variables associated with equality and inequality constraints.
virtual void lower_and_upper_bounds(sys_type &S)=0
This function should update the following two vectors: this->get_vector("lower_bounds"), this->get_vector("upper_bounds").
Abstract base class to be used to calculate the gradient of an objective function.
Abstract base class to be used to calculate the Jacobian of the equality constraints.
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...
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).
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.
virtual ~OptimizationSystem()
Abstract base class to be used to calculate the Hessian of an objective function. ...
virtual ~ComputeEqualityConstraints()=default
virtual void clear() override
Clear all the data structures associated with the system.
virtual ~ComputeInequalityConstraints()=default
const std::string & name() const
OptimizationSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
Abstract base class to be used to calculate the lower and upper bounds for all dofs in the system...
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).
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems...
std::unique_ptr< NumericVector< Number > > C_ineq
The vector that stores inequality constraints.
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...
Abstract base class to be used to calculate the Jacobian of the inequality constraints.