10 #ifndef __MITTELMANNBNDRYCNTRLDIRI_HPP__
11 #define __MITTELMANNBNDRYCNTRLDIRI_HPP__
18 #include "configall_system.h"
27 # error "don't have header file for math"
37 # error "don't have header file for stdio"
41 using namespace Ipopt;
107 bool& use_x_scaling,
Index n,
109 bool& use_g_scaling,
Index m,
191 return (j-1) + N_*(i-1);
219 printf(
"N has to be at least 1.");
228 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, d_const);
235 return 3. + 5.*(x1*(x1-1.)*x2*(x2-1.));
258 printf(
"N has to be at least 1.");
267 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, d_const);
274 return 3. + 5.*(x1*(x1-1.)*x2*(x2-1.));
297 printf(
"N has to be at least 1.");
306 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, d_const);
313 return 3. + 5.*(x1*(x1-1.)*x2*(x2-1.));
336 printf(
"N has to be at least 1.");
345 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, d_const);
352 return 3. + 5.*(x1*(x1-1.)*x2*(x2-1.));
Number * x
Input: Starting point Output: Optimal solution.
Number Number Index Number Number Index Index nele_hess
Number of non-zero elements in Hessian of Lagrangian.
Number Number * g
Values of constraint at final point (output only - ignored if set to NULL)
Number Number Index Number Number Index nele_jac
Number of non-zero elements in constraint Jacobian.
Number Number * x_scaling
Number Number Number * g_scaling
Number Number Index m
Number of constraints.
Number Number Index Number Number Index Index Index index_style
indexing style for iRow & jCol, 0 for C style, 1 for Fortran style
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
IndexStyleEnum
overload this method to return the number of variables and constraints, and the number of non-zeros i...
Class implementating Example 1.
MittelmannBndryCntrlDiri1()
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
MittelmannBndryCntrlDiri1 & operator=(const MittelmannBndryCntrlDiri1 &)
virtual ~MittelmannBndryCntrlDiri1()
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
MittelmannBndryCntrlDiri1(const MittelmannBndryCntrlDiri1 &)
Class implementating Example 2.
MittelmannBndryCntrlDiri2(const MittelmannBndryCntrlDiri2 &)
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
MittelmannBndryCntrlDiri2()
MittelmannBndryCntrlDiri2 & operator=(const MittelmannBndryCntrlDiri2 &)
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
virtual ~MittelmannBndryCntrlDiri2()
Class implementating Example 3.
MittelmannBndryCntrlDiri3 & operator=(const MittelmannBndryCntrlDiri3 &)
MittelmannBndryCntrlDiri3(const MittelmannBndryCntrlDiri3 &)
MittelmannBndryCntrlDiri3()
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
virtual ~MittelmannBndryCntrlDiri3()
Class implementating Example 4.
virtual ~MittelmannBndryCntrlDiri4()
MittelmannBndryCntrlDiri4 & operator=(const MittelmannBndryCntrlDiri4 &)
MittelmannBndryCntrlDiri4(const MittelmannBndryCntrlDiri4 &)
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
MittelmannBndryCntrlDiri4()
Base class for boundary control problems with Dirichlet boundary conditions, as formulated by Hans Mi...
Number x2_grid(Index i) const
Compute the grid coordinate for given index in x2 direction.
virtual bool get_scaling_parameters(Number &obj_scaling, bool &use_x_scaling, Index n, Number *x_scaling, bool &use_g_scaling, Index m, Number *g_scaling)
Method for returning scaling parameters.
virtual bool get_bounds_info(Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u)
Method to return the bounds for my problem.
Number x1_grid(Index i) const
Compute the grid coordinate for given index in x1 direction.
virtual Number y_d_cont(Number x1, Number x2) const =0
Target profile function for y.
Index pde_index(Index i, Index j) const
Translation of interior mesh point indices to the corresponding PDE constraint number.
virtual bool eval_grad_f(Index n, const Number *x, bool new_x, Number *grad_f)
Method to return the gradient of the objective.
Index N_
Number of mesh points in one dimension (excluding boundary)
Number * y_d_
Array for the target profile for y.
void SetBaseParameters(Index N, Number alpha, Number lb_y, Number ub_y, Number lb_u, Number ub_u, Number d_const)
Method for setting the internal parameters that define the problem.
virtual bool eval_jac_g(Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values)
Method to return: 1) The structure of the jacobian (if "values" is NULL) 2) The values of the jacobia...
Number ub_u_
overall upper bound on u
Index y_index(Index i, Index j) const
Translation of mesh point indices to NLP variable indices for y(x_ij)
virtual void finalize_solution(SolverReturn status, Index n, const Number *x, const Number *z_L, const Number *z_U, Index m, const Number *g, const Number *lambda, Number obj_valu, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
This method is called after the optimization, and could write an output file with the optimal profile...
Number ub_y_
overall upper bound on y
virtual ~MittelmannBndryCntrlDiriBase()
Default destructor.
Number lb_y_
overall lower bound on y
MittelmannBndryCntrlDiriBase(const MittelmannBndryCntrlDiriBase &)
MittelmannBndryCntrlDiriBase & operator=(const MittelmannBndryCntrlDiriBase &)
MittelmannBndryCntrlDiriBase()
Constructor.
Number alpha_
Weighting parameter for the control target deviation functional in the objective.
Number d_const_
Constant value of d appearing in elliptical equation.
virtual bool get_starting_point(Index n, bool init_x, Number *x, bool init_z, Number *z_L, Number *z_U, Index m, bool init_lambda, Number *lambda)
Method to return the starting point for the algorithm.
virtual bool get_nlp_info(Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, IndexStyleEnum &index_style)
Method to return some info about the nlp.
virtual bool eval_f(Index n, const Number *x, bool new_x, Number &obj_value)
Method to return the objective value.
Number lb_u_
overall lower bound on u
virtual bool eval_g(Index n, const Number *x, bool new_x, Index m, Number *g)
Method to return the constraint residuals.
virtual bool eval_h(Index n, const Number *x, bool new_x, Number obj_factor, Index m, const Number *lambda, bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values)
Method to return: 1) The structure of the hessian of the lagrangian (if "values" is NULL) 2) The valu...
Class implemented the NLP discretization of.
SolverReturn
enum for the return from the optimize algorithm (obviously we need to add more)
int Index
Type of all indices of vectors, matrices etc.
double Number
Type of all numbers.