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 bool checkinterrupt = false
60 );
61
62 virtual ~SensAmplTNLP();
63
65 virtual bool get_bounds_info(
66 Index n,
67 Number* x_l,
68 Number* x_u,
69 Index m,
70 Number* g_l,
71 Number* g_u
72 );
73
75 Index idx,
77 );
78
79 virtual void finalize_metadata(
80 Index n,
81 const StringMetaDataMapType& var_string_md,
82 const IntegerMetaDataMapType& var_integer_md,
83 const NumericMetaDataMapType& var_numeric_md,
84 Index m,
85 const StringMetaDataMapType& con_string_md,
86 const IntegerMetaDataMapType& con_integer_md,
87 const NumericMetaDataMapType& con_numeric_md
88 );
89
90 virtual void finalize_solution(
91 SolverReturn status,
92 Index n,
93 const Number* x,
94 const Number* z_L,
95 const Number* z_U,
96 Index m,
97 const Number* g,
98 const Number* lambda,
99 Number obj_value,
100 const IpoptData* ip_data,
102 );
103
105 const char* suffix_name
106 );
107
108 std::vector<int> get_index_suffix_vec(
109 const char* suffix_name
110 );
111
113 const char* suffix_name
114 );
115
116 std::vector<Number> get_number_suffix_vec(
117 const char* suffix_name
118 );
119
121 const char* suffix_name
122 );
123
125 const char* suffix_name
126 );
127
129 const char* suffix_name
130 );
131
133 Index n,
134 StringMetaDataMapType& var_string_md,
135 IntegerMetaDataMapType& var_integer_md,
136 NumericMetaDataMapType& var_numeric_md,
137 Index m,
138 StringMetaDataMapType& con_string_md,
139 IntegerMetaDataMapType& con_integer_md,
140 NumericMetaDataMapType& con_numeric_md
141 );
142
143private:
144
146 // Number* x_L;
147 // Number* x_U;
150
152
155
160
161 std::vector<SmartPtr<IteratesVector> > sens_sol_;
162};
163
164}
165
166#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
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)
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, bool checkinterrupt=false)
This class is the Sens-wrapper for the ampltnlp, adapts the get bounds function and some others to ou...
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