9 #ifndef __IPAMPLTNLP_HPP__ 
   10 #define __IPAMPLTNLP_HPP__ 
  118       AmplOption(
const std::string ipopt_option_name,
 
  120                  const std::string description);
 
  169                  void** nerror = NULL)
 
  212                        const std::string ipopt_option_name,
 
  214                        const std::string description)
 
  217         new AmplOption(ipopt_option_name, type, description);
 
  280              suffix_handler = NULL, 
bool allow_discrete = 
false,
 
  282              const char* ampl_option_string = NULL,
 
  283              const char* ampl_invokation_string = NULL,
 
  284              const char* ampl_banner_string = NULL,
 
  285              std::string* nl_file_content = NULL);
 
  360                                         bool& use_x_scaling, 
Index n,
 
  362                                         bool& use_g_scaling, 
Index m,
 
  380         Index* pos_nonlin_vars);
 
  546                       const char* ampl_option_string,
 
  547                       const char* ampl_invokation_string,
 
  548                       const char* ampl_banner_string, 
char**& argv);
 
const std::string ipopt_option_name_
 
std::map< std::string, std::vector< Number > > NumericMetaDataMapType
 
StringMetaDataMapType con_string_md_
 
Number * x
Input: Starting point Output: Optimal solution. 
 
virtual Index get_number_of_nonlinear_variables()
 
bool internal_objval(const Number *x, Number &obj_val)
Make the objective call to ampl. 
 
SmartPtr< AmplSuffixHandler > get_suffix_handler()
Method for returning the suffix handler. 
 
PrivatInfo(const std::string ipopt_name, SmartPtr< OptionsList > options, SmartPtr< const Journalist > jnlst, void **nerror=NULL)
 
Class for all IPOPT specific calculated quantities. 
 
Number Number Index Number Number Index Index Index index_style
        indexing style for iRow & jCol,  0 for C style, 1 for Fortran style 
 
void * nerror_
nerror flag passed to ampl calls - set to NULL to halt on error 
 
DECLARE_STD_EXCEPTION(NONPOSITIVE_SCALING_FACTOR)
Exceptions. 
 
void * Keywords(const SmartPtr< OptionsList > &options, SmartPtr< const Journalist > jnlst, void **nerror)
ASL keywords list for the stored options. 
 
Index NumberOfAmplOptions()
Number of AMPL Options. 
 
Number Number Index m
Number of constraints. 
 
void PrintLatex(SmartPtr< const Journalist > jnlst)
 
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. 
 
void set_numeric_metadata_for_var(std::string tag, std::vector< Number > meta_data)
 
void * Oinfo_ptr_
Pointer to the Oinfo structure. 
 
void AddAvailableSuffix(std::string suffix_string, Suffix_Source source, Suffix_Type type)
 
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). 
 
Number Number * g
Values of constraint at final point (output only - ignored if set to NULL) 
 
const SmartPtr< const Journalist > & Jnlst() const 
 
const std::string ipopt_name_
 
virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars, Index *pos_nonlin_vars)
 
double Number
Type of all numbers. 
 
bool set_active_objective_called_
true when set_active_objective has been called 
 
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. 
 
virtual ~AmplTNLP()
Default destructor. 
 
void set_integer_metadata_for_con(std::string tag, std::vector< Index > meta_data)
 
Number Number Number * obj_val
Final value of objective function (output only - ignored if set to NULL) 
 
bool nerror_ok(void *nerror)
returns true if the ampl nerror code is ok 
 
ASL_pfgh * asl_
pointer to the main ASL structure 
 
bool hesset_called_
true when we have called hesset 
 
bool conval_called_with_current_x_
true when the constraint values have been calculated with the current x, set to false in apply_new_x...
 
const Number * GetNumberSuffixValues(std::string suffix_string, Suffix_Source source) const 
 
AmplOptionType Type() const 
 
double obj_sign_
Sign of the objective fn (1 for min, -1 for max) 
 
void set_integer_metadata_for_var(std::string tag, std::vector< Index > meta_data)
 
IntegerMetaDataMapType con_integer_md_
 
LinearityType
Type of the constraints. 
 
const std::string & IpoptOptionName() const 
 
AmplOption()
Default Constructor. 
 
