Ipopt Documentation  
 
Loading...
Searching...
No Matches
SensAmplTNLP.hpp
Go to the documentation of this file.
1// Copyright 2009 Hans Pirnay
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Date : 2009-05-11
6
7#ifndef __SENSAMPLTNLP_HPP__
8#define __SENSAMPLTNLP_HPP__
9
10#include "AmplTNLP.hpp"
11#include "SensUtils.hpp"
12
13namespace Ipopt
14{
15// same as DECLARE_STD_EXCEPTION, but not using any export
17{
18public:
20 std::string msg,
21 std::string fname,
22 Ipopt::Index line
23 )
24 : Ipopt::IpoptException(msg, fname, line, "SUFFIX_EMPTY")
25 { }
26
28 const SUFFIX_EMPTY& copy
29 )
30 : Ipopt::IpoptException(copy)
31 { }
32
33private:
36 const SUFFIX_EMPTY&
37 );
38};
39
41{
45public:
48 const SmartPtr<const Journalist>& jnlst,
49 const SmartPtr<RegisteredOptions> regoptions,
50 const SmartPtr<OptionsList> options,
51 char**& argv,
52 SmartPtr<AmplSuffixHandler> suffix_handler = NULL,
53 bool allow_discrete = false,
54 SmartPtr<AmplOptionsList> ampl_options_list = NULL,
55 const char* ampl_option_string = NULL,
56 const char* ampl_invokation_string = NULL,
57 const char* ampl_banner_string = NULL,
58 std::string* nl_file_content = NULL
59 );
60
61 virtual ~SensAmplTNLP();
62
64 virtual bool get_bounds_info(
65 Index n,
66 Number* x_l,
67 Number* x_u,
68 Index m,
69 Number* g_l,
70 Number* g_u
71 );
72
74 Index idx,
76 );
77
78 virtual void finalize_metadata(
79 Index n,
80 const StringMetaDataMapType& var_string_md,
81 const IntegerMetaDataMapType& var_integer_md,
82 const NumericMetaDataMapType& var_numeric_md,
83 Index m,
84 const StringMetaDataMapType& con_string_md,
85 const IntegerMetaDataMapType& con_integer_md,
86 const NumericMetaDataMapType& con_numeric_md
87 );
88
89 virtual void finalize_solution(
90 SolverReturn status,
91 Index n,
92 const Number* x,
93 const Number* z_L,
94 const Number* z_U,
95 Index m,
96 const Number* g,
97 const Number* lambda,
98 Number obj_value,
99 const IpoptData* ip_data,
101 );
102
104 const char* suffix_name
105 );
106
107 std::vector<int> get_index_suffix_vec(
108 const char* suffix_name
109 );
110
112 const char* suffix_name
113 );
114
115 std::vector<Number> get_number_suffix_vec(
116 const char* suffix_name
117 );
118
120 const char* suffix_name
121 );
122
124 const char* suffix_name
125 );
126
128 const char* suffix_name
129 );
130
132 Index n,
133 StringMetaDataMapType& var_string_md,
134 IntegerMetaDataMapType& var_integer_md,
135 NumericMetaDataMapType& var_numeric_md,
136 Index m,
137 StringMetaDataMapType& con_string_md,
138 IntegerMetaDataMapType& con_integer_md,
139 NumericMetaDataMapType& con_numeric_md
140 );
141
142private:
143
145 // Number* x_L;
146 // Number* x_U;
149
151
154
159
160 std::vector<SmartPtr<IteratesVector> > sens_sol_;
161};
162
163}
164
165#endif
Ampl Interface, implemented as a TNLP.
Definition AmplTNLP.hpp:317
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
This is the base class for all exceptions.
SUFFIX_EMPTY(std::string msg, std::string fname, Ipopt::Index line)
SUFFIX_EMPTY(const SUFFIX_EMPTY &copy)
void operator=(const SUFFIX_EMPTY &)
void set_sens_solution(Index idx, SmartPtr< IteratesVector > sens_sol)
SmartPtr< const Journalist > jnlst_
local copy of current lower and upper bounds - needed for parameter change
SensAmplTNLP(const SmartPtr< const Journalist > &jnlst, const SmartPtr< RegisteredOptions > regoptions, const SmartPtr< OptionsList > options, char **&argv, SmartPtr< AmplSuffixHandler > suffix_handler=NULL, bool allow_discrete=false, SmartPtr< AmplOptionsList > ampl_options_list=NULL, const char *ampl_option_string=NULL, const char *ampl_invokation_string=NULL, const char *ampl_banner_string=NULL, std::string *nl_file_content=NULL)
This class is the Sens-wrapper for the ampltnlp, adapts the get bounds function and some others to ou...
std::vector< int > get_index_suffix_vec(const char *suffix_name)
virtual void finalize_metadata(Index n, const StringMetaDataMapType &var_string_md, const IntegerMetaDataMapType &var_integer_md, const NumericMetaDataMapType &var_numeric_md, Index m, const StringMetaDataMapType &con_string_md, const IntegerMetaDataMapType &con_integer_md, const NumericMetaDataMapType &con_numeric_md)
This method returns any metadata collected during the run of the algorithm.
std::vector< Number > get_number_suffix_vec(const char *suffix_name)
virtual ~SensAmplTNLP()
const int * get_index_suffix(const char *suffix_name)
virtual void finalize_solution(SolverReturn status, Index n, const Number *x, const Number *z_L, const Number *z_U, Index m, const Number *g, const Number *lambda, Number obj_value, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
This method is called when the algorithm has finished (successfully or not) so the TNLP can digest th...
Index n_sens_steps_
important Options
std::vector< int > get_index_suffix_constr_vec(const char *suffix_name)
virtual bool get_var_con_metadata(Index n, StringMetaDataMapType &var_string_md, IntegerMetaDataMapType &var_integer_md, NumericMetaDataMapType &var_numeric_md, Index m, StringMetaDataMapType &con_string_md, IntegerMetaDataMapType &con_integer_md, NumericMetaDataMapType &con_numeric_md)
Method to request meta data for the variables and the constraints.
const Number * get_number_suffix_constr(const char *suffix_name)
virtual bool get_bounds_info(Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u)
returns bounds of the nlp.
const Number * get_number_suffix(const char *suffix_name)
std::vector< SmartPtr< IteratesVector > > sens_sol_
SmartPtr< OptionsList > options_
const int * get_index_suffix_constr(const char *suffix_name)
Template class for Smart Pointers.
std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
Definition IpTNLP.hpp:71
std::map< std::string, std::vector< Number > > NumericMetaDataMapType
Definition IpTNLP.hpp:72
std::map< std::string, std::vector< std::string > > StringMetaDataMapType
Definition IpTNLP.hpp:70
This file contains a base class for all exceptions and a set of macros to help with exceptions.
SolverReturn
enum for the return from the optimize algorithm
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17