9 #ifndef __IPAMPLTNLP_HPP__ 10 #define __IPAMPLTNLP_HPP__ 118 AmplOption(
const std::string ipopt_option_name,
120 const std::string description);
124 delete [] description_;
129 return ipopt_option_name_;
169 void** nerror = NULL)
171 ipopt_name_(ipopt_name),
212 const std::string ipopt_option_name,
214 const std::string description)
217 new AmplOption(ipopt_option_name, type, description);
218 ampl_options_map_[ampl_option_name] =
ConstPtr(new_option);
224 return (
Index)ampl_options_map_.size();
251 void MakeValidLatexString(std::string source, std::string& dest)
const;
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);
304 virtual bool get_var_con_metadata(
Index n,
320 virtual bool get_constraints_linearity(
Index m,
325 virtual bool get_starting_point(
Index n,
bool init_x,
Number*
x,
360 bool& use_x_scaling,
Index n,
362 bool& use_g_scaling,
Index m,
378 virtual Index get_number_of_nonlinear_variables();
379 virtual bool get_list_of_nonlinear_variables(
Index num_nonlin_vars,
380 Index* pos_nonlin_vars);
395 void write_solution_file(
const std::string& message)
const;
402 void get_discrete_info(
Index& nlvb_,
417 void set_active_objective(
Index obj_no);
426 var_string_md_[tag] = meta_data;
431 var_integer_md_[tag] = meta_data;
436 var_numeric_md_[tag] = meta_data;
441 con_string_md_[tag] = meta_data;
446 con_integer_md_[tag] = meta_data;
451 con_numeric_md_[tag] = meta_data;
458 return suffix_handler_;
539 bool apply_new_x(
bool new_x,
Index n,
const Number* x);
546 const char* ampl_option_string,
547 const char* ampl_invokation_string,
548 const char* ampl_banner_string,
char**& argv);
551 bool nerror_ok(
void* nerror);
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.
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)
AmplOptionType Type() const
Class for all IPOPT specific calculated quantities.
const std::string & IpoptOptionName() const
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
Index NumberOfAmplOptions()
Number of AMPL Options.
Number Number Index m
Number of constraints.
const Number * GetNumberSuffixValues(std::string suffix_string, Suffix_Source source) const
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)
Number Number * g
Values of constraint at final point (output only - ignored if set to NULL)
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB Eval_Jac_G_CB Eval_H_CB eval_h
Callback function for evaluating Hessian of Lagrangian function.
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
const std::string ipopt_name_
double Number
Type of all numbers.
bool set_active_objective_called_
true when set_active_objective has been called
void set_integer_metadata_for_con(std::string tag, std::vector< Index > meta_data)
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB eval_grad_f
Callback function for evaluating gradient of objective function.
Number Number Number * obj_val
Final value of objective function (output only - ignored if set to NULL)
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...
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 SmartPtr< OptionsList > & Options() const
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 std::string & IpoptName() const
void set_string_metadata_for_con(std::string tag, std::vector< std::string > meta_data)
void operator=(const AmplSuffixHandler &)
Overloaded Equals Operator.
Template class for Smart Pointers.
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB Eval_Jac_G_CB eval_jac_g
Callback function for evaluating Jacobian of constraint functions.
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*)
Number Number Index Number Number Index nele_jac
Number of non-zero elements in constraint Jacobian.
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.
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB eval_g
Callback function for evaluating constraint functions.
int Index
Type of all indices of vectors, matrices etc.
SmartPtr< const Journalist > jnlst_
Journlist.
void set_numeric_metadata_for_con(std::string tag, std::vector< Number > meta_data)
Number Number * x_scaling
char * Description() const
std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
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 * 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)
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.
NumericMetaDataMapType con_numeric_md_
std::vector< Suffix_Source > suffix_sources_
IndexStyleEnum
overload this method to return the number of variables and constraints, and the number of non-zeros i...
const SmartPtr< const Journalist > & Jnlst() const
Base class for all NLP's that use standard triplet matrix form and dense vectors. ...
const AmplOptionType type_
const Index * GetIntegerSuffixValues(std::string suffix_string, Suffix_Source source) const
NumericMetaDataMapType var_numeric_md_
Number Number Index Number Number Index Index Index Eval_F_CB eval_f
Callback function for evaluating objective function.
Number * x_sol_
Solution Vectors.
const SmartPtr< OptionsList > options_
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
friend class AmplTNLP
Method called by AmplTNLP to retrieve the suffixes from asl.