7 #ifndef __IPAMPLTNLP_HPP__ 8 #define __IPAMPLTNLP_HPP__ 48 const std::string& suffix_string,
53 suffix_ids_.push_back(suffix_string);
54 suffix_types_.push_back(type);
55 suffix_sources_.push_back(source);
59 const int* GetIntegerSuffixValues(
60 const std::string& suffix_string,
64 const Number* GetNumberSuffixValues(
65 const std::string& suffix_string,
69 std::vector<int> GetIntegerSuffixValues(
71 const std::string& suffix_string,
75 std::vector<Number> GetNumberSuffixValues(
77 const std::string& suffix_string,
114 void PrepareAmplForSuffixes(
143 const std::string& ipopt_option_name,
145 const std::string& description);
149 delete[] description_;
154 return ipopt_option_name_;
196 const std::string& ipopt_name,
201 : ipopt_name_(ipopt_name),
242 const std::string& ampl_option_name,
243 const std::string& ipopt_option_name,
245 const std::string& description
249 ampl_options_map_[ampl_option_name] =
ConstPtr(new_option);
255 return (
Index) ampl_options_map_.size();
289 void MakeValidLatexString(
328 const char*
const* argv,
330 bool allow_discrete =
false,
332 const char* ampl_option_string = NULL,
333 const char* ampl_invokation_string = NULL,
334 const char* ampl_banner_string = NULL,
335 std::string* nl_file_content = NULL
348 bool allow_discrete =
false,
350 const char* ampl_option_string = NULL,
351 const char* ampl_invokation_string = NULL,
352 const char* ampl_banner_string = NULL,
353 std::string* nl_file_content = NULL
364 virtual bool get_nlp_info(
373 virtual bool get_var_con_metadata(
385 virtual bool get_bounds_info(
394 virtual bool get_constraints_linearity(
399 virtual bool get_starting_point(
418 virtual bool eval_grad_f(
433 virtual bool eval_jac_g(
458 virtual bool get_scaling_parameters(
470 virtual void finalize_solution(
487 virtual Index get_number_of_nonlinear_variables();
489 virtual bool get_list_of_nonlinear_variables(
490 Index num_nonlin_vars,
491 Index* pos_nonlin_vars
508 void write_solution_file(
509 const std::string& message
517 void get_discrete_info(
537 void set_active_objective(
545 void set_string_metadata_for_var(
547 const std::string& tag,
548 const std::vector<std::string>& meta_data
551 var_string_md_[tag] = meta_data;
555 const std::string& tag,
556 const std::vector<Index>& meta_data
559 var_integer_md_[tag] = meta_data;
563 const std::string& tag,
564 const std::vector<Number>& meta_data
567 var_numeric_md_[tag] = meta_data;
571 const std::string& tag,
572 const std::vector<std::string>& meta_data
575 con_string_md_[tag] = meta_data;
579 const std::string& tag,
580 const std::vector<Index>& meta_data
583 con_integer_md_[tag] = meta_data;
587 const std::string& tag,
588 const std::vector<Number>& meta_data
591 con_numeric_md_[tag] = meta_data;
598 return suffix_handler_;
626 void gutsOfConstructor(
629 const char*
const* argv,
630 bool allow_discrete ,
632 const char* ampl_option_string ,
633 const char* ampl_invokation_string ,
634 const char* ampl_banner_string ,
635 std::string* nl_file_content
691 bool internal_objval(
697 bool internal_conval(
721 const char* ampl_option_string,
722 const char* ampl_invokation_string,
723 const char* ampl_banner_string,
724 const char*
const* argv
736 const char* ampl_option_string,
737 const char* ampl_invokation_string,
738 const char* ampl_banner_string,
743 return get_options(NULL, options, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, argv);
const std::string ipopt_option_name_
std::map< std::string, std::vector< Number > > NumericMetaDataMapType
StringMetaDataMapType con_string_md_
SmartPtr< AmplSuffixHandler > get_suffix_handler()
Method for returning the suffix handler.
AmplOptionType Type() const
Class for all IPOPT specific calculated quantities.
const std::string & IpoptOptionName() const
void * nerror_
nerror flag passed to ampl calls - set to NULL to halt on error
this is for AMPL's internal wantsol callback
Index NumberOfAmplOptions()
Number of AMPL Options.
void * Oinfo_ptr_
Pointer to the Oinfo structure.
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
const std::string ipopt_name_
void set_numeric_metadata_for_con(const std::string &tag, const std::vector< Number > &meta_data)
bool set_active_objective_called_
whether set_active_objective has been called
ASL_pfgh * asl_
pointer to the main ASL structure
bool hesset_called_
whether we have called hesset
bool conval_called_with_current_x_
whether the constraint values have been calculated with the current x set to false in apply_new_x...
ipindex Index
Type of all indices of vectors, matrices etc.
IntegerMetaDataMapType con_integer_md_
LinearityType
Linearity-types of variables and constraints.
This file contains a base class for all exceptions and a set of macros to help with exceptions...
const SmartPtr< OptionsList > & Options() const
bool objval_called_with_current_x_
whether the objective value has been calculated with the current x
const std::string & IpoptName() const
Template class for Smart Pointers.
Storing the reference count of all the smart pointers that currently reference it.
Number obj_sign_
Sign of the objective fn (1 for min, -1 for max)
void set_string_metadata_for_con(const std::string &tag, const std::vector< std::string > &meta_data)
Ampl Option class containing name, type and description for an AMPL option.
const SmartPtr< const Journalist > jnlst_
SolverReturn
enum for the return from the optimize algorithm
Index nkeywds_
Number of entries stored in keywds_.
void AddAmplOption(const std::string &l_option_name, const std::string &ipopt_option_name, AmplOptionsList::AmplOptionType type, const std::string &description)
Adding a new AMPL Option.
ASL_pfgh * AmplSolverObject()
Return the ampl solver object (ASL*)
PrivatInfo(const std::string &ipopt_name, SmartPtr< OptionsList > options, SmartPtr< const Journalist > jnlst, void **nerror=NULL)
IntegerMetaDataMapType var_integer_md_
std::vector< std::string > suffix_ids_
std::vector< Suffix_Type > suffix_types_
Index nz_h_full_
number of nonzeros in the full_x Hessian
Class to organize all the data required by the algorithm.
ipnumber Number
Type of all numbers.
SmartPtr< const Journalist > jnlst_
Journalist.
void AddAvailableSuffix(const std::string &suffix_string, Suffix_Source source, Suffix_Type type)
char * Description() const
std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
void set_integer_metadata_for_con(const std::string &tag, const std::vector< Index > &meta_data)
std::map< std::string, std::vector< std::string > > StringMetaDataMapType
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Ampl Interface, implemented as a TNLP.
void set_integer_metadata_for_var(const std::string &tag, const std::vector< Index > &meta_data)
void * keywds_
pointer to the keywords
SmartPtr< AmplSuffixHandler > suffix_handler_
Suffix Handler.
void set_numeric_metadata_for_var(const std::string &tag, const std::vector< Number > &meta_data)
Class for storing a number of AMPL options that should be registered to the AMPL Solver library inter...
AmplOptionsList()
Default Constructor.
NumericMetaDataMapType con_numeric_md_
std::vector< Suffix_Source > suffix_sources_
const SmartPtr< const Journalist > & Jnlst() const
Base class for all NLP's that use standard triplet matrix form and dense vectors. ...
const AmplOptionType type_
IPOPT_DEPRECATED char * get_options(const SmartPtr< OptionsList > &options, SmartPtr< AmplOptionsList > &l_options_list, const char *ampl_option_string, const char *ampl_invokation_string, const char *ampl_banner_string, char **&argv)
Method for obtaining the name of the NL file and the options set from AMPL.
#define IPOPT_DEPRECATED
macro to declare symbols as deprecated
NumericMetaDataMapType var_numeric_md_
const SmartPtr< OptionsList > options_
#define IPOPTAMPLINTERFACELIB_EXPORT
StringMetaDataMapType var_string_md_
meta data to pass on to TNLP
std::map< std::string, SmartPtr< const AmplOption > > ampl_options_map_
map for storing registered AMPL options