# source:branches/dev/Examples/ScalableProblems/LuksanVlcek3.hpp@582

Last change on this file since 582 was 582, checked in by andreasw, 8 years ago
• added parabolic examples
• made registered NLPs work by brute force inclusion
• Property svn:eol-style set to `native`
• Property svn:keywords set to `"Author Date Id Revision"`
File size: 4.3 KB
Line
1// Copyright (C) 2005 International Business Machines and others.
2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// \$Id\$
6//
7// Authors:  Andreas Waechter              IBM    2005-10-127
8
9#ifndef __LUKSANVLCEK3_HPP__
10#define __LUKSANVLCEK3_HPP__
11
12#include "RegisteredTNLP.hpp"
13
14using namespace Ipopt;
15
16/** Implementation of Example 5.3 from "Sparse and Parially Separable
17 *  Test Problems for Unconstrained and Equality Constrained
18 *  Optimization" by L. Luksan and J. Vlcek. */
19class LuksanVlcek3 : public RegisteredTNLP
20{
21public:
22  /** Constructor.  Here, g_l and g_u are the bounds for the
23   *  constraints.  The original formulation is obtained by setting
24   *  g_l and g_u to zero.  Using g_l<g_u allows the obtain a problem
25   *  formulation with inequality constraints. */
26  LuksanVlcek3(Number g_l, Number g_u);
27
28  /** Default destructor */
29  virtual ~LuksanVlcek3() {};
30
31  /** Overloaded from RegisteredTNLP. */
32  virtual bool InitializeProblem(Index N);
33
34  /**@name Overloaded from TNLP */
35  //@{
36  /** Method to return some info about the nlp */
37  virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
38                            Index& nnz_h_lag, IndexStyleEnum& index_style);
39
40  /** Method to return the bounds for my problem */
41  virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
42                               Index m, Number* g_l, Number* g_u);
43
44  /** Method to return the starting point for the algorithm */
45  virtual bool get_starting_point(Index n, bool init_x, Number* x,
46                                  bool init_z, Number* z_L, Number* z_U,
47                                  Index m, bool init_lambda,
48                                  Number* lambda);
49
50  /** Method to return the objective value */
51  virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
52
53  /** Method to return the gradient of the objective */
54  virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
55
56  /** Method to return the constraint residuals */
57  virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
58
59  /** Method to return:
60   *   1) The structure of the jacobian (if "values" is NULL)
61   *   2) The values of the jacobian (if "values" is not NULL)
62   */
63  virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
64                          Index m, Index nele_jac, Index* iRow, Index *jCol,
65                          Number* values);
66
67  /** Method to return:
68   *   1) The structure of the hessian of the lagrangian (if "values" is NULL)
69   *   2) The values of the hessian of the lagrangian (if "values" is not NULL)
70   */
71  virtual bool eval_h(Index n, const Number* x, bool new_x,
72                      Number obj_factor, Index m, const Number* lambda,
73                      bool new_lambda, Index nele_hess, Index* iRow,
74                      Index* jCol, Number* values);
75
76  //@}
77
78  /** Method for returning scaling parameters */
79  /*
80  virtual void get_scaling_parameters(Number& obj_scaling,
81                                      bool& use_x_scaling, Index n, Number* x_scaling,
82                                      bool& use_g_scaling, Index m, Number* g_scaling);
83  */
84
85  /** @name Solution Methods */
86  //@{
87  /** This method is called when the algorithm is complete so the TNLP can store/write the solution */
88  virtual void finalize_solution(SolverReturn status,
89                                 Index n, const Number* x, const Number* z_L, const Number* z_U,
90                                 Index m, const Number* g, const Number* lambda,
91                                 Number obj_value);
92  //@}
93
94private:
95  /**@name Methods to block default compiler methods.
96   * The compiler automatically generates the following three methods.
97   *  Since the default compiler implementation is generally not what
98   *  you want (for all but the most simple classes), we usually
99   *  put the declarations of these methods in the private section
100   *  and never implement them. This prevents the compiler from
101   *  implementing an incorrect "default" behavior without us
102   *  knowing. (See Scott Meyers book, "Effective C++")
103   *
104   */
105  //@{
106  LuksanVlcek3();
107  LuksanVlcek3(const LuksanVlcek3&);
108  LuksanVlcek3& operator=(const LuksanVlcek3&);
109  //@}
110
111  /** Parameter determining problem size */
112  Index N_;
113
114  /** General lower bound for all constraints */
115  Number g_l_;
116  /** General upper bound for all constraints */
117  Number g_u_;
118};
119
120#endif
Note: See TracBrowser for help on using the repository browser.