|
libMesh
|
This class encapsulate all functionality required for assembling the objective function, gradient, and hessian. More...
Public Member Functions | |
| AssembleOptimization (OptimizationSystem &sys_in) | |
| Constructor. | |
| void | assemble_A_and_F () |
| The optimization problem we consider here is: min_U 0.5*U^T A U - U^T F. | |
| virtual Number | objective (const NumericVector< Number > &soln, OptimizationSystem &) |
| Evaluate the objective function. | |
| virtual void | gradient (const NumericVector< Number > &soln, NumericVector< Number > &grad_f, OptimizationSystem &) |
| Evaluate the gradient. | |
| virtual void | hessian (const NumericVector< Number > &soln, SparseMatrix< Number > &H_f, OptimizationSystem &) |
| Evaluate the Hessian. | |
| AssembleOptimization (OptimizationSystem &sys_in) | |
| Constructor. | |
| void | assemble_A_and_F () |
| The optimization problem we consider here is: min_U 0.5*U^T A U - U^T F. | |
| virtual Number | objective (const NumericVector< Number > &soln, OptimizationSystem &) |
| Evaluate the objective function. | |
| virtual void | gradient (const NumericVector< Number > &soln, NumericVector< Number > &grad_f, OptimizationSystem &) |
| Evaluate the gradient. | |
| virtual void | hessian (const NumericVector< Number > &soln, SparseMatrix< Number > &H_f, OptimizationSystem &) |
| Evaluate the Hessian. | |
| virtual void | equality_constraints (const NumericVector< Number > &X, NumericVector< Number > &C_eq, OptimizationSystem &) |
| Evaluate the equality constraints. | |
| virtual void | equality_constraints_jacobian (const NumericVector< Number > &X, SparseMatrix< Number > &C_eq_jac, OptimizationSystem &) |
| Evaluate the equality constraints Jacobian. | |
| virtual void | inequality_constraints (const NumericVector< Number > &X, NumericVector< Number > &C_ineq, OptimizationSystem &) |
| Evaluate the inequality constraints. | |
| virtual void | inequality_constraints_jacobian (const NumericVector< Number > &X, SparseMatrix< Number > &C_ineq_jac, OptimizationSystem &) |
| Evaluate the inequality constraints Jacobian. | |
| virtual void | lower_and_upper_bounds (OptimizationSystem &sys) |
| Evaluate the lower and upper bounds vectors. | |
Public Attributes | |
| SparseMatrix< Number > * | A_matrix |
| Sparse matrix for storing the matrix A. | |
| NumericVector< Number > * | F_vector |
| Vector for storing F. | |
Private Attributes | |
| OptimizationSystem & | _sys |
| Keep a reference to the OptimizationSystem. | |
This class encapsulate all functionality required for assembling the objective function, gradient, and hessian.
This class encapsulate all functionality required for assembling the objective function, gradient, hessian, and constraints.
Definition at line 67 of file optimization_ex1.C.
| AssembleOptimization::AssembleOptimization | ( | OptimizationSystem & | sys_in | ) |
Constructor.
Definition at line 127 of file optimization_ex1.C.
| AssembleOptimization::AssembleOptimization | ( | OptimizationSystem & | sys_in | ) |
Constructor.
| void AssembleOptimization::assemble_A_and_F | ( | ) |
The optimization problem we consider here is: min_U 0.5*U^T A U - U^T F.
In this method, we assemble A and F.
Definition at line 131 of file optimization_ex1.C.
References _sys, A_matrix, libMesh::SparseMatrix< T >::add_matrix(), libMesh::NumericVector< T >::add_vector(), libMesh::FEGenericBase< OutputType >::build(), libMesh::NumericVector< T >::close(), libMesh::SparseMatrix< T >::close(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::FEType::default_quadrature_order(), dim, libMesh::DofMap::dof_indices(), F_vector, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::DofMap::is_constrained_dof(), mesh, libMesh::MeshBase::mesh_dimension(), libMesh::QBase::n_points(), libMesh::DenseVector< T >::resize(), libMesh::DenseMatrix< T >::resize(), libMesh::System::variable_number(), libMesh::DofMap::variable_type(), libMesh::NumericVector< T >::zero(), and libMesh::SparseMatrix< T >::zero().
Referenced by main().
| void AssembleOptimization::assemble_A_and_F | ( | ) |
The optimization problem we consider here is: min_U 0.5*U^T A U - U^T F.
In this method, we assemble A and F.
|
virtual |
Evaluate the equality constraints.
Implements libMesh::OptimizationSystem::ComputeEqualityConstraints.
Definition at line 276 of file optimization_ex2.C.
References libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::localize(), libMesh::SERIAL, libMesh::NumericVector< T >::set(), libMesh::NumericVector< T >::size(), and libMesh::NumericVector< T >::zero().
|
virtual |
Evaluate the equality constraints Jacobian.
Implements libMesh::OptimizationSystem::ComputeEqualityConstraintsJacobian.
Definition at line 298 of file optimization_ex2.C.
References libMesh::OptimizationSystem::C_eq, libMesh::SparseMatrix< T >::set(), value, and libMesh::SparseMatrix< T >::zero().
|
virtual |
Evaluate the gradient.
Implements libMesh::OptimizationSystem::ComputeGradient.
Definition at line 217 of file optimization_ex1.C.
References A_matrix, libMesh::NumericVector< T >::add(), F_vector, libMesh::SparseMatrix< T >::vector_mult(), and libMesh::NumericVector< T >::zero().
|
virtual |
Evaluate the gradient.
Implements libMesh::OptimizationSystem::ComputeGradient.
|
virtual |
Evaluate the Hessian.
Implements libMesh::OptimizationSystem::ComputeHessian.
Definition at line 231 of file optimization_ex1.C.
References A_matrix, libMesh::SparseMatrix< T >::add(), and libMesh::SparseMatrix< T >::zero().
|
virtual |
Evaluate the Hessian.
Implements libMesh::OptimizationSystem::ComputeHessian.
|
virtual |
Evaluate the inequality constraints.
Implements libMesh::OptimizationSystem::ComputeInequalityConstraints.
Definition at line 335 of file optimization_ex2.C.
References libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::localize(), libMesh::SERIAL, libMesh::NumericVector< T >::set(), libMesh::NumericVector< T >::size(), and libMesh::NumericVector< T >::zero().
|
virtual |
Evaluate the inequality constraints Jacobian.
Implements libMesh::OptimizationSystem::ComputeInequalityConstraintsJacobian.
Definition at line 354 of file optimization_ex2.C.
References libMesh::NumericVector< T >::build(), libMesh::OptimizationSystem::C_ineq, libMesh::ParallelObject::comm(), libMesh::NumericVector< T >::localize(), libMesh::SERIAL, libMesh::SparseMatrix< T >::set(), libMesh::NumericVector< T >::size(), value, and libMesh::SparseMatrix< T >::zero().
|
virtual |
Evaluate the lower and upper bounds vectors.
Implements libMesh::OptimizationSystem::ComputeLowerAndUpperBounds.
Definition at line 387 of file optimization_ex2.C.
References libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::first_dof(), libMesh::System::get_dof_map(), libMesh::System::get_vector(), and libMesh::NumericVector< T >::set().
|
virtual |
Evaluate the objective function.
Implements libMesh::OptimizationSystem::ComputeObjective.
Definition at line 203 of file optimization_ex1.C.
References A_matrix, libMesh::NumericVector< T >::dot(), F_vector, libMesh::SparseMatrix< T >::vector_mult(), and libMesh::NumericVector< T >::zero_clone().
|
virtual |
Evaluate the objective function.
Implements libMesh::OptimizationSystem::ComputeObjective.
|
private |
Keep a reference to the OptimizationSystem.
Definition at line 77 of file optimization_ex1.C.
Referenced by assemble_A_and_F().
| SparseMatrix< Number > * AssembleOptimization::A_matrix |
Sparse matrix for storing the matrix A.
We use this to facilitate computation of objective, gradient and hessian.
Definition at line 118 of file optimization_ex1.C.
Referenced by assemble_A_and_F(), gradient(), hessian(), main(), and objective().
| NumericVector< Number > * AssembleOptimization::F_vector |
Vector for storing F.
We use this to facilitate computation of objective, gradient and hessian.
Definition at line 124 of file optimization_ex1.C.
Referenced by assemble_A_and_F(), gradient(), main(), and objective().