Ipopt  3.12.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
Ipopt::SensAmplTNLP Class Reference

#include <SensAmplTNLP.hpp>

+ Inheritance diagram for Ipopt::SensAmplTNLP:

Public Member Functions

 SensAmplTNLP (const SmartPtr< const Journalist > &jnlst, 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 our needs. More...
 
virtual ~SensAmplTNLP ()
 
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. More...
 
void set_sens_solution (Index idx, SmartPtr< IteratesVector > sens_sol)
 
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 is called just before finalize_solution. More...
 
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 is complete so the TNLP can store/write the solution. More...
 
const Indexget_index_suffix (const char *suffix_name)
 
std::vector< Indexget_index_suffix_vec (const char *suffix_name)
 
const Numberget_number_suffix (const char *suffix_name)
 
std::vector< Numberget_number_suffix_vec (const char *suffix_name)
 
const Indexget_index_suffix_constr (const char *suffix_name)
 
std::vector< Indexget_index_suffix_constr_vec (const char *suffix_name)
 
const Numberget_number_suffix_constr (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)
 returns names and other meta data for the variables and constraints Overloaded from TNLP More...
 
- Public Member Functions inherited from Ipopt::AmplTNLP
 DECLARE_STD_EXCEPTION (NONPOSITIVE_SCALING_FACTOR)
 Exceptions. More...
 
void set_active_objective (Index obj_no)
 A method for setting the index of the objective function to be considered. More...
 
SmartPtr< AmplSuffixHandlerget_suffix_handler ()
 Method for returning the suffix handler. More...
 
 AmplTNLP (const SmartPtr< const Journalist > &jnlst, 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)
 Constructor. More...
 
virtual ~AmplTNLP ()
 Default destructor. More...
 
virtual bool get_nlp_info (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, IndexStyleEnum &index_style)
 returns dimensions of the nlp. More...
 
virtual bool get_constraints_linearity (Index m, LinearityType *const_types)
 Returns the constraint linearity. More...
 
virtual bool get_starting_point (Index n, bool init_x, Number *x, bool init_z, Number *z_L, Number *z_U, Index m, bool init_lambda, Number *lambda)
 provides a starting point for the nlp variables. More...
 
virtual bool eval_f (Index n, const Number *x, bool new_x, Number &obj_value)
 evaluates the objective value for the nlp. More...
 
virtual bool eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f)
 
evaluates the gradient of the objective for the

nlp. More...

 
virtual bool eval_g (Index n, const Number *x, bool new_x, Index m, Number *g)
 evaluates the constraint residuals for the nlp. More...
 
virtual bool eval_jac_g (Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values)
 specifies the jacobian structure (if values is NULL) and evaluates the jacobian values (if values is not NULL) for the nlp. More...
 
virtual bool eval_h (Index n, const Number *x, bool new_x, Number obj_factor, Index m, const Number *lambda, bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values)
 specifies the structure of the hessian of the lagrangian (if values is NULL) and evaluates the values (if values is not NULL). More...
 
virtual bool get_scaling_parameters (Number &obj_scaling, bool &use_x_scaling, Index n, Number *x_scaling, bool &use_g_scaling, Index m, Number *g_scaling)
 retrieve the scaling parameters for the variables, objective function, and constraints. More...
 
virtual Index get_number_of_nonlinear_variables ()
 
virtual bool get_list_of_nonlinear_variables (Index num_nonlin_vars, Index *pos_nonlin_vars)
 
ASL_pfgh * AmplSolverObject ()
 Return the ampl solver object (ASL*) More...
 
void write_solution_file (const std::string &message) const
 Write the solution file. More...
 
void get_discrete_info (Index &nlvb_, Index &nlvbi_, Index &nlvc_, Index &nlvci_, Index &nlvo_, Index &nlvoi_, Index &nbv_, Index &niv_) const
 ampl orders the variables like (continuous, binary, integer). More...
 
void set_string_metadata_for_var (std::string tag, std::vector< std::string > meta_data)
 
void set_integer_metadata_for_var (std::string tag, std::vector< Index > meta_data)
 
void set_numeric_metadata_for_var (std::string tag, std::vector< Number > meta_data)
 
void set_string_metadata_for_con (std::string tag, std::vector< std::string > meta_data)
 
void set_integer_metadata_for_con (std::string tag, std::vector< Index > meta_data)
 
void set_numeric_metadata_for_con (std::string tag, std::vector< Number > meta_data)
 
- Public Member Functions inherited from Ipopt::TNLP
 DECLARE_STD_EXCEPTION (INVALID_TNLP)
 
 TNLP ()
 
virtual ~TNLP ()
 Default destructor. More...
 
