Go to the documentation of this file.
7 #ifndef __IPAMPLTNLP_HPP__
8 #define __IPAMPLTNLP_HPP__
48 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 Index* GetIntegerSuffixValues(
60 std::string suffix_string,
64 const Number* GetNumberSuffixValues(
65 std::string suffix_string,
69 std::vector<Index> GetIntegerSuffixValues(
71 std::string suffix_string,
75 std::vector<Number> GetNumberSuffixValues(
77 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(
327 bool allow_discrete =
false,
329 const char* ampl_option_string = NULL,
330 const char* ampl_invokation_string = NULL,
331 const char* ampl_banner_string = NULL,
332 std::string* nl_file_content = NULL
344 virtual bool get_nlp_info(
352 virtual bool get_var_con_metadata(
364 virtual bool get_bounds_info(
373 virtual bool get_constraints_linearity(
378 virtual bool get_starting_point(
397 virtual bool eval_grad_f(
412 virtual bool eval_jac_g(
437 virtual bool get_scaling_parameters(
450 virtual void finalize_solution(
467 virtual Index get_number_of_nonlinear_variables();
468 virtual bool get_list_of_nonlinear_variables(
469 Index num_nonlin_vars,
470 Index* pos_nonlin_vars
487 void write_solution_file(
488 const std::string& message
496 void get_discrete_info(
516 void set_active_objective(
527 std::vector<std::string> meta_data)
529 var_string_md_[tag] = meta_data;
534 std::vector<Index> meta_data)
536 var_integer_md_[tag] = meta_data;
541 std::vector<Number> meta_data)
543 var_numeric_md_[tag] = meta_data;
548 std::vector<std::string> meta_data)
550 con_string_md_[tag] = meta_data;
555 std::vector<Index> meta_data)
557 con_integer_md_[tag] = meta_data;
562 std::vector<Number> meta_data)
564 con_numeric_md_[tag] = meta_data;
571 return suffix_handler_;
651 bool internal_objval(
657 bool internal_conval(
680 const char* ampl_option_string,
681 const char* ampl_invokation_string,
682 const char* ampl_banner_string,
@ WS_Option
this is for AMPL's internal wantsol callback
ASL_pfgh * asl_
pointer to the main ASL structure
bool hesset_called_
whether we have called hesset
Class to organize all the data required by the algorithm.
void AddAmplOption(const std::string ampl_option_name, const std::string ipopt_option_name, AmplOptionsList::AmplOptionType type, const std::string description)
Adding a new AMPL Option.
const std::string ipopt_name_
void set_integer_metadata_for_con(std::string tag, std::vector< Index > meta_data)
char * Description() const
bool conval_called_with_current_x_
whether the constraint values have been calculated with the current x set to false in apply_new_x,...
Ampl Option class containing name, type and description for an AMPL option.
Class for storing a number of AMPL options that should be registered to the AMPL Solver library inter...
Ampl Interface, implemented as a TNLP.
std::vector< Suffix_Source > suffix_sources_
double obj_sign_
Sign of the objective fn (1 for min, -1 for max)
Class for all IPOPT specific calculated quantities.
std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
This file contains a base class for all exceptions and a set of macros to help with exceptions.
double Number
Type of all numbers.
void set_string_metadata_for_con(std::string tag, std::vector< std::string > meta_data)
const SmartPtr< const Journalist > & Jnlst() const
std::vector< std::string > suffix_ids_
const std::string & IpoptName() const
ASL_pfgh * AmplSolverObject()
Return the ampl solver object (ASL*)
AmplOptionsList()
Default Constructor.
void set_numeric_metadata_for_con(std::string tag, std::vector< Number > meta_data)
Index nz_h_full_
number of nonzeros in the full_x Hessian
void set_numeric_metadata_for_var(std::string tag, std::vector< Number > meta_data)
int Index
Type of all indices of vectors, matrices etc.
const SmartPtr< OptionsList > options_
Template class for Smart Pointers.
const std::string ipopt_option_name_
bool set_active_objective_called_
whether set_active_objective has been called
IntegerMetaDataMapType con_integer_md_
Index nkeywds_
Number of entries stored in keywds_.
void AddAvailableSuffix(std::string suffix_string, Suffix_Source source, Suffix_Type type)
bool objval_called_with_current_x_
whether the objective value has been calculated with the current x
AmplOptionType Type() const
std::map< std::string, std::vector< Number > > NumericMetaDataMapType
void * keywds_
pointer to the keywords
SmartPtr< AmplSuffixHandler > suffix_handler_
Suffix Handler.
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)
LinearityType
Linearity-types of variables and constraints.
IntegerMetaDataMapType var_integer_md_
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
std::map< std::string, std::vector< std::string > > StringMetaDataMapType
Index NumberOfAmplOptions()
Number of AMPL Options.
const std::string & IpoptOptionName() const
PrivatInfo(const std::string ipopt_name, SmartPtr< OptionsList > options, SmartPtr< const Journalist > jnlst, void **nerror=NULL)
Base class for all NLP's that use standard triplet matrix form and dense vectors.
NumericMetaDataMapType var_numeric_md_
SmartPtr< const Journalist > jnlst_
Journalist.
SmartPtr< AmplSuffixHandler > get_suffix_handler()
Method for returning the suffix handler.
const AmplOptionType type_
std::vector< Suffix_Type > suffix_types_
StringMetaDataMapType var_string_md_
meta data to pass on to TNLP
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
StringMetaDataMapType con_string_md_
SolverReturn
enum for the return from the optimize algorithm
const SmartPtr< OptionsList > & Options() const
const SmartPtr< const Journalist > jnlst_
void * Oinfo_ptr_
Pointer to the Oinfo structure.
Storing the reference count of all the smart pointers that currently reference it.
std::map< std::string, SmartPtr< const AmplOption > > ampl_options_map_
map for storing registered AMPL options
void * nerror_
nerror flag passed to ampl calls - set to NULL to halt on error
NumericMetaDataMapType con_numeric_md_