Ipopt  3.12.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RegisteredTNLP.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, 2006 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: RegisteredTNLP.hpp 1861 2010-12-21 21:34:47Z andreasw $
6 //
7 // Authors: Andreas Waechter IBM 2005-10-20
8 
9 #ifndef __REGISTEREDTNLPS_HPP__
10 #define __REGISTEREDTNLPS_HPP__
11 
12 #include "IpTNLP.hpp"
13 #include <map>
14 
15 using namespace Ipopt;
16 
20 class RegisteredTNLP : public TNLP
21 {
22 public:
26  virtual bool InitializeProblem(Index N) = 0;
27 };
28 
30 {
31 public:
32  RegisteredTNLPs(const SmartPtr<RegisteredTNLP>& tnlp, const std::string name)
33  {
34  RegisterTNLP(tnlp, name);
35  }
36  virtual ~RegisteredTNLPs()
37  {}
38  static SmartPtr<RegisteredTNLP> GetTNLP(const std::string name);
39  static void PrintRegisteredProblems();
40 private:
41  void RegisterTNLP(const SmartPtr<RegisteredTNLP>& tnlp,
42  const std::string name);
44 };
45 
46 #define REGISTER_TNLP(class_constructor, name) \
47 class RegisteredTNLP_Setup_ ## name : public RegisteredTNLPs \
48 { \
49 public: \
50  RegisteredTNLP_Setup_ ## name() \
51  : \
52  RegisteredTNLPs(new class_constructor, #name) \
53  { } \
54  RegisteredTNLP_Setup_ ## name* KeepCompilerFromRemovingThis(); \
55 }; \
56  \
57 RegisteredTNLP_Setup_ ## name RegisteredTNLP_Setup_ ## name ## instance_; \
58 RegisteredTNLP_Setup_ ## name* \
59 RegisteredTNLP_Setup_ ## name::KeepCompilerFromRemovingThis() \
60 { return &RegisteredTNLP_Setup_ ## name ## instance_; }
61 
62 
63 //static RegisteredTNLP_Setup_ ## name RegisteredTNLP_Setup_ ## name ## instance
64 #endif
RegisteredTNLPs(const SmartPtr< RegisteredTNLP > &tnlp, const std::string name)
SmartPtr< RegisteredTNLP > tnlp_
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Class implemented the NLP discretization of.
virtual ~RegisteredTNLPs()
Base class for all NLP&#39;s that use standard triplet matrix form and dense vectors. ...
Definition: IpTNLP.hpp:50