10 #ifndef __MITTELMANNDISTRCNTRLDIRI_HPP__
11 #define __MITTELMANNDISTRCNTRLDIRI_HPP__
19 #include "configall_system.h"
28 # error "don't have header file for math"
38 # error "don't have header file for stdio"
42 using namespace Ipopt;
71 virtual bool get_starting_point(
Index n,
bool init_x,
Number*
x,
73 Index m,
bool init_lambda,
106 bool& use_x_scaling,
Index n,
108 bool& use_g_scaling,
Index m,
198 return (N_+2)*(N_+2) + (j-1) + (N_)*(i-1);
204 return (j-1) + N_*(i-1);
232 printf(
"N has to be at least 1.");
240 Number u_init = (ub_u+lb_u)/2.;
242 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, u_init);
249 return 1. + 2.*(x1*(x1-1.)+x2*(x2-1.));
254 return pow(y,3) - y - u;
290 printf(
"N has to be at least 1.");
298 Number u_init = (ub_u+lb_u)/2.;
300 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, u_init);
307 return 1. + 2.*(x1*(x1-1.)+x2*(x2-1.));
312 return pow(y,3) - y - u;
350 printf(
"N has to be at least 1.");
358 Number u_init = (ub_u+lb_u)/2.;
360 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, u_init);
367 return sin(2.*pi_*x1)*sin(2.*pi_*x2);
411 printf(
"N has to be at least 1.");
419 Number u_init = (ub_u+lb_u)/2.;
421 SetBaseParameters(N, alpha, lb_y, ub_y, lb_u, ub_u, u_init);
428 return sin(2.*pi_*x1)*sin(2.*pi_*x2);
const Number pi_
Value of pi (made available for convenience)
Number * x
Input: Starting point Output: Optimal solution.
virtual Number d_cont_dy(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
Class for all IPOPT specific calculated quantities.
Number Number Index Number Number Index Index Index index_style
indexing style for iRow & jCol, 0 for C style, 1 for Fortran style
Number u_init_
Initial value for the constrols u.
Base class for distributed control problems with Dirichlet boundary conditions, as formulated by Hans...
Number Number Index m
Number of constraints.
MittelmannDistCntrlDiri3()
virtual Number d_cont_dy(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
Number Number * g
Values of constraint at final point (output only - ignored if set to NULL)
virtual Number d_cont_du(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB Eval_Jac_G_CB Eval_H_CB eval_h
Callback function for evaluating Hessian of Lagrangian function.
Class implementating Example 2.
double Number
Type of all numbers.
virtual Number d_cont(Number x1, Number x2, Number y, Number u) const
Forcing function for the elliptic equation.
virtual ~MittelmannDistCntrlDiri3a()
Class implementating Example 3.
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB eval_grad_f
Callback function for evaluating gradient of objective function.
virtual Number d_cont_dy(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
virtual Number d_cont_dydy(Number x1, Number x2, Number y, Number u) const
Second partial derivative of forcing function w.r.t y,y.
virtual ~MittelmannDistCntrlDiri2()
virtual Number d_cont_du(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
Number x1_grid(Index i) const
Compute the grid coordinate for given index in x1 direction.
virtual Number d_cont_dy(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
MittelmannDistCntrlDiri2()
Index u_index(Index i, Index j) const
Translation of mesh point indices to NLP variable indices for u(x_ij)
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB Eval_Jac_G_CB eval_jac_g
Callback function for evaluating Jacobian of constraint functions.
Class implementating Example 1.
SolverReturn
enum for the return from the optimize algorithm (obviously we need to add more)
Number lb_u_
overall lower bound on u
Number Number Index Number Number Index nele_jac
Number of non-zero elements in constraint Jacobian.
Index y_index(Index i, Index j) const
Translation of mesh point indices to NLP variable indices for y(x_ij)
MittelmannDistCntrlDiri3a()
Number x2_grid(Index i) const
Compute the grid coordinate for given index in x2 direction.
virtual ~MittelmannDistCntrlDiri1()
Number alpha_
Weighting parameter for the control target deviation functional in the objective. ...
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
virtual Number d_cont_dydy(Number x1, Number x2, Number y, Number u) const
Second partial derivative of forcing function w.r.t y,y.
virtual Number d_cont_dydy(Number x1, Number x2, Number y, Number u) const
Second partial derivative of forcing function w.r.t y,y.
Class to organize all the data required by the algorithm.
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB eval_g
Callback function for evaluating constraint functions.
int Index
Type of all indices of vectors, matrices etc.
virtual ~MittelmannDistCntrlDiri3()
virtual Number d_cont(Number x1, Number x2, Number y, Number u) const
Forcing function for the elliptic equation.
Number Number * x_scaling
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
Number Number Index Number Number Index Index nele_hess
Number of non-zero elements in Hessian of Lagrangian.
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
Class implemented the NLP discretization of.
virtual Number d_cont_dydy(Number x1, Number x2, Number y, Number u) const
Second partial derivative of forcing function w.r.t y,y.
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
virtual Number d_cont(Number x1, Number x2, Number y, Number u) const
Forcing function for the elliptic equation.
virtual Number d_cont(Number x1, Number x2, Number y, Number u) const
Forcing function for the elliptic equation.
virtual Number d_cont_du(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
Number Number Number * g_scaling
virtual Number y_d_cont(Number x1, Number x2) const
Target profile function for y.
Number ub_u_
overall upper bound on u
virtual Number d_cont_du(Number x1, Number x2, Number y, Number u) const
First partial derivative of forcing function w.r.t.
IndexStyleEnum
overload this method to return the number of variables and constraints, and the number of non-zeros i...
Number * y_d_
Array for the target profile for y.
MittelmannDistCntrlDiri1()
Number ub_y_
overall upper bound on y
virtual bool InitializeProblem(Index N)
Initialize internal parameters, where N is a parameter determining the problme size.
Index N_
Number of mesh points in one dimension (excluding boundary)
Number Number Index Number Number Index Index Index Eval_F_CB eval_f
Callback function for evaluating objective function.
Number lb_y_
overall lower bound on y
const Number pi_
Value of pi (made available for convenience)
Index pde_index(Index i, Index j) const
Translation of interior mesh point indices to the corresponding PDE constraint number.