Ipopt
3.11.4
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
examples
ScalableProblems
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
29
class
RegisteredTNLPs
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);
43
SmartPtr<RegisteredTNLP>
tnlp_
;
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
Generated on Mon Oct 21 2013 19:08:14 for Ipopt by
1.8.4