Ipopt 3.11.9
Loading...
Searching...
No Matches
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
15using namespace Ipopt;
16
20class RegisteredTNLP : public TNLP
21{
22public:
26 virtual bool InitializeProblem(Index N) = 0;
27};
28
30{
31public:
32 RegisteredTNLPs(const SmartPtr<RegisteredTNLP>& tnlp, const std::string name)
33 {
34 RegisterTNLP(tnlp, name);
35 }
37 {}
38 static SmartPtr<RegisteredTNLP> GetTNLP(const std::string name);
40private:
42 const std::string name);
44};
45
46#define REGISTER_TNLP(class_constructor, name) \
47class RegisteredTNLP_Setup_ ## name : public RegisteredTNLPs \
48{ \
49public: \
50 RegisteredTNLP_Setup_ ## name() \
51 : \
52 RegisteredTNLPs(new class_constructor, #name) \
53 { } \
54 RegisteredTNLP_Setup_ ## name* KeepCompilerFromRemovingThis(); \
55}; \
56 \
57RegisteredTNLP_Setup_ ## name RegisteredTNLP_Setup_ ## name ## instance_; \
58RegisteredTNLP_Setup_ ## name* \
59RegisteredTNLP_Setup_ ## name::KeepCompilerFromRemovingThis() \
60{ return &RegisteredTNLP_Setup_ ## name ## instance_; }
61
62
63//static RegisteredTNLP_Setup_ ## name RegisteredTNLP_Setup_ ## name ## instance
64#endif
Template class for Smart Pointers.
Base class for all NLP's that use standard triplet matrix form and dense vectors.
Definition IpTNLP.hpp:51
Class implemented the NLP discretization of.
virtual bool InitializeProblem(Index N)=0
Initialize internal parameters, where N is a parameter determining the problme size.
static void PrintRegisteredProblems()
static SmartPtr< RegisteredTNLP > GetTNLP(const std::string name)
SmartPtr< RegisteredTNLP > tnlp_
void RegisterTNLP(const SmartPtr< RegisteredTNLP > &tnlp, const std::string name)
virtual ~RegisteredTNLPs()
RegisteredTNLPs(const SmartPtr< RegisteredTNLP > &tnlp, const std::string name)
int Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:19