virtual bool intermediate_callback (AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
 Intermediate Callback method for the user. More...
 
virtual bool get_variables_linearity (Index n, LinearityType *var_types)
 overload this method to return the variables linearity (TNLP::LINEAR or TNLP::NON_LINEAR). More...
 
virtual bool get_warm_start_iterate (IteratesVector &warm_start_iterate)
 overload this method to provide an Ipopt iterate (already in the form Ipopt requires it internally) for a warm start. More...
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 

Private Attributes

SmartPtr< const Journalistjnlst_
 local copy of current lower and upper bounds - needed for parameter change More...
 
SmartPtr< OptionsListoptions_
 
bool have_parameters_
 
Indexparameter_flags_
 
Numberparameter_values_
 
Index n_sens_steps_
 important Options More...
 
bool run_sens_
 
bool compute_red_hessian_
 
std::vector< SmartPtr
< IteratesVector > > 
sens_sol_
 

Additional Inherited Members

- Public Types inherited from Ipopt::TNLP
enum  LinearityType { LINEAR, NON_LINEAR }
 Type of the constraints. More...
 
enum  IndexStyleEnum { C_STYLE =0, FORTRAN_STYLE =1 }
 overload this method to return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian. More...
 
typedef std::map< std::string,
std::vector< std::string > > 
StringMetaDataMapType
 
typedef std::map< std::string,
std::vector< Index > > 
IntegerMetaDataMapType
 
typedef std::map< std::string,
std::vector< Number > > 
NumericMetaDataMapType
 

Detailed Description

Definition at line 17 of file SensAmplTNLP.hpp.

Constructor & Destructor Documentation

Ipopt::SensAmplTNLP::SensAmplTNLP ( const SmartPtr< const Journalist > &  jnlst,
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 our needs.

constructor

virtual Ipopt::SensAmplTNLP::~SensAmplTNLP ( )
virtual

Member Function Documentation

virtual bool Ipopt::SensAmplTNLP::get_bounds_info ( Index  n,
Number x_l,
Number x_u,
Index  m,
Number g_l,
Number g_u 
)
virtual

returns bounds of the nlp.

Overloaded from AmplTNLP

Reimplemented from Ipopt::AmplTNLP.

void Ipopt::SensAmplTNLP::set_sens_solution ( Index  idx,
SmartPtr< IteratesVector sens_sol 
)
virtual void Ipopt::SensAmplTNLP::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 
)
virtual

This method is called just before finalize_solution.

With this method, the algorithm returns any metadata collected during its run, including the metadata provided by the user with the above get_var_con_metadata. Each metadata can be of type string, integer, and numeric. It can be associated to either the variables or the constraints. The metadata that was associated with the primal variable vector is stored in var_..._md. The metadata associated with the constraint multipliers is stored in con_..._md. The metadata associated with the bound multipliers is stored in var_..._md, with the suffixes "_z_L", and "_z_U", denoting lower and upper bounds.

Reimplemented from Ipopt::TNLP.

virtual void Ipopt::SensAmplTNLP::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 
)
virtual

This method is called when the algorithm is complete so the TNLP can store/write the solution.

Reimplemented from Ipopt::AmplTNLP.

const Index* Ipopt::SensAmplTNLP::get_index_suffix ( const char *  suffix_name)
std::vector<Index> Ipopt::SensAmplTNLP::get_index_suffix_vec ( const char *  suffix_name)
const Number* Ipopt::SensAmplTNLP::get_number_suffix ( const char *  suffix_name)
std::vector<Number> Ipopt::SensAmplTNLP::get_number_suffix_vec ( const char *  suffix_name)
const Index* Ipopt::SensAmplTNLP::get_index_suffix_constr ( const char *  suffix_name)
std::vector<Index> Ipopt::SensAmplTNLP::get_index_suffix_constr_vec ( const char *  suffix_name)
const Number* Ipopt::SensAmplTNLP::get_number_suffix_constr ( const char *  suffix_name)
virtual bool Ipopt::SensAmplTNLP::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 
)
virtual

returns names and other meta data for the variables and constraints Overloaded from TNLP

Reimplemented from Ipopt::AmplTNLP.

Member Data Documentation

SmartPtr<const Journalist> Ipopt::SensAmplTNLP::jnlst_
private

local copy of current lower and upper bounds - needed for parameter change

Definition at line 88 of file SensAmplTNLP.hpp.

SmartPtr<OptionsList> Ipopt::SensAmplTNLP::options_
private

Definition at line 89 of file SensAmplTNLP.hpp.

bool Ipopt::SensAmplTNLP::have_parameters_
private

Definition at line 91 of file SensAmplTNLP.hpp.

Index* Ipopt::SensAmplTNLP::parameter_flags_
private

Definition at line 93 of file SensAmplTNLP.hpp.

Number* Ipopt::SensAmplTNLP::parameter_values_
private

Definition at line 94 of file SensAmplTNLP.hpp.

Index Ipopt::SensAmplTNLP::n_sens_steps_
private

important Options

Definition at line 97 of file SensAmplTNLP.hpp.

bool Ipopt::SensAmplTNLP::run_sens_
private

Definition at line 98 of file SensAmplTNLP.hpp.

bool Ipopt::SensAmplTNLP::compute_red_hessian_
private

Definition at line 99 of file SensAmplTNLP.hpp.

std::vector< SmartPtr<IteratesVector> > Ipopt::SensAmplTNLP::sens_sol_
private

Definition at line 101 of file SensAmplTNLP.hpp.


The documentation for this class was generated from the following file: