Ipopt Documentation  
IpRegOptions.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2007 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Carl Laird, Andreas Waechter IBM 2005-06-18
6 
7 #ifndef __IPREGOPTIONS_HPP__
8 #define __IPREGOPTIONS_HPP__
9 
10 #include "IpUtils.hpp"
11 #include "IpReferenced.hpp"
12 #include "IpException.hpp"
13 #include "IpSmartPtr.hpp"
14 
15 #include <map>
16 #include <set>
17 #include <list>
18 
19 namespace Ipopt
20 {
21 
23 {
28 };
29 
30 class OptionsList;
31 class RegisteredOption;
32 
37 {
38  friend class RegisteredOptions;
39 public:
44  const std::string& name,
45  int priority
46  )
47  : name_(name),
48  priority_(priority)
49  { }
50 
52  const std::string& Name() const
53  {
54  return name_;
55  }
56 
62  operator const std::string& () const
63  {
64  return name_;
65  }
66 
72  bool operator!=(
73  const std::string& other
74  ) const
75  {
76  return name_ != other;
77  }
78 
84  bool operator==(
85  const std::string& other
86  ) const
87  {
88  return name_ == other;
89  }
90 
96  bool operator<(
97  const RegisteredCategory& other
98  ) const
99  {
100  return name_ < other.name_;
101  }
102 
104  int Priority() const
105  {
106  return priority_;
107  }
108 
110  const std::list<SmartPtr<RegisteredOption> >& RegisteredOptions() const
111  {
112  return regoptions_;
113  }
114 
115  // class comparing two categories by priority
117  {
118  public:
120  const SmartPtr<RegisteredCategory>& lhs,
122  ) const
123  {
124  DBG_ASSERT(IsValid(lhs));
125  DBG_ASSERT(IsValid(rhs));
126  return lhs->priority_ > rhs->priority_;
127  }
128  };
129 
130 private:
137 
139  std::string name_;
140 
143 
145  std::list<SmartPtr<RegisteredOption> > regoptions_;
146 };
147 
150 {
151  friend class RegisteredOptions;
152 public:
155  {
156  public:
158  const std::string& value,
159  const std::string& description
160  )
161  : value_(value),
162  description_(description)
163  { }
164 
165  std::string value_;
166  std::string description_;
167  };
168 
172  Index counter
173  )
174  : type_(OT_Unknown),
175  advanced_(false),
176  has_lower_(false),
177  has_upper_(false),
178  counter_(counter)
179  { }
180 
182  const std::string& name,
183  const std::string& short_description,
184  const std::string& long_description,
185  const SmartPtr<RegisteredCategory>& registering_category,
186  Index counter,
187  bool advanced = false
188  )
189  : name_(name),
190  short_description_(short_description),
191  long_description_(long_description),
192  registering_category_(registering_category),
193  type_(OT_Unknown),
194  advanced_(advanced),
195  has_lower_(false),
196  has_upper_(false),
197  counter_(counter)
198  { }
199 
201  const RegisteredOption& copy
202  )
203  : name_(copy.name_),
204  short_description_(copy.short_description_),
205  long_description_(copy.long_description_),
206  registering_category_(copy.registering_category_),
207  type_(copy.type_),
208  advanced_(copy.advanced_),
209  has_lower_(copy.has_lower_),
210  lower_(copy.lower_),
211  has_upper_(copy.has_upper_),
212  upper_(copy.upper_),
213  valid_strings_(copy.valid_strings_),
214  counter_(copy.counter_)
215  { }
216 
218  { }
220 
221  DECLARE_STD_EXCEPTION(ERROR_CONVERTING_STRING_TO_ENUM);
222 
225 
226  virtual const std::string& Name() const
227  {
228  return name_;
229  }
231  virtual void SetName(
232  const std::string& name
233  )
234  {
235  name_ = name;
236  }
238  virtual const std::string& ShortDescription() const
239  {
240  return short_description_;
241  }
242 
244  virtual const std::string& LongDescription() const
245  {
246  return long_description_;
247  }
248 
250  virtual void SetShortDescription(
251  const std::string& short_description
252  )
253  {
254  short_description_ = short_description;
255  }
256 
258  virtual void SetLongDescription(
259  const std::string& long_description
260  )
261  {
262  long_description_ = long_description;
263  }
264 
269  {
270  return *registering_category_;
271  }
272 
274  virtual const RegisteredOptionType& Type() const
275  {
276  return type_;
277 
278  }
280  virtual void SetType(
281  const RegisteredOptionType& type
282  )
283  {
284  type_ = type;
285  }
286 
290  virtual bool Advanced() const
291  {
292  return advanced_;
293  }
297  virtual void SetAdvanced(
298  bool advanced = true
299  )
300  {
301  advanced_ = advanced;
302  }
303 
305  virtual Index Counter() const
306  {
307  return counter_;
308  }
310 
316 
320  virtual const bool& HasLower() const
321  {
322  DBG_ASSERT(type_ == OT_Number || type_ == OT_Integer);
323  return has_lower_;
324  }
325 
330  virtual const bool& LowerStrict() const
331  {
332  DBG_ASSERT(type_ == OT_Number && has_lower_ == true);
333  return lower_strict_;
334  }
335 
340  virtual Number LowerNumber() const
341  {
342  DBG_ASSERT(has_lower_ == true && type_ == OT_Number);
343  return lower_;
344  }
345 
350  virtual void SetLowerNumber(
351  const Number& lower,
352  const bool& strict
353  )
354  {
355  DBG_ASSERT(type_ == OT_Number);
356  lower_ = lower;
357  lower_strict_ = strict, has_lower_ = true;
358  }
359 
364  virtual Index LowerInteger() const
365  {
366  DBG_ASSERT(has_lower_ == true && type_ == OT_Integer);
367  return (Index) lower_;
368  }
369 
374  virtual void SetLowerInteger(
375  const Index& lower
376  )
377  {
378  DBG_ASSERT(type_ == OT_Integer);
379  lower_ = (Number) lower;
380  has_lower_ = true;
381  }
382 
387  virtual const bool& HasUpper() const
388  {
389  DBG_ASSERT(type_ == OT_Number || type_ == OT_Integer);
390  return has_upper_;
391  }
392 
397  virtual const bool& UpperStrict() const
398  {
399  DBG_ASSERT(type_ == OT_Number && has_upper_ == true);
400  return upper_strict_;
401  }
402 
407  virtual Number UpperNumber() const
408  {
409  DBG_ASSERT(has_upper_ == true && type_ == OT_Number);
410  return upper_;
411  }
412 
417  virtual void SetUpperNumber(
418  const Number& upper,
419  const bool& strict
420  )
421  {
422  DBG_ASSERT(type_ == OT_Number);
423  upper_ = upper;
424  upper_strict_ = strict;
425  has_upper_ = true;
426  }
427 
432  virtual Index UpperInteger() const
433  {
434  DBG_ASSERT(has_upper_ == true && type_ == OT_Integer);
435  return (Index) upper_;
436  }
437 
442  virtual void SetUpperInteger(
443  const Index& upper
444  )
445  {
446  DBG_ASSERT(type_ == OT_Integer);
447  upper_ = (Number) upper;
448  has_upper_ = true;
449  }
450 
455  virtual void AddValidStringSetting(
456  const std::string& value,
457  const std::string& description)
458  {
459  DBG_ASSERT(type_ == OT_String);
460  valid_strings_.push_back(string_entry(value, description));
461  }
462 
467  virtual Number DefaultNumber() const
468  {
469  DBG_ASSERT(type_ == OT_Number);
470  return default_number_;
471  }
472 
477  virtual void SetDefaultNumber(
478  const Number& default_value
479  )
480  {
481  DBG_ASSERT(type_ == OT_Number);
482  default_number_ = default_value;
483  }
484 
489  virtual Index DefaultInteger() const
490  {
491  DBG_ASSERT(type_ == OT_Integer);
492  return (Index) default_number_;
493  }
494 
499  virtual void SetDefaultInteger(
500  const Index& default_value
501  )
502  {
503  DBG_ASSERT(type_ == OT_Integer);
504  default_number_ = (Number) default_value;
505  }
506 
511  virtual std::string DefaultString() const
512  {
513  DBG_ASSERT(type_ == OT_String);
514  return default_string_;
515  }
516 
523  virtual Index DefaultStringAsEnum() const
524  {
525  DBG_ASSERT(type_ == OT_String);
526  return MapStringSettingToEnum(default_string_);
527  }
528 
533  virtual void SetDefaultString(
534  const std::string& default_value
535  )
536  {
537  DBG_ASSERT(type_ == OT_String);
538  default_string_ = default_value;
539  }
540 
545  virtual std::vector<string_entry> GetValidStrings() const
546  {
547  DBG_ASSERT(type_ == OT_String);
548  return valid_strings_;
549  }
550 
555  virtual bool IsValidNumberSetting(
556  const Number& value
557  ) const
558  {
559  DBG_ASSERT(type_ == OT_Number);
560  if( has_lower_ && ((lower_strict_ == true && value <= lower_) || (lower_strict_ == false && value < lower_)) )
561  {
562  return false;
563  }
564  if( has_upper_ && ((upper_strict_ == true && value >= upper_) || (upper_strict_ == false && value > upper_)) )
565  {
566  return false;
567  }
568  return true;
569  }
570 
575  virtual bool IsValidIntegerSetting(
576  const Index& value
577  ) const
578  {
579  DBG_ASSERT(type_ == OT_Integer);
580  if( has_lower_ && value < lower_ )
581  {
582  return false;
583  }
584  if( has_upper_ && value > upper_ )
585  {
586  return false;
587  }
588  return true;
589  }
590 
595  virtual bool IsValidStringSetting(
596  const std::string& value
597  ) const;
598 
602  virtual std::string MapStringSetting(
603  const std::string& value
604  ) const;
605 
612  const std::string& value
613  ) const;
615 
617  virtual void OutputDescription(
618  const Journalist& jnlst
619  ) const;
620 
623  const Journalist& jnlst
624  ) const;
625 
628  const Journalist& jnlst
629  ) const;
630 
633  const Journalist& jnlst
634  ) const;
635 
636 private:
637  std::string name_;
638  std::string short_description_;
639  std::string long_description_;
642  bool advanced_;
643 
651 
652  std::vector<string_entry> valid_strings_;
653  std::string default_string_;
654 
658 
660  const std::string& source,
661  std::string& dest
662  ) const;
663 
664  std::string MakeValidLatexNumber(
665  Number value
666  ) const;
667 
668  std::string MakeValidHTMLNumber(
669  Number value
670  ) const;
671 
674  const std::string& s1,
675  const std::string& s2
676  ) const;
677 };
678 
684 {
685 public:
687  typedef std::map<std::string, SmartPtr<RegisteredOption> > RegOptionsList;
689  typedef std::map<std::string, SmartPtr<RegisteredCategory> > RegCategoriesList;
691  typedef std::set<SmartPtr<RegisteredCategory>, RegisteredCategory::ComparePriority> RegCategoriesByPriority;
692 
697  {
698  OUTPUTTEXT = 0,
700  OUTPUTDOXYGEN
701  };
702 
705 
707  : next_counter_(0)
708  { }
709 
712  {
713  // break circular reference between registered options and registered categories
714  for( RegCategoriesList::iterator it(registered_categories_.begin()); it != registered_categories_.end(); ++it )
715  {
716  it->second->regoptions_.clear();
717  }
718  }
720 
721  DECLARE_STD_EXCEPTION(OPTION_ALREADY_REGISTERED);
722 
732  const std::string& registering_category,
733  int priority = 0
734  );
735 
743  SmartPtr<RegisteredCategory> registering_category
744  );
745 
750  {
751  return current_registering_category_;
752  }
753 
755  virtual void AddNumberOption(
756  const std::string& name,
757  const std::string& short_description,
758  Number default_value,
759  const std::string& long_description = "",
760  bool advanced = false
761  );
762 
765  const std::string& name,
766  const std::string& short_description,
767  Number lower,
768  bool strict,
769  Number default_value,
770  const std::string& long_description = "",
771  bool advanced = false
772  );
773 
776  const std::string& name,
777  const std::string& short_description,
778  Number upper,
779  bool strict,
780  Number default_value,
781  const std::string& long_description = "",
782  bool advanced = false
783  );
784 
787  const std::string& name,
788  const std::string& short_description,
789  Number lower,
790  bool lower_strict,
791  Number upper,
792  bool upper_strict,
793  Number default_value,
794  const std::string& long_description = "",
795  bool advanced = false
796  );
797 
799  virtual void AddIntegerOption(
800  const std::string& name,
801  const std::string& short_description,
802  Index default_value,
803  const std::string& long_description = "",
804  bool advanced = false
805  );
806 
809  const std::string& name,
810  const std::string& short_description,
811  Index lower,
812  Index default_value,
813  const std::string& long_description = "",
814  bool advanced = false
815  );
816 
819  const std::string& name,
820  const std::string& short_description,
821  Index upper,
822  Index default_value,
823  const std::string& long_description = "",
824  bool advanced = false
825  );
826 
829  const std::string& name,
830  const std::string& short_description,
831  Index lower,
832  Index upper,
833  Index default_value,
834  const std::string& long_description = "",
835  bool advanced = false
836  );
837 
839  virtual void AddStringOption(
840  const std::string& name,
841  const std::string& short_description,
842  const std::string& default_value,
843  const std::vector<std::string>& settings,
844  const std::vector<std::string>& descriptions,
845  const std::string& long_description = "",
846  bool advanced = false
847  );
848 
850  virtual void AddStringOption1(
851  const std::string& name,
852  const std::string& short_description,
853  const std::string& default_value,
854  const std::string& setting1,
855  const std::string& description1,
856  const std::string& long_description = "",
857  bool advanced = false
858  );
859 
860  virtual void AddStringOption2(
861  const std::string& name,
862  const std::string& short_description,
863  const std::string& default_value,
864  const std::string& setting1,
865  const std::string& description1,
866  const std::string& setting2,
867  const std::string& description2,
868  const std::string& long_description = "",
869  bool advanced = false
870  );
871 
872  virtual void AddStringOption3(
873  const std::string& name,
874  const std::string& short_description,
875  const std::string& default_value,
876  const std::string& setting1,
877  const std::string& description1,
878  const std::string& setting2,
879  const std::string& description2,
880  const std::string& setting3,
881  const std::string& description3,
882  const std::string& long_description = "",
883  bool advanced = false
884  );
885 
886  virtual void AddStringOption4(
887  const std::string& name,
888  const std::string& short_description,
889  const std::string& default_value,
890  const std::string& setting1,
891  const std::string& description1,
892  const std::string& setting2,
893  const std::string& description2,
894  const std::string& setting3,
895  const std::string& description3,
896  const std::string& setting4,
897  const std::string& description4,
898  const std::string& long_description = "",
899  bool advanced = false
900  );
901 
902  virtual void AddStringOption5(
903  const std::string& name,
904  const std::string& short_description,
905  const std::string& default_value,
906  const std::string& setting1,
907  const std::string& description1,
908  const std::string& setting2,
909  const std::string& description2,
910  const std::string& setting3,
911  const std::string& description3,
912  const std::string& setting4,
913  const std::string& description4,
914  const std::string& setting5,
915  const std::string& description5,
916  const std::string& long_description = "",
917  bool advanced = false
918  );
919 
920  virtual void AddStringOption6(
921  const std::string& name,
922  const std::string& short_description,
923  const std::string& default_value,
924  const std::string& setting1,
925  const std::string& description1,
926  const std::string& setting2,
927  const std::string& description2,
928  const std::string& setting3,
929  const std::string& description3,
930  const std::string& setting4,
931  const std::string& description4,
932  const std::string& setting5,
933  const std::string& description5,
934  const std::string& setting6,
935  const std::string& description6,
936  const std::string& long_description = "",
937  bool advanced = false
938  );
939 
940  virtual void AddStringOption7(
941  const std::string& name,
942  const std::string& short_description,
943  const std::string& default_value,
944  const std::string& setting1,
945  const std::string& description1,
946  const std::string& setting2,
947  const std::string& description2,
948  const std::string& setting3,
949  const std::string& description3,
950  const std::string& setting4,
951  const std::string& description4,
952  const std::string& setting5,
953  const std::string& description5,
954  const std::string& setting6,
955  const std::string& description6,
956  const std::string& setting7,
957  const std::string& description7,
958  const std::string& long_description = "",
959  bool advanced = false
960  );
961 
962  virtual void AddStringOption8(
963  const std::string& name,
964  const std::string& short_description,
965  const std::string& default_value,
966  const std::string& setting1,
967  const std::string& description1,
968  const std::string& setting2,
969  const std::string& description2,
970  const std::string& setting3,
971  const std::string& description3,
972  const std::string& setting4,
973  const std::string& description4,
974  const std::string& setting5,
975  const std::string& description5,
976  const std::string& setting6,
977  const std::string& description6,
978  const std::string& setting7,
979  const std::string& description7,
980  const std::string& setting8,
981  const std::string& description8,
982  const std::string& long_description = "",
983  bool advanced = false
984  );
985 
986  virtual void AddStringOption9(
987  const std::string& name,
988  const std::string& short_description,
989  const std::string& default_value,
990  const std::string& setting1,
991  const std::string& description1,
992  const std::string& setting2,
993  const std::string& description2,
994  const std::string& setting3,
995  const std::string& description3,
996  const std::string& setting4,
997  const std::string& description4,
998  const std::string& setting5,
999  const std::string& description5,
1000  const std::string& setting6,
1001  const std::string& description6,
1002  const std::string& setting7,
1003  const std::string& description7,
1004  const std::string& setting8,
1005  const std::string& description8,
1006  const std::string& setting9,
1007  const std::string& description9,
1008  const std::string& long_description = "",
1009  bool advanced = false
1010  );
1011 
1012  virtual void AddStringOption10(
1013  const std::string& name,
1014  const std::string& short_description,
1015  const std::string& default_value,
1016  const std::string& setting1,
1017  const std::string& description1,
1018  const std::string& setting2,
1019  const std::string& description2,
1020  const std::string& setting3,
1021  const std::string& description3,
1022  const std::string& setting4,
1023  const std::string& description4,
1024  const std::string& setting5,
1025  const std::string& description5,
1026  const std::string& setting6,
1027  const std::string& description6,
1028  const std::string& setting7,
1029  const std::string& description7,
1030  const std::string& setting8,
1031  const std::string& description8,
1032  const std::string& setting9,
1033  const std::string& description9,
1034  const std::string& setting10,
1035  const std::string& description10,
1036  const std::string& long_description = "",
1037  bool advanced = false
1038  );
1039 
1043  virtual void AddBoolOption(
1044  const std::string& name,
1045  const std::string& short_description,
1046  bool default_value,
1047  const std::string& long_description = "",
1048  bool advanced = false
1049  );
1050 
1056  const std::string& name
1057  );
1058 
1061  {
1062  return registered_options_;
1063  }
1064 
1069  {
1070  return registered_categories_;
1071  }
1072 
1079  RegCategoriesByPriority& categories
1080  ) const;
1081 
1090  const Journalist& jnlst,
1091  SmartPtr<OptionsList> options,
1092  int minpriority = 0
1093  ) const;
1094 
1103  const Journalist& jnlst,
1104  const std::list<std::string>& categories = std::list<std::string>()
1105  ) const;
1106 
1115  const Journalist& jnlst,
1116  const std::list<std::string>& options_to_print = std::list<std::string>()
1117  ) const;
1118 
1127  const Journalist& jnlst,
1128  const std::list<std::string>& options_to_print = std::list<std::string>()
1129  ) const;
1130 
1134  static void RegisterOptions(
1136  );
1137 
1138 private:
1140  const SmartPtr<RegisteredOption>& option
1141  );
1142 
1145 
1148 };
1149 
1150 } // namespace Ipopt
1151 
1152 #endif
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:27
#define IPOPT_DEPRECATED
macro to declare symbols as deprecated
Definition: IpTypes.h:25
Class responsible for all message output.
Storing the reference count of all the smart pointers that currently reference it.
bool operator()(const SmartPtr< RegisteredCategory > &lhs, const SmartPtr< RegisteredCategory > &rhs) const
A category of registered options.
RegisteredCategory & operator=(const RegisteredCategory &)
unimplemented assignment operator
IPOPT_DEPRECATED bool operator!=(const std::string &other) const
compare with string
RegisteredCategory(const std::string &name, int priority)
Constructor.
int Priority() const
priority of category
RegisteredCategory(const RegisteredCategory &)
unimplemented copy constructor
std::list< SmartPtr< RegisteredOption > > regoptions_
options of this category
IPOPT_DEPRECATED bool operator==(const std::string &other) const
compare with string
int priority_
priority of category (used to decide whether to print and printing order)
IPOPT_DEPRECATED bool operator<(const RegisteredCategory &other) const
compare two categories
RegisteredCategory()
unimplemented default constructor
const std::string & Name() const
name of category
const std::list< SmartPtr< RegisteredOption > > & RegisteredOptions() const
gives list of options in this category
std::string name_
name of category
class to hold the valid string settings for a string option
std::string value_
std::string description_
string_entry(const std::string &value, const std::string &description)
Option that has been registered.
virtual Number LowerNumber() const
get the Number version of the lower bound
virtual std::string MapStringSetting(const std::string &value) const
Map a user setting (allowing any case) to the case used when the setting was registered.
RegisteredOptionType type_
std::vector< string_entry > valid_strings_
virtual const RegisteredOptionType & Type() const
Get the Option's type.
RegisteredOption(Index counter)
Constructors / Destructors.
bool string_equal_insensitive(const std::string &s1, const std::string &s2) const
Compare two strings and return true if they are equal (case insensitive comparison)
virtual bool IsValidStringSetting(const std::string &value) const
Check if the String value is a valid setting.
virtual Index MapStringSettingToEnum(const std::string &value) const
Map a user setting (allowing any case) to the index of the matched setting in the list of string sett...
virtual const std::string & Name() const
Standard Get / Set Methods.
virtual std::vector< string_entry > GetValidStrings() const
get the valid string settings
virtual Index DefaultInteger() const
get the default as an Integer
RegisteredOption(const std::string &name, const std::string &short_description, const std::string &long_description, const SmartPtr< RegisteredCategory > &registering_category, Index counter, bool advanced=false)
std::string short_description_
virtual void OutputShortDescription(const Journalist &jnlst) const
output a more concise version
virtual void SetName(const std::string &name)
Set the option's name (tag in the input file)
virtual void OutputDoxygenDescription(const Journalist &jnlst) const
output a doxygen version
virtual const bool & HasUpper() const
check if the option has an upper bound
virtual const std::string & ShortDescription() const
Get the short description.
virtual Number UpperNumber() const
get the Number version of the upper bound
virtual void SetDefaultInteger(const Index &default_value)
Set the default as an Integer.
virtual void SetLowerInteger(const Index &lower)
set the Integer version of the lower bound
virtual bool IsValidNumberSetting(const Number &value) const
Check if the Number value is a valid setting.
virtual const RegisteredCategory & RegisteringCategory() const
Get the registering class.
virtual Number DefaultNumber() const
get the default as a Number
virtual const bool & HasLower() const
check if the option has a lower bound
virtual void SetLongDescription(const std::string &long_description)
Set the long description.
virtual const bool & LowerStrict() const
check if the lower bound is strict
virtual void OutputLatexDescription(const Journalist &jnlst) const
output a latex version
std::string MakeValidLatexNumber(Number value) const
virtual void SetLowerNumber(const Number &lower, const bool &strict)
set the Number version of the lower bound
virtual Index UpperInteger() const
get the Integer version of the upper bound
virtual Index LowerInteger() const
get the Integer version of the lower bound
void MakeValidLatexString(const std::string &source, std::string &dest) const
virtual void SetUpperNumber(const Number &upper, const bool &strict)
set the Number version of the upper bound
virtual void SetDefaultNumber(const Number &default_value)
Set the default as a Number.
virtual bool IsValidIntegerSetting(const Index &value) const
Check if the Integer value is a valid setting.
const Index counter_
Has the information as how many-th option this one was registered.
virtual void SetUpperInteger(const Index &upper)
set the Integer version of the upper bound
virtual const bool & UpperStrict() const
check if the upper bound is strict
SmartPtr< RegisteredCategory > registering_category_
virtual void SetShortDescription(const std::string &short_description)
Set the short description.
virtual void SetAdvanced(bool advanced=true)
Set the advanced flag.
virtual Index Counter() const
Counter.
DECLARE_STD_EXCEPTION(ERROR_CONVERTING_STRING_TO_ENUM)
std::string MakeValidHTMLNumber(Number value) const
virtual bool Advanced() const
Get the advanced flag.
virtual void SetType(const RegisteredOptionType &type)
Set the Option's type.
virtual void SetDefaultString(const std::string &default_value)
Set the default as a string.
RegisteredOption(const RegisteredOption &copy)
virtual void OutputDescription(const Journalist &jnlst) const
output a description of the option
virtual void AddValidStringSetting(const std::string &value, const std::string &description)
method to add valid string entries
virtual std::string DefaultString() const
get the default as a string
virtual const std::string & LongDescription() const
Get the long description.
virtual Index DefaultStringAsEnum() const
get the default as a string, but as the index of the string in the list
Class for storing registered options.
virtual void AddBoundedIntegerOption(const std::string &name, const std::string &short_description, Index lower, Index upper, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with a both bounds)
virtual void AddStringOption6(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &long_description="", bool advanced=false)
virtual SmartPtr< const RegisteredOption > GetOption(const std::string &name)
Get a registered option.
virtual void AddStringOption1(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &long_description="", bool advanced=false)
Methods that make adding string options with only a few entries easier.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
register options of RegisteredOptions class
virtual SmartPtr< RegisteredCategory > RegisteringCategory()
retrieve the value of the current registering category
virtual void AddUpperBoundedIntegerOption(const std::string &name, const std::string &short_description, Index upper, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with a upper bound)
SmartPtr< RegisteredCategory > current_registering_category_
virtual void SetRegisteringCategory(const std::string &registering_category, int priority=0)
set the registering class
virtual void AddIntegerOption(const std::string &name, const std::string &short_description, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with no restrictions)
virtual void AddBoolOption(const std::string &name, const std::string &short_description, bool default_value, const std::string &long_description="", bool advanced=false)
Create a string value with two possible settings: yes and no.
virtual void SetRegisteringCategory(SmartPtr< RegisteredCategory > registering_category)
set the registering class
RegisteredOptions()
Constructors / Destructors.
const RegCategoriesList & RegisteredCategories() const
Giving access to registered categories.
virtual void AddStringOption5(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &long_description="", bool advanced=false)
virtual void AddStringOption10(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &setting8, const std::string &description8, const std::string &setting9, const std::string &description9, const std::string &setting10, const std::string &description10, const std::string &long_description="", bool advanced=false)
virtual void AddLowerBoundedIntegerOption(const std::string &name, const std::string &short_description, Index lower, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with a lower bound)
void AddOption(const SmartPtr< RegisteredOption > &option)
DECLARE_STD_EXCEPTION(OPTION_ALREADY_REGISTERED)
virtual IPOPT_DEPRECATED void OutputOptionDocumentation(const Journalist &jnlst, const std::list< std::string > &categories=std::list< std::string >()) const
Output documentation in text format.
virtual void AddUpperBoundedNumberOption(const std::string &name, const std::string &short_description, Number upper, bool strict, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with a upper bound)
virtual void AddNumberOption(const std::string &name, const std::string &short_description, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with no restrictions)
const RegOptionsList & RegisteredOptionsList() const
Giving access to iteratable representation of the registered options.
virtual void AddStringOption8(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &setting8, const std::string &description8, const std::string &long_description="", bool advanced=false)
virtual void AddLowerBoundedNumberOption(const std::string &name, const std::string &short_description, Number lower, bool strict, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with a lower bound)
std::map< std::string, SmartPtr< RegisteredCategory > > RegCategoriesList
virtual void OutputOptionDocumentation(const Journalist &jnlst, SmartPtr< OptionsList > options, int minpriority=0) const
Output documentation.
virtual void AddStringOption4(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &long_description="", bool advanced=false)
virtual void AddStringOption9(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &setting8, const std::string &description8, const std::string &setting9, const std::string &description9, const std::string &long_description="", bool advanced=false)
RegCategoriesList registered_categories_
RegOptionsList registered_options_
virtual void AddBoundedNumberOption(const std::string &name, const std::string &short_description, Number lower, bool lower_strict, Number upper, bool upper_strict, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with a both bounds)
virtual IPOPT_DEPRECATED void OutputDoxygenOptionDocumentation(const Journalist &jnlst, const std::list< std::string > &options_to_print=std::list< std::string >()) const
Output documentation in Doxygen format to include in doxygen documentation.
virtual void AddStringOption2(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &long_description="", bool advanced=false)
virtual void AddStringOption3(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &long_description="", bool advanced=false)
void RegisteredCategoriesByPriority(RegCategoriesByPriority &categories) const
Giving access to registered categories ordered by (decreasing) priority.
virtual ~RegisteredOptions()
Destructor.
virtual IPOPT_DEPRECATED void OutputLatexOptionDocumentation(const Journalist &jnlst, const std::list< std::string > &options_to_print=std::list< std::string >()) const
Output documentation in Latex format to include in a latex file.
virtual void AddStringOption7(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &long_description="", bool advanced=false)
std::map< std::string, SmartPtr< RegisteredOption > > RegOptionsList
virtual void AddStringOption(const std::string &name, const std::string &short_description, const std::string &default_value, const std::vector< std::string > &settings, const std::vector< std::string > &descriptions, const std::string &long_description="", bool advanced=false)
Add a String option (with no restrictions)
std::set< SmartPtr< RegisteredCategory >, RegisteredCategory::ComparePriority > RegCategoriesByPriority
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:165
#define IPOPTLIB_EXPORT
Definition: config.h:94
This file contains a base class for all exceptions and a set of macros to help with exceptions.
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:672
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
RegisteredOptionType
@ OT_Unknown
@ OT_Integer
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17