void MakeValidLatexString(std::string source, std::string &dest) const 
 
void operator=(const AmplOptionsList &)
Overloaded Equals Operator. 
 
bool objval_called_with_current_x_
true when the objective value has been calculated with the current x, set to false in apply_new_x...
 
const SmartPtr< OptionsList > & Options() const 
 
void set_string_metadata_for_con(std::string tag, std::vector< std::string > meta_data)
 
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. 
 
void operator=(const AmplSuffixHandler &)
Overloaded Equals Operator. 
 
Template class for Smart Pointers. 
 
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. 
 
Ampl Option class, contains name, type and description for an AMPL option. 
 
const SmartPtr< const Journalist > jnlst_
 
SolverReturn
enum for the return from the optimize algorithm (obviously we need to add more) 
 
Index nkeywds_
Number of entries stored in keywds_. 
 
ASL_pfgh * AmplSolverObject()
Return the ampl solver object (ASL*) 
 
virtual bool get_constraints_linearity(Index m, LinearityType *const_types)
Returns the constraint linearity. 
 
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. 
 
~AmplOptionsList()
Destructor. 
 
Number Number Index Number Number Index nele_jac
Number of non-zero elements in constraint Jacobian. 
 
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. 
 
IntegerMetaDataMapType var_integer_md_
 
std::vector< std::string > suffix_ids_
 
std::vector< Suffix_Type > suffix_types_
 
void PrepareAmplForSuffixes(ASL_pfgh *asl)
Method called by AmplTNLP to prepare the asl for the suffixes. 
 
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. 
 
int Index
Type of all indices of vectors, matrices etc. 
 
SmartPtr< const Journalist > jnlst_
Journlist. 
 
const std::string & IpoptName() const 
 
void set_numeric_metadata_for_con(std::string tag, std::vector< Number > meta_data)
 
virtual bool eval_g(Index n, const Number *x, bool new_x, Index m, Number *g)
evaluates the constraint residuals for the nlp. 
 
Number Number * x_scaling
 
std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
 
void call_hesset()
calls hesset ASL function 
 
Number Number Index Number Number Index Index nele_hess
Number of non-zero elements in Hessian of Lagrangian. 
 
std::map< std::string, std::vector< std::string > > StringMetaDataMapType
 
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
 
void operator=(const AmplTNLP &)
Overloaded Equals Operator. 
 
void * keywds_
pointer to the keywords 
 
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 ...
 
SmartPtr< AmplSuffixHandler > suffix_handler_
Suffix Handler. 
 
void set_string_metadata_for_var(std::string tag, std::vector< std::string > meta_data)
 
virtual bool eval_f(Index n, const Number *x, bool new_x, Number &obj_value)
evaluates the objective value for the nlp. 
 
char * Description() const 
 
Class for storing a number of AMPL options that should be registered to the AMPL Solver library inter...
 
Number Number Number * g_scaling
 
AmplOptionsList()
Default Constructor. 
 
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 ...
 
NumericMetaDataMapType con_numeric_md_
 
std::vector< Suffix_Source > suffix_sources_
 
AmplTNLP()
Default Constructor. 
 
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...
 
IndexStyleEnum
overload this method to return the number of variables and constraints, and the number of non-zeros i...
 
bool apply_new_x(bool new_x, Index n, const Number *x)
Internal function to update the internal and ampl state if the x value changes. 
 
bool internal_conval(const Number *x, Index m, Number *g=NULL)
Make the constraint call to ampl. 
 
void operator=(const AmplOption &)
Overloaded Equals Operator. 
 
Base class for all NLP's that use standard triplet matrix form and dense vectors. ...
 
const AmplOptionType type_
 
void write_solution_file(const std::string &message) const 
Write the solution file. 
 
NumericMetaDataMapType var_numeric_md_
 
void set_active_objective(Index obj_no)
A method for setting the index of the objective function to be considered. 
 
Number * x_sol_
Solution Vectors. 
 
const SmartPtr< OptionsList > options_
 
const Index * GetIntegerSuffixValues(std::string suffix_string, Suffix_Source source) const 
 
StringMetaDataMapType var_string_md_
meta data to pass on to TNLP 
 
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...
 
std::map< std::string, SmartPtr< const AmplOption > > ampl_options_map_
map for storing registered AMPL options