OpenNN  2.2
Open Neural Networks Library
independent_parameters.cpp
1 /****************************************************************************************************************/
2 /* */
3 /* OpenNN: Open Neural Networks Library */
4 /* www.artelnics.com/opennn */
5 /* */
6 /* I N D E P E N D E N T P A R A M E T E R S C L A S S */
7 /* */
8 /* Roberto Lopez */
9 /* Artelnics - Making intelligent use of data */
11 /* */
12 /****************************************************************************************************************/
13 
14 // OpenNN includes
15 
16 #include "independent_parameters.h"
17 
18 namespace OpenNN
19 {
20 
21 // DEFAULT CONSTRUCTOR
22 
26 
28 {
29  set();
30 }
31 
32 
33 // INDEPENDENT PARAMETERS NUMBER CONSTRUCTOR
34 
40 
41 IndependentParameters::IndependentParameters(const size_t& new_parameters_number)
42 {
43  set(new_parameters_number);
44 }
45 
46 
47 
48 // COPY CONSTRUCTOR
49 
53 
55 {
56  set(other_independent_parameters);
57 }
58 
59 
60 // DESTRUCTOR
61 
64 
66 {
67 }
68 
69 
70 // ASSIGNMENT OPERATOR
71 
75 
77 {
78  if(this != &other_independent_parameters)
79  {
80  parameters = other_independent_parameters.parameters;
81  names = other_independent_parameters.names;
82  units = other_independent_parameters.units;
83  descriptions = other_independent_parameters.descriptions;
84  minimums = other_independent_parameters.minimums;
85  maximums = other_independent_parameters.maximums;
86  means = other_independent_parameters.means;
87  standard_deviations = other_independent_parameters.standard_deviations;
88  lower_bounds = other_independent_parameters.lower_bounds;
89  upper_bounds = other_independent_parameters.upper_bounds;
90  scaling_method = other_independent_parameters.scaling_method;
91  display_range_warning = other_independent_parameters.display_range_warning;
92  display = other_independent_parameters.display;
93  }
94 
95  return(*this);
96 }
97 
98 
99 // EQUAL TO OPERATOR
100 
101 // bool operator == (const IndependentParameters&) const method
102 
107 
108 bool IndependentParameters::operator == (const IndependentParameters& other_independent_parameters) const
109 {
110  if(parameters == other_independent_parameters.parameters
111  && names == other_independent_parameters.names
112  && units == other_independent_parameters.units
113  && descriptions == other_independent_parameters.descriptions
114  && minimums == other_independent_parameters.minimums
115  && maximums == other_independent_parameters.maximums
116  && means == other_independent_parameters.means
117  && standard_deviations == other_independent_parameters.standard_deviations
118  && lower_bounds == other_independent_parameters.lower_bounds
119  && upper_bounds == other_independent_parameters.upper_bounds
120  && scaling_method == other_independent_parameters.scaling_method
121  && display_range_warning == other_independent_parameters.display_range_warning
122  && display == other_independent_parameters.display)
123  {
124  return(true);
125  }
126  else
127  {
128  return(false);
129  }
130 }
131 
132 
133 // METHODS
134 
135 // const Vector<double> get_parameters(void) const method
136 
138 
140 {
141  return(parameters);
142 }
143 
144 
145 // double get_parameter(const size_t&) const method
146 
149 
150 double IndependentParameters::get_parameter(const size_t& index) const
151 {
152  // Control sentence (if debug)
153 
154  #ifndef NDEBUG
155 
156  const size_t parameters_number = get_parameters_number();
157 
158  if(index >= parameters_number)
159  {
160  std::ostringstream buffer;
161 
162  buffer << "OpenNN Exception: IndependentParameters class.\n"
163  << "double get_parameter(const size_t&) const method.\n"
164  << "Index of independent parameter must be less than number of parameters.\n";
165 
166  throw std::logic_error(buffer.str());
167  }
168 
169  #endif
170 
171  return(parameters[index]);
172 }
173 
174 
175 // const Vector<std::string>& get_names(void) const method
176 
179 
181 {
182  return(names);
183 }
184 
185 
186 // const std::string& get_name(const size_t&) const method
187 
191 
192 const std::string& IndependentParameters::get_name(const size_t& index) const
193 {
194  // Control sentence (if debug)
195 
196  #ifndef NDEBUG
197 
198  const size_t parameters_number = get_parameters_number();
199 
200  if(index >= parameters_number)
201  {
202  std::ostringstream buffer;
203 
204  buffer << "OpenNN Exception: IndependentParameters class.\n"
205  << "const std::string& get_name(const size_t&) const method.\n"
206  << "Index of independent parameter must be less than number of parameters.\n";
207 
208  throw std::logic_error(buffer.str());
209  }
210 
211  #endif
212 
213  return(names[index]);
214 }
215 
216 
217 // const Vector<std::string>& get_units(void) const method
218 
221 
223 {
224  return(units);
225 }
226 
227 
228 // const std::string& get_unit(const size_t&) const method
229 
233 
234 const std::string& IndependentParameters::get_unit(const size_t& index) const
235 {
236  // Control sentence (if debug)
237 
238  #ifndef NDEBUG
239 
240  const size_t parameters_number = get_parameters_number();
241 
242  if(index >= parameters_number)
243  {
244  std::ostringstream buffer;
245 
246  buffer << "OpenNN Exception: IndependentParameters class.\n"
247  << "const std::string get_units(const size_t&) const method.\n"
248  << "Index of independent parameter must be less than number of parameters.\n";
249 
250  throw std::logic_error(buffer.str());
251  }
252 
253  #endif
254 
255  return(units[index]);
256 }
257 
258 
259 // const Vector<std::string>& get_descriptions(void) const method
260 
263 
265 {
266  return(descriptions);
267 }
268 
269 
270 // const std::string& get_description(const size_t&) const method
271 
275 
276 const std::string& IndependentParameters::get_description(const size_t& index) const
277 {
278  // Control sentence (if debug)
279 
280  #ifndef NDEBUG
281 
282  const size_t parameters_number = get_parameters_number();
283 
284  if(index >= parameters_number)
285  {
286  std::ostringstream buffer;
287 
288  buffer << "OpenNN Exception: IndependentParameters class.\n"
289  << "const std::string get_description(const size_t&) const method.\n"
290  << "Index of independent parameter must be less than number of parameters.\n";
291 
292  throw std::logic_error(buffer.str());
293  }
294 
295  #endif
296 
297  return(descriptions[index]);
298 }
299 
300 
301 // Vector< Vector<std::string> > arrange_information(void) method
302 
310 
312 {
313  Vector< Vector<std::string> > information(3);
314 
315  information[0] = names;
316  information[1] = units;
317  information[2] = descriptions;
318 
319  return(information);
320 }
321 
322 
323 // const Vector<double>& get_minimums(void) const method
324 
327 
329 {
330  return(minimums);
331 }
332 
333 
334 // double get_minimum(const size_t&) const method
335 
339 
340 double IndependentParameters::get_minimum(const size_t& index) const
341 {
342  // Control sentence (if debug)
343 
344  #ifndef NDEBUG
345 
346  const size_t parameters_number = get_parameters_number();
347 
348  if(index >= parameters_number)
349  {
350  std::ostringstream buffer;
351 
352  buffer << "OpenNN Exception: IndependentParameters class.\n"
353  << "double get_minimum(const size_t&) const method.\n"
354  << "Index of independent parameter must be less than number of parameters.\n";
355 
356  throw std::logic_error(buffer.str());
357  }
358 
359  #endif
360 
361  return(minimums[index]);
362 }
363 
364 
365 // const Vector<double>& get_maximum(void) const method
366 
370 
372 {
373  return(maximums);
374 }
375 
376 
377 // double get_maximum(const size_t&) const method
378 
382 
383 double IndependentParameters::get_maximum(const size_t& index) const
384 {
385  // Control sentence (if debug)
386 
387  #ifndef NDEBUG
388 
389  const size_t parameters_number = get_parameters_number();
390 
391  if(index >= parameters_number)
392  {
393  std::ostringstream buffer;
394 
395  buffer << "OpenNN Exception: IndependentParameters class.\n"
396  << "double get_maximum(const size_t&) const method.\n"
397  << "Index must be less than number of parameters.\n";
398 
399  throw std::logic_error(buffer.str());
400  }
401 
402  #endif
403 
404  return(maximums[index]);
405 }
406 
407 
408 // const Vector<double>& get_means(void) const method
409 
412 
414 {
415  return(means);
416 }
417 
418 
419 // double get_mean(const size_t&) const method
420 
424 
425 double IndependentParameters::get_mean(const size_t& index) const
426 {
427  // Control sentence (if debug)
428 
429  #ifndef NDEBUG
430 
431  const size_t parameters_number = get_parameters_number();
432 
433  if(index >= parameters_number)
434  {
435  std::ostringstream buffer;
436 
437  buffer << "OpenNN Exception: IndependentParameters class.\n"
438  << "double get_mean(const size_t&) const method.\n"
439  << "Index must be less than number of parameters.\n";
440 
441  throw std::logic_error(buffer.str());
442  }
443 
444  #endif
445 
446  return(means[index]);
447 }
448 
449 
450 // const Vector<double>& get_standard_deviations(void) const method
451 
454 
456 {
457  return(standard_deviations);
458 }
459 
460 
461 // double get_standard_deviation(const size_t&) const method
462 
466 
467 double IndependentParameters::get_standard_deviation(const size_t& index) const
468 {
469  // Control sentence (if debug)
470 
471  #ifndef NDEBUG
472 
473  const size_t parameters_number = get_parameters_number();
474 
475  if(index >= parameters_number)
476  {
477  std::ostringstream buffer;
478 
479  buffer << "OpenNN Exception: IndependentParameters class.\n"
480  << "double get_standard_deviation(const size_t&) const method.\n"
481  << "Index must be less than number of parameters.\n";
482 
483  throw std::logic_error(buffer.str());
484  }
485 
486  #endif
487 
488  return(standard_deviations[index]);
489 }
490 
491 
492 // Vector< Vector<double> > arrange_minimum_maximum(void) method
493 
499 
501 {
502  Vector< Vector<double> > minimums_maximums(2);
503 
504  minimums_maximums[0] = minimums;
505  minimums_maximums[1] = maximums;
506 
507  return(minimums_maximums);
508 }
509 
510 
511 // Vector< Vector<double> > arrange_means_standard_deviations(void) method
512 
517 
519 {
520  Vector< Vector<double> > means_standard_deviations(2);
521 
522  means_standard_deviations[0] = means;
523  means_standard_deviations[1] = standard_deviations;
524 
525  return(means_standard_deviations);
526 }
527 
528 
529 // Vector< Vector<double> > arrange_statistics(void) method
530 
533 
535 {
536  Vector< Vector<double> > statistics(4);
537 
538  statistics[0] = minimums;
539  statistics[1] = minimums;
540  statistics[2] = means;
541  statistics[3] = standard_deviations;
542 
543  return(statistics);
544 }
545 
546 
547 // const ScalingMethod get_scaling_method(void) const method
548 
550 
552 {
553  return(scaling_method);
554 }
555 
556 
557 // std::string write_scaling_method(void) const method
558 
560 
562 {
563  if(scaling_method == NoScaling)
564  {
565  return("NoScaling");
566  }
567  else if(scaling_method == MinimumMaximum)
568  {
569  return("MinimumMaximum");
570  }
571  else if(scaling_method == MeanStandardDeviation)
572  {
573  return("MeanStandardDeviation");
574  }
575  else
576  {
577  std::ostringstream buffer;
578 
579  buffer << "OpenNN Exception: IndependentParameters class.\n"
580  << "std::string write_scaling_method(void) const method.\n"
581  << "Unknown scaling and unscaling method.\n";
582 
583  throw std::logic_error(buffer.str());
584  }
585 }
586 
587 
588 // const Vector<double>& get_lower_bounds(void) const method
589 
592 
594 {
595  return(lower_bounds);
596 }
597 
598 
599 // double get_lower_bound(const size_t&) const method
600 
604 
605 double IndependentParameters::get_lower_bound(const size_t& index) const
606 {
607  // Control sentence (if debug)
608 
609  #ifndef NDEBUG
610 
611  const size_t parameters_number = get_parameters_number();
612 
613  if(index >= parameters_number)
614  {
615  std::ostringstream buffer;
616 
617  buffer << "OpenNN Exception: IndependentParameters class.\n"
618  << "double get_lower_bound(const size_t&) const method.\n"
619  << "Index must be less than number of parameters.\n";
620 
621  throw std::logic_error(buffer.str());
622  }
623 
624  #endif
625 
626  return(lower_bounds[index]);
627 }
628 
629 
630 // const Vector<double>& get_upper_bounds(void) const method
631 
634 
636 {
637  return(upper_bounds);
638 }
639 
640 
641 // double get_upper_bound(const size_t&) const method
642 
646 
647 double IndependentParameters::get_upper_bound(const size_t& index) const
648 {
649  // Control sentence (if debug)
650 
651  #ifndef NDEBUG
652 
653  const size_t parameters_number = get_parameters_number();
654 
655  if(index >= parameters_number)
656  {
657  std::ostringstream buffer;
658 
659  buffer << "OpenNN Exception: IndependentParameters class.\n"
660  << "double get_upper_bound(const size_t&) const method.\n"
661  << "Index must be less than number of parameters.\n";
662 
663  throw std::logic_error(buffer.str());
664  }
665 
666  #endif
667 
668  return(upper_bounds[index]);
669 }
670 
671 
672 // Vector< Vector<double>* > get_bounds(void) method
673 
680 
682 {
683  Vector< Vector<double>* > bounds(2);
684 
685  bounds[0] = &lower_bounds;
686  bounds[1] = &upper_bounds;
687 
688  return(bounds);
689 }
690 
691 
692 // const BoundingMethod get_bounding_method(void) const method
693 
695 
697 {
698  return(bounding_method);
699 }
700 
701 
702 // std::string write_bounding_method(void) const method
703 
705 
707 {
708  if(bounding_method == NoBounding)
709  {
710  return("NoBounding");
711  }
712  else if(bounding_method == Bounding)
713  {
714  return("Bounding");
715  }
716  else
717  {
718  std::ostringstream buffer;
719 
720  buffer << "OpenNN Exception: IndependentParameters class.\n"
721  << "std::string write_bounding_method(void) const method.\n"
722  << "Unknown bounding method.\n";
723 
724  throw std::logic_error(buffer.str());
725  }
726 }
727 
728 
729 // const bool& get_display(void) const method
730 
733 
734 const bool& IndependentParameters::get_display(void) const
735 {
736  return(display);
737 }
738 
739 
740 // void set(void) method
741 
744 
746 {
748 
749  set_default();
750 }
751 
752 
753 // void set(const size_t&) method
754 
758 
759 void IndependentParameters::set(const size_t& new_parameters_number)
760 {
761  set_parameters_number(new_parameters_number);
762 
763  set_default();
764 }
765 
766 
767 // void set(const Vector<double>&) method
768 
772 
773 void IndependentParameters::set(const Vector<double>& new_parameters)
774 {
775  const size_t new_parameters_number = new_parameters.size();
776 
777  set_parameters_number(new_parameters_number);
778 
779  parameters = new_parameters;
780 
781  set_default();
782 }
783 
784 
785 // void set(const IndependentParameters&) method
786 
789 
790 void IndependentParameters::set(const IndependentParameters& other_independent_parameters)
791 {
792  parameters = other_independent_parameters.parameters;
793 
794  names = other_independent_parameters.names;
795 
796  units = other_independent_parameters.units;
797 
798  descriptions = other_independent_parameters.descriptions;
799 
800  minimums = other_independent_parameters.minimums;
801 
802  maximums = other_independent_parameters.maximums;
803 
804  means = other_independent_parameters.means;
805 
806  standard_deviations = other_independent_parameters.standard_deviations;
807 
808  lower_bounds = other_independent_parameters.lower_bounds;
809 
810  upper_bounds = other_independent_parameters.upper_bounds;
811 
812  scaling_method = other_independent_parameters.scaling_method;
813 
814  display_range_warning = other_independent_parameters.display_range_warning;
815 
816  display = other_independent_parameters.display;
817 }
818 
819 
820 // void set_default(void) method
821 
823 
825 {
826  set_scaling_method(MinimumMaximum);
827 
828  set_bounding_method(NoBounding);
829 
830  set_display(true);
831 }
832 
833 
834 // void set_parameters_number(const size_t&) method
835 
838 
839 void IndependentParameters::set_parameters_number(const size_t& new_parameters_number)
840 {
841  parameters.set(new_parameters_number, 0.0);
842 
843  names.set(new_parameters_number);
844 
845  units.set(new_parameters_number);
846 
847  descriptions.set(new_parameters_number);
848 
849  minimums.set(new_parameters_number, -1.0);
850 
851  maximums.set(new_parameters_number, 1.0);
852 
853  means.set(new_parameters_number, 0.0);
854 
855  standard_deviations.set(new_parameters_number, 1.0);
856 
857  lower_bounds.set(new_parameters_number, -1.0e99);
858 
859  upper_bounds.set(new_parameters_number, 1.0e99);
860 }
861 
862 
863 // void set_parameters(const Vector<double>&) method
864 
867 
869 {
870  // Control sentence (if debug)
871 
872  #ifndef NDEBUG
873 
874  const size_t parameters_number = get_parameters_number();
875 
876  if(new_parameters.size() != parameters_number)
877  {
878  std::ostringstream buffer;
879 
880  buffer << "OpenNN Exception: IndependentParameters class.\n"
881  << "void set_parameters(const Vector<double>&) method.\n"
882  << "Parameters size must be equal to number of parameters.\n";
883 
884  throw std::logic_error(buffer.str());
885  }
886 
887  #endif
888 
889  parameters = new_parameters;
890 
892 }
893 
894 
895 // void set_parameter(const size_t&, const double&) method
896 
900 
901 void IndependentParameters::set_parameter(const size_t& index, const double& new_parameter)
902 {
903  // Control sentence (if debug)
904 
905  #ifndef NDEBUG
906 
907  const size_t parameters_number = get_parameters_number();
908 
909  if(index >= parameters_number)
910  {
911  std::ostringstream buffer;
912 
913  buffer << "OpenNN Exception: IndependentParameters class.\n"
914  << "void set_parameter(const size_t&, const double&) method.\n"
915  << "Index must be less than number of parameters.\n";
916 
917  throw std::logic_error(buffer.str());
918  }
919 
920  #endif
921 
922  parameters[index] = new_parameter;
923 
924  bound_parameter(index);
925 }
926 
927 
928 // void set_names(const Vector<std::string>&) method
929 
933 
935 {
936  // Control sentence (if debug)
937 
938  #ifndef NDEBUG
939 
940  const size_t parameters_number = get_parameters_number();
941 
942  if(new_names.size() != parameters_number)
943  {
944  std::ostringstream buffer;
945 
946  buffer << "OpenNN Exception: IndependentParameters class.\n"
947  << "void set_name(const Vector<std::string>&) method.\n"
948  << "Size of names must be equal to number of parameters.\n";
949 
950  throw std::logic_error(buffer.str());
951  }
952 
953  #endif
954 
955  // Set name of independent parameters
956 
957  names = new_names;
958 }
959 
960 
961 // void set_name(const size_t&, const std::string&) method
962 
967 
968 void IndependentParameters::set_name(const size_t& index, const std::string& new_name)
969 {
970  // Control sentence (if debug)
971 
972  const size_t parameters_number = get_parameters_number();
973 
974  #ifndef NDEBUG
975 
976  if(index >= parameters_number)
977  {
978  std::ostringstream buffer;
979 
980  buffer << "OpenNN Exception: IndependentParameters class.\n"
981  << "void set_name(const size_t&, const std::string&) method.\n"
982  << "Index must be less than number of parameters.\n";
983 
984  throw std::logic_error(buffer.str());
985  }
986 
987  #endif
988 
989  if(names.size() != parameters_number)
990  {
991  names.set(parameters_number);
992  }
993 
994  // Set name of single independent parameter
995 
996  names[index] = new_name;
997 }
998 
999 
1000 // void set_units(const Vector<std::string>&)
1001 
1005 
1007 {
1008  // Control sentence (if debug)
1009 
1010  #ifndef NDEBUG
1011 
1012  const size_t parameters_number = get_parameters_number();
1013 
1014  if(new_units.size() != parameters_number)
1015  {
1016  std::ostringstream buffer;
1017 
1018  buffer << "OpenNN Exception: IndependentParameters class.\n"
1019  << "void set_units(const Vector<std::string>&) method.\n"
1020  << "Size must be equal to number of parameters.\n";
1021 
1022  throw std::logic_error(buffer.str());
1023  }
1024 
1025  #endif
1026 
1027  // Set units of independent parameters
1028 
1029  units = new_units;
1030 }
1031 
1032 
1033 // void set_unit(const size_t&, const std::string&) method
1034 
1039 
1040 void IndependentParameters::set_unit(const size_t& index, const std::string& new_unit)
1041 {
1042  const size_t parameters_number = get_parameters_number();
1043 
1044  // Control sentence (if debug)
1045 
1046  #ifndef NDEBUG
1047 
1048  if(index >= parameters_number)
1049  {
1050  std::ostringstream buffer;
1051 
1052  buffer << "OpenNN Exception: IndependentParameters class.\n"
1053  << "void set_unit(const size_t&, const std::string&) method.\n"
1054  << "Index of independent parameter must be less than number of parameters.\n";
1055 
1056  throw std::logic_error(buffer.str());
1057  }
1058 
1059  #endif
1060 
1061  if(units.size() == 0)
1062  {
1063  units.set(parameters_number);
1064  }
1065 
1066  // Set units of single independent parameter
1067 
1068  units[index] = new_unit;
1069 }
1070 
1071 
1072 // void set_descriptions(const Vector<std::string>&) method
1073 
1077 
1079 {
1080  // Control sentence (if debug)
1081 
1082  #ifndef NDEBUG
1083 
1084  const size_t parameters_number = get_parameters_number();
1085 
1086  if(new_descriptions.size() != parameters_number)
1087  {
1088  std::ostringstream buffer;
1089 
1090  buffer << "OpenNN Exception: IndependentParameters class.\n"
1091  << "void set_descriptions(const Vector<std::string>&) method.\n"
1092  << "Size of descriptions must be equal to number of parameters.\n";
1093 
1094  throw std::logic_error(buffer.str());
1095  }
1096 
1097  #endif
1098 
1099  descriptions = new_descriptions;
1100 }
1101 
1102 
1103 // void set_description(const size_t&, const std::string&) method
1104 
1109 
1110 void IndependentParameters::set_description(const size_t& index, const std::string& new_description)
1111 {
1112  const size_t parameters_number = get_parameters_number();
1113 
1114  // Control sentence (if debug)
1115 
1116  #ifndef NDEBUG
1117 
1118  if(index >= parameters_number)
1119  {
1120  std::ostringstream buffer;
1121 
1122  buffer << "OpenNN Exception: IndependentParameters class.\n"
1123  << "void set_description(const size_t&, const std::string&) method.\n"
1124  << "Index must be less than number of parameters.\n";
1125 
1126  throw std::logic_error(buffer.str());
1127  }
1128 
1129  #endif
1130 
1131  if(descriptions.size() == 0)
1132  {
1133  descriptions.set(parameters_number);
1134  }
1135 
1136  // Set description of single independent parameter
1137 
1138  descriptions[index] = new_description;
1139 }
1140 
1141 
1142 // void set_minimum(const Vector<double>&) method
1143 
1147 
1149 {
1150  // Control sentence (if debug)
1151 
1152  #ifndef NDEBUG
1153 
1154  const size_t parameters_number = get_parameters_number();
1155 
1156  if(new_minimums.size() != parameters_number)
1157  {
1158  std::ostringstream buffer;
1159 
1160  buffer << "OpenNN Exception: IndependentParameters class.\n"
1161  << "void set_minimums(const Vector<double>&) method.\n"
1162  << "Size of minimums must be equal to number of parameters.\n";
1163 
1164  throw std::logic_error(buffer.str());
1165  }
1166 
1167  #endif
1168 
1169  // Set minimum of independent parameters
1170 
1171  minimums = new_minimums;
1172 }
1173 
1174 
1175 // void set_minimum(const size_t&, const double&) method
1176 
1181 
1182 void IndependentParameters::set_minimum(const size_t& index, const double& new_minimum)
1183 {
1184  const size_t parameters_number = get_parameters_number();
1185 
1186  // Control sentence (if debug)
1187 
1188  #ifndef NDEBUG
1189 
1190  if(index >= parameters_number)
1191  {
1192  std::ostringstream buffer;
1193 
1194  buffer << "OpenNN Exception: IndependentParameters class.\n"
1195  << "void set_minimum(const size_t&, const double&) method.\n"
1196  << "Index of independent parameter must be less than number of parameters.\n";
1197 
1198  throw std::logic_error(buffer.str());
1199  }
1200 
1201  #endif
1202 
1203  if(minimums.size() != parameters_number)
1204  {
1205  minimums.set(parameters_number, -1.0);
1206  }
1207 
1208  // Set minimum of single independent parameter
1209 
1210  minimums[index] = new_minimum;
1211 }
1212 
1213 
1214 // void set_maximum(const Vector<double>&) method
1215 
1219 
1221 {
1222  // Control sentence (if debug)
1223 
1224  #ifndef NDEBUG
1225 
1226  const size_t parameters_number = get_parameters_number();
1227 
1228  if(new_maximums.size() != parameters_number)
1229  {
1230  std::ostringstream buffer;
1231 
1232  buffer << "OpenNN Exception: IndependentParameters class.\n"
1233  << "void set_maximum(const Vector<double>&) method.\n"
1234  << "Size of maximums must be equal to number of parameters.\n";
1235 
1236  throw std::logic_error(buffer.str());
1237  }
1238 
1239  #endif
1240 
1241  // Set maximum of independent parameters
1242 
1243  maximums = new_maximums;
1244 }
1245 
1246 
1247 // void set_maximum(const size_t&, const double&) method
1248 
1253 
1254 void IndependentParameters::set_maximum(const size_t& index, const double& new_maximum)
1255 {
1256  const size_t parameters_number = get_parameters_number();
1257 
1258  // Control sentence (if debug)
1259 
1260  #ifndef NDEBUG
1261 
1262  if(index >= parameters_number)
1263  {
1264  std::ostringstream buffer;
1265 
1266  buffer << "OpenNN Exception: IndependentParameters class.\n"
1267  << "void set_maximum(const size_t&, const double&) method.\n"
1268  << "Index must be less than number of parameters.\n";
1269 
1270  throw std::logic_error(buffer.str());
1271  }
1272 
1273  #endif
1274 
1275  // Set maximum vector
1276 
1277  if(maximums.size() != parameters_number)
1278  {
1279  maximums.set(parameters_number, 1.0);
1280  }
1281 
1282  // Set maximum of single independent parameter
1283 
1284  maximums[index] = new_maximum;
1285 }
1286 
1287 
1288 // void set_mean(const Vector<double>&) method
1289 
1293 
1295 {
1296  // Control sentence (if debug)
1297 
1298  #ifndef NDEBUG
1299 
1300  const size_t parameters_number = get_parameters_number();
1301 
1302  if(new_means.size() != parameters_number)
1303  {
1304  std::ostringstream buffer;
1305 
1306  buffer << "OpenNN Exception: IndependentParameters class.\n"
1307  << "void set_means(const Vector<double>&) method.\n"
1308  << "Size must be equal to number of parameters.\n";
1309 
1310  throw std::logic_error(buffer.str());
1311  }
1312 
1313  #endif
1314 
1315  // Set mean of independent parameters
1316 
1317  means = new_means;
1318 }
1319 
1320 
1321 // void set_mean(const size_t&, const double&) method
1322 
1327 
1328 void IndependentParameters::set_mean(const size_t& index, const double& new_mean)
1329 {
1330  const size_t parameters_number = get_parameters_number();
1331 
1332  // Control sentence (if debug)
1333 
1334  #ifndef NDEBUG
1335 
1336  if(index >= parameters_number)
1337  {
1338  std::ostringstream buffer;
1339 
1340  buffer << "OpenNN Exception: IndependentParameters class.\n"
1341  << "void set_mean(const size_t&, const double&) method.\n"
1342  << "Index of must be less than number of parameters.\n";
1343 
1344  throw std::logic_error(buffer.str());
1345  }
1346 
1347  #endif
1348 
1349  // Set independent parameters mean vector
1350 
1351  const size_t size = means.size();
1352 
1353  if(size != parameters_number)
1354  {
1355  means.set(parameters_number, 0.0);
1356  }
1357 
1358  // Set mean of single independent parameter
1359 
1360  means[index] = new_mean;
1361 }
1362 
1363 
1364 // void set_standard_deviations(const Vector<double>&) method
1365 
1369 
1371 {
1372  // Control sentence (if debug)
1373 
1374  #ifndef NDEBUG
1375 
1376  const size_t parameters_number = get_parameters_number();
1377 
1378  if(new_standard_deviations.size() != parameters_number)
1379  {
1380  std::ostringstream buffer;
1381 
1382  buffer << "OpenNN Exception: IndependentParameters class.\n"
1383  << "void set_standard_deviations(const Vector<double>&) method.\n"
1384  << "Size must be equal to number of parameters.\n";
1385 
1386  throw std::logic_error(buffer.str());
1387  }
1388 
1389  #endif
1390 
1391  // Set standard deviation of independent parameters
1392 
1393  standard_deviations = new_standard_deviations;
1394 }
1395 
1396 
1397 // void set_standard_deviation(const size_t&, const double&) method
1398 
1403 
1404 void IndependentParameters::set_standard_deviation(const size_t& index, const double& new_standard_deviation)
1405 {
1406  const size_t parameters_number = get_parameters_number();
1407 
1408  // Control sentence (if debug)
1409 
1410  #ifndef NDEBUG
1411 
1412  if(index >= parameters_number)
1413  {
1414  std::ostringstream buffer;
1415 
1416  buffer << "OpenNN Exception: IndependentParameters class.\n"
1417  << "void set_standard_deviation(const size_t&, const double&) method.\n"
1418  << "Index must be less than number of parameters.\n";
1419 
1420  throw std::logic_error(buffer.str());
1421  }
1422 
1423  #endif
1424 
1425  // Set independent parameters standard deviation vector
1426 
1427  const size_t size = standard_deviations.size();
1428 
1429  if(size != parameters_number)
1430  {
1431  standard_deviations.set(parameters_number, 1.0);
1432  }
1433 
1434  // Set standard deviation of single independent parameter
1435 
1436  standard_deviations[index] = new_standard_deviation;
1437 }
1438 
1439 
1440 // void set_minimum_maximum(const Vector< Vector<double> >&) method
1441 
1448 
1450 {
1451  // Control sentence (if debug)
1452 
1453  #ifndef NDEBUG
1454 
1455  const size_t parameters_number = get_parameters_number();
1456 
1457  if(new_minimums_maximums.size() != 2)
1458  {
1459  std::ostringstream buffer;
1460 
1461  buffer << "OpenNN Exception: IndependentParameters class.\n"
1462  << "void set_minimum_maximum(const Vector< Vector<double> >&) method.\n"
1463  << "Number of rows must be 2.\n";
1464 
1465  throw std::logic_error(buffer.str());
1466  }
1467  else if(new_minimums_maximums[0].size() != parameters_number
1468  && new_minimums_maximums[1].size() != parameters_number)
1469  {
1470  std::ostringstream buffer;
1471 
1472  buffer << "OpenNN Exception: IndependentParameters class.\n"
1473  << "void set_minimum_maximum(const Vector< Vector<double> >&) method.\n"
1474  << "Number of columns must be equal to number of parameters.\n";
1475 
1476  throw std::logic_error(buffer.str());
1477  }
1478 
1479  // Check that minimum of independent parameters is not greater than their maximum
1480 
1481  for(size_t i = 0; i < parameters_number; i++)
1482  {
1483  if(new_minimums_maximums[0][i] >= new_minimums_maximums[1][i])
1484  {
1485  std::ostringstream buffer;
1486 
1487  buffer << "OpenNN Exception: IndependentParameters class.\n"
1488  << "void set_minimums_maximums(const Vector< Vector<double> >&) method.\n"
1489  << "Minimum of parameter "<< i << " is equal or greater than maximum of that parameter.\n";
1490 
1491  throw std::logic_error(buffer.str());
1492  }
1493  }
1494 
1495  #endif
1496 
1497  // Set minimum and maximum of independent parameters
1498 
1499  minimums = new_minimums_maximums[0];
1500  maximums = new_minimums_maximums[1];
1501 }
1502 
1503 
1504 // void set_means_standard_deviations(const Vector< Vector<double> >&) method
1505 
1512 
1514 {
1515  // Control sentence (if debug)
1516 
1517  #ifndef NDEBUG
1518 
1519  std::ostringstream buffer;
1520 
1521  const size_t parameters_number = get_parameters_number();
1522 
1523  const size_t size = new_means_standard_deviations.size();
1524 
1525  if(size != 2)
1526  {
1527  buffer << "OpenNN Exception: IndependentParameters class.\n"
1528  << "void set_means_standard_deviations(const Vector< Vector<double> >& ) method.\n"
1529  << "Number of rows must be 2.\n";
1530 
1531  throw std::logic_error(buffer.str());
1532  }
1533  else if(new_means_standard_deviations[0].size() != parameters_number
1534  && new_means_standard_deviations[1].size() != parameters_number)
1535  {
1536  buffer << "OpenNN Exception: IndependentParameters class.\n"
1537  << "void set_means_standard_deviations(const Vector< Vector<double> >& ) method.\n"
1538  << "Number of columns must be equal to number of parameters.\n";
1539 
1540  throw std::logic_error(buffer.str());
1541  }
1542 
1543  // Check that standard deviation of independent parameters is not zero
1544 
1545  if(display)
1546  {
1547  for(size_t i = 0; i < parameters_number; i++)
1548  {
1549  if(new_means_standard_deviations[1][i] < 1.0e-99)
1550  {
1551  std::ostringstream buffer;
1552 
1553  buffer << "OpenNN Exception: IndependentParameters class: \n"
1554  << "void set_means_standard_deviations(const Vector< Vector<double> >& ) method.\n"
1555  << "Standard deviation of independent parameter " << i << " is zero.\n";
1556  }
1557  }
1558  }
1559 
1560  #endif
1561 
1562  // Set mean and standard deviation of independent parameters
1563 
1564  means = new_means_standard_deviations[0];
1565  standard_deviations = new_means_standard_deviations[1];
1566 }
1567 
1568 
1569 // void set_statistics(const Vector< Vector<double> >&) method
1570 
1580 
1582 {
1583  // Control sentence (if debug)
1584 
1585  #ifndef NDEBUG
1586 
1587  if(new_statistics.size() != 4)
1588  {
1589  std::ostringstream buffer;
1590 
1591  buffer << "OpenNN Exception: IndependentParameters class.\n"
1592  << "void set_statistics(const Vector< Vector<double> >&) method.\n"
1593  << "Size must be 6.\n";
1594 
1595  throw std::logic_error(buffer.str());
1596  }
1597 
1598  #endif
1599 
1600  // Set all statistics
1601 
1602  set_minimums(new_statistics[0]);
1603  set_maximums(new_statistics[1]);
1604 
1605  set_means(new_statistics[2]);
1606  set_standard_deviations(new_statistics[3]);
1607 
1608 }
1609 
1610 
1611 // void set_scaling_method(const ScalingMethod&) method
1612 
1615 
1617 (const IndependentParameters::ScalingMethod& new_scaling_method)
1618 {
1619  scaling_method = new_scaling_method;
1620 }
1621 
1622 
1623 // void set_scaling_method(const std::string&) method
1624 
1628 
1629 void IndependentParameters::set_scaling_method(const std::string& new_scaling_method)
1630 {
1631  if(new_scaling_method == "NoScaling")
1632  {
1633  set_scaling_method(NoScaling);
1634  }
1635  else if(new_scaling_method == "MeanStandardDeviation")
1636  {
1637  set_scaling_method(MeanStandardDeviation);
1638  }
1639  else if(new_scaling_method == "MinimumMaximum")
1640  {
1641  set_scaling_method(MinimumMaximum);
1642  }
1643  else
1644  {
1645  std::ostringstream buffer;
1646 
1647  buffer << "OpenNN Exception: IndependentParameters class.\n"
1648  << "void set_scaling_method(const std::string&) method.\n"
1649  << "Unknown independent parameters scaling method: " << new_scaling_method << ".\n";
1650 
1651  throw std::logic_error(buffer.str());
1652  }
1653 }
1654 
1655 
1656 // void set_lower_bound(void) method
1657 
1659 
1661 {
1662  const size_t parameters_number = get_parameters_number();
1663 
1664  lower_bounds.set(parameters_number, 1.0e-99);
1665 }
1666 
1667 
1668 // void set_lower_bound(const Vector<double>&) method
1669 
1673 
1675 {
1676  // Control sentence (if debug)
1677 
1678  #ifndef NDEBUG
1679 
1680  const size_t parameters_number = get_parameters_number();
1681 
1682  if(new_lower_bounds.size() != parameters_number)
1683  {
1684  std::ostringstream buffer;
1685 
1686  buffer << "OpenNN Exception: IndependentParameters class.\n"
1687  << "void set_lower_bounds(const Vector<double>&) method.\n"
1688  << "Size must be equal to number of parameters.\n";
1689 
1690  throw std::logic_error(buffer.str());
1691  }
1692 
1693  #endif
1694 
1695  // Set lower bound of independent parameters
1696 
1697  lower_bounds = new_lower_bounds;
1698 }
1699 
1700 
1701 // void set_lower_bound(const size_t&, const double&) method
1702 
1707 
1708 void IndependentParameters::set_lower_bound(const size_t& index, const double& new_lower_bound)
1709 {
1710  const size_t parameters_number = get_parameters_number();
1711 
1712  // Control sentence (if debug)
1713 
1714  #ifndef NDEBUG
1715 
1716  if(index >= parameters_number)
1717  {
1718  std::ostringstream buffer;
1719 
1720  buffer << "OpenNN Exception: IndependentParameters class.\n"
1721  << "void set_lower_bound(const size_t&, const double&) method.\n"
1722  << "Index must be less than number of parameters.\n";
1723 
1724  throw std::logic_error(buffer.str());
1725  }
1726 
1727  #endif
1728 
1729  // Set lower bound vector
1730 
1731  if(lower_bounds.size() != parameters_number)
1732  {
1733  lower_bounds.set(parameters_number, -1.0e99);
1734  }
1735 
1736  // Set lower bound of single independent parameter
1737 
1738  lower_bounds[index] = new_lower_bound;
1739 }
1740 
1741 
1742 // void set_upper_bounds(void) method
1743 
1745 
1747 {
1748  const size_t parameters_number = get_parameters_number();
1749 
1750  upper_bounds.set(parameters_number, 1.0e99);
1751 }
1752 
1753 
1754 // void set_upper_bound(const Vector<double>&) method
1755 
1760 
1762 {
1763  // Control sentence (if debug)
1764 
1765  #ifndef NDEBUG
1766 
1767  const size_t parameters_number = get_parameters_number();
1768 
1769  if(new_upper_bounds.size() != parameters_number)
1770  {
1771  std::ostringstream buffer;
1772 
1773  buffer << "OpenNN Exception: IndependentParameters class.\n"
1774  << "void set_upper_bound(const Vector<double>&) method.\n"
1775  << "Size of upper bounds must be equal to number of parameters.\n";
1776 
1777  throw std::logic_error(buffer.str());
1778  }
1779 
1780  #endif
1781 
1782  upper_bounds = new_upper_bounds;
1783 }
1784 
1785 
1786 // void set_upper_bound(const size_t&, const double&) method
1787 
1792 
1793 void IndependentParameters::set_upper_bound(const size_t& index, const double& new_upper_bound)
1794 {
1795  // Control sentence (if debug)
1796 
1797  #ifndef NDEBUG
1798 
1799  const size_t parameters_number = get_parameters_number();
1800 
1801  if(index >= parameters_number)
1802  {
1803  std::ostringstream buffer;
1804 
1805  buffer << "OpenNN Exception: IndependentParameters class.\n"
1806  << "void set_upper_bound(const size_t&, const double&) method.\n"
1807  << "Index must be less than number of parameters.\n";
1808 
1809  throw std::logic_error(buffer.str());
1810  }
1811 
1812  #endif
1813 
1814  upper_bounds[index] = new_upper_bound;
1815 }
1816 
1817 
1818 // void set_bounds(void) method
1819 
1821 
1823 {
1824  set_lower_bounds();
1825  set_upper_bounds();
1826 }
1827 
1828 
1829 // void set_bounds(const Vector< Vector<double> >&) method
1830 
1838 
1840 {
1841  // Control sentence (if debug)
1842 
1843  #ifndef NDEBUG
1844 
1845  const size_t parameters_number = get_parameters_number();
1846 
1847  if(new_bounds.size() != 2)
1848  {
1849  std::ostringstream buffer;
1850 
1851  buffer << "OpenNN Exception: IndependentParameters class.\n"
1852  << "void set_bounds(const Vector< Vector<double> >&) method.\n"
1853  << "Number of rows must be 2.\n";
1854 
1855  throw std::logic_error(buffer.str());
1856  }
1857 
1858  if(new_bounds[0].size() != parameters_number && new_bounds[1].size() != parameters_number)
1859  {
1860  std::ostringstream buffer;
1861 
1862  buffer << "OpenNN Exception: IndependentParameters class.\n"
1863  << "void set_bounds(const Vector< Vector<double> >&) method.\n"
1864  << "Number of columns must be equal to number of parameters.\n";
1865 
1866  throw std::logic_error(buffer.str());
1867  }
1868 
1869  #endif
1870 
1871  // Set lower and upper bounds of independent parameters
1872 
1873  lower_bounds = new_bounds[0];
1874  upper_bounds = new_bounds[1];
1875 }
1876 
1877 
1878 // void set_bounding_method(const BoundingMethod&) method
1879 
1882 
1884 (const IndependentParameters::BoundingMethod& new_bounding_method)
1885 {
1886  bounding_method = new_bounding_method;
1887 }
1888 
1889 
1890 // void set_bounding_method(const std::string&) method
1891 
1895 
1896 void IndependentParameters::set_bounding_method(const std::string& new_bounding_method)
1897 {
1898  if(new_bounding_method == "NoBounding")
1899  {
1900  set_bounding_method(NoBounding);
1901  }
1902  else if(new_bounding_method == "Bounding")
1903  {
1904  set_bounding_method(Bounding);
1905  }
1906  else
1907  {
1908  std::ostringstream buffer;
1909 
1910  buffer << "OpenNN Exception: IndependentParameters class.\n"
1911  << "void set_bounding_method(const std::string&) method.\n"
1912  << "Unknown bounding method: " << new_bounding_method << ".\n";
1913 
1914  throw std::logic_error(buffer.str());
1915  }
1916 }
1917 
1918 
1919 // void set_display(const bool&) method
1920 
1925 
1926 void IndependentParameters::set_display(const bool& new_display)
1927 {
1928  display = new_display;
1929 }
1930 
1931 
1932 // bool is_empty(void) const method
1933 
1935 
1937 {
1938  if(parameters.empty())
1939  {
1940  return(true);
1941  }
1942  else
1943  {
1944  return(false);
1945  }
1946 }
1947 
1948 
1949 // void initialize_parameters(const double&) method
1950 
1953 
1955 {
1956  parameters.initialize(value);
1957 
1958  bound_parameters();
1959 }
1960 
1961 
1962 // void randomize_parameters_uniform(void) method
1963 
1965 
1967 {
1969 
1970  bound_parameters();
1971 }
1972 
1973 
1974 // void randomize_parameters_uniform(const double&, const double&) method
1975 
1979 
1980 void IndependentParameters::randomize_parameters_uniform(const double& minimum, const double& maximum)
1981 {
1982  parameters.randomize_uniform(minimum, maximum);
1983 
1984  bound_parameters();
1985 }
1986 
1987 
1988 // void randomize_parameters_uniform(const Vector<double>&, const Vector<double>&) method
1989 
1994 
1996 {
1997  parameters.randomize_uniform(minimum, maximum);
1998 
1999  bound_parameters();
2000 }
2001 
2002 
2003 // void randomize_parameters_uniform(const Vector< Vector<double> >&) method
2004 
2011 
2013 {
2014  parameters.randomize_uniform(minimum_maximum[0], minimum_maximum[1]);
2015 
2016  bound_parameters();
2017 }
2018 
2019 
2020 // void randomize_parameters_normal(void) method
2021 
2024 
2026 {
2028 
2029  bound_parameters();
2030 }
2031 
2032 
2033 // void randomize_parameters_normal(const double&, const double&) method
2034 
2039 
2040 void IndependentParameters::randomize_parameters_normal(const double& mean, const double& standard_deviation)
2041 {
2042  parameters.randomize_normal(mean, standard_deviation);
2043 
2044  bound_parameters();
2045 }
2046 
2047 
2048 // void randomize_parameters_normal(const Vector<double>&, const Vector<double>&) method
2049 
2054 
2056 {
2057  parameters.randomize_normal(mean, standard_deviation);
2058 
2059  bound_parameters();
2060 
2061 }
2062 
2063 
2064 // void randomize_parameters_normal(const Vector< Vector<double> >&) method
2065 
2072 
2074 {
2075  parameters.randomize_normal(mean_standard_deviation[0], mean_standard_deviation[1]);
2076 
2077  bound_parameters();
2078 }
2079 
2080 
2081 // void initialize_random(void) method
2082 
2085 
2087 {
2088  const size_t parameters_number = rand()%10 + 1;
2089 
2090  set(parameters_number);
2091 
2093 
2094  minimums.set(parameters_number);
2096 
2097  maximums.set(parameters_number);
2099 
2100  means.set(parameters_number);
2102 
2103  standard_deviations.set(parameters_number);
2105 
2106  switch(rand()%3)
2107  {
2108  case 0:
2109  {
2110  set_scaling_method(NoScaling);
2111  }
2112  break;
2113 
2114  case 1:
2115  {
2116  set_scaling_method(MinimumMaximum);
2117  }
2118  break;
2119 
2120  case 2:
2121  {
2122  set_scaling_method(MeanStandardDeviation);
2123  }
2124  break;
2125  }
2126 
2127  lower_bounds.set(parameters_number);
2128  lower_bounds.randomize_uniform(-1.0, 0.0);
2129 
2130  upper_bounds.set(parameters_number);
2131  upper_bounds.randomize_uniform(0.0, 1.0);
2132 
2133  if(rand()%2)
2134  {
2135  set_bounding_method(NoBounding);
2136  }
2137  else
2138  {
2139  set_bounding_method(Bounding);
2140  }
2141 
2142  if(rand()%2)
2143  {
2144  set_display(false);
2145  }
2146  else
2147  {
2148  set_display(true);
2149  }
2150 
2151  bound_parameters();
2152 }
2153 
2154 
2155 // Vector<double> calculate_scaled_parameters(void) const method
2156 
2159 
2161 {
2162  const size_t parameters_number = get_parameters_number();
2163 
2164  switch(scaling_method)
2165  {
2166  case NoScaling:
2167  {
2168  return(parameters);
2169  }
2170  break;
2171 
2172  case MinimumMaximum:
2173  {
2174  Vector<double> scaled_parameters(parameters_number);
2175 
2176  for(size_t i = 0; i < parameters_number; i++)
2177  {
2178  if(maximums[i] - minimums[i] < 1.0e-99)
2179  {
2180  if(display)
2181  {
2182  std::cout << "OpenNN Warning: IndependentParameters class.\n"
2183  << "Vector<double> calculate_scaled_parameters(void) const method.\n"
2184  << "Maximum and minimum of parameter " << i << " are equal.\n"
2185  << "That parameter won't be scaled.\n";
2186  }
2187 
2188  scaled_parameters[i] = parameters[i];
2189  }
2190  else
2191  {
2192  scaled_parameters[i] = 2.0*(parameters[i] - minimums[i])/(maximums[i] - minimums[i])-1.0;
2193  }
2194  }
2195 
2196  return(scaled_parameters);
2197  }
2198  break;
2199 
2200  case MeanStandardDeviation:
2201  {
2202  Vector<double> scaled_parameters(parameters_number);
2203 
2204  for(size_t i = 0; i < parameters_number; i++)
2205  {
2206  if(standard_deviations[i] < 1.0e-99)
2207  {
2208  if(display)
2209  {
2210  std::cout << "OpenNN Warning: IndependentParameters class.\n"
2211  << "Vector<double> calculate_scaled_parameters(void) method.\n"
2212  << "Standard deviation of parameter " << i << " is zero.\n"
2213  << "That won't be unscaled.\n";
2214  }
2215 
2216  scaled_parameters[i] = parameters[i];
2217  }
2218  else
2219  {
2220  scaled_parameters[i] = (parameters[i] - means[i])/standard_deviations[i];
2221  }
2222  }
2223 
2224  return(scaled_parameters);
2225  }
2226  break;
2227 
2228  default:
2229  {
2230  std::ostringstream buffer;
2231 
2232  buffer << "OpenNN Exception: IndependentParameters class\n"
2233  << "Vector<double> calculate_scaled_parameters(void) method.\n"
2234  << "Unknown independent parameters scaling and unscaling method.\n";
2235 
2236  throw std::logic_error(buffer.str());
2237  }
2238  break;
2239  }// end switch
2240 }
2241 
2242 
2243 // void unscale_parameters(void) method
2244 
2247 
2249 {
2250  const size_t parameters_number = get_parameters_number();
2251 
2252  switch(scaling_method)
2253  {
2254  case NoScaling:
2255  {
2256  // Do nothing
2257  }
2258  break;
2259 
2260  case MeanStandardDeviation:
2261  {
2262  for(size_t i = 0; i < parameters_number; i++)
2263  {
2264  if(standard_deviations[i] < 1e-99)
2265  {
2266  if(display)
2267  {
2268  std::cout << "OpenNN Warning: IndependentParameters class\n"
2269  << "void unscale_parameters(void) method.\n"
2270  << "Standard deviation of parameter " << i << " is zero.\n"
2271  << "That parameter won't be scaled.\n";
2272  }
2273 
2274  parameters[i] = scaled_parameters[i];
2275  }
2276  else
2277  {
2278  parameters[i] = means[i] + scaled_parameters[i]*standard_deviations[i];
2279  }
2280  }
2281  }
2282  break;
2283 
2284  case MinimumMaximum:
2285  {
2286  for(size_t i = 0; i < parameters_number; i++)
2287  {
2288  if(maximums[i] - minimums[i] < 1e-99)
2289  {
2290  if(display)
2291  {
2292  std::cout << "OpenNN Warning: IndependentParameters class\n"
2293  << "void unscale_parameters(void) method.\n"
2294  << "Maximum and minimum of parameter " << i << " are equal.\n"
2295  << "That parameter won't be scaled.\n";
2296  }
2297 
2298  parameters[i] = scaled_parameters[i];
2299  }
2300  else
2301  {
2302  parameters[i] = 0.5*(scaled_parameters[i] + 1.0)*(maximums[i]-minimums[i]) + minimums[i];
2303  }
2304  }
2305  }
2306  break;
2307 
2308  default:
2309  {
2310  std::ostringstream buffer;
2311 
2312  buffer << "OpenNN Exception: IndependentParameters class\n"
2313  << "void unscale_parameters(void) method.\n"
2314  << "Unknown scaling and unscaling method.\n";
2315 
2316  throw std::logic_error(buffer.str());
2317  }
2318  break;
2319  }// end switch
2320 
2321  bound_parameters();
2322 }
2323 
2324 
2325 // void bound_parameters(void) const method
2326 
2328 
2330 {
2331  const size_t parameters_number = get_parameters_number();
2332 
2333  const size_t lower_bounds_size = lower_bounds.size();
2334  const size_t upper_bounds_size = upper_bounds.size();
2335 
2336  if(lower_bounds_size == parameters_number && upper_bounds_size == parameters_number)
2337  {
2339  }
2340  else if(lower_bounds_size == parameters_number)
2341  {
2343  }
2344  else if(upper_bounds_size == parameters_number)
2345  {
2347  }
2348 }
2349 
2350 
2351 // void bound_parameter(const size_t&) method
2352 
2355 
2357 {
2358  if(lower_bounds != 0 && upper_bounds != 0)
2359  {
2360  if(parameters[index] < lower_bounds[index])
2361  {
2362  parameters[index] = lower_bounds[index];
2363  }
2364  else if(parameters[index] > upper_bounds[index])
2365  {
2366  parameters[index] = upper_bounds[index];
2367  }
2368  }
2369  else if(lower_bounds != 0)
2370  {
2371  if(parameters[index] < lower_bounds[index])
2372  {
2373  parameters[index] = lower_bounds[index];
2374  }
2375  }
2376  else if(upper_bounds != 0)
2377  {
2378  if(parameters[index] > upper_bounds[index])
2379  {
2380  parameters[index] = upper_bounds[index];
2381  }
2382  }
2383 }
2384 
2385 
2386 // std::string to_string(void) const method
2387 
2389 
2390 std::string IndependentParameters::to_string(void) const
2391 {
2392  std::ostringstream buffer;
2393 
2394  buffer << "Independent parameters\n"
2395  << "Parameters: " << parameters << "\n"
2396  << "Names: " << names << "\n"
2397  << "Units: " << units << "\n"
2398  << "Descriptions: " << descriptions << "\n"
2399  << "Minimums: " << minimums << "\n"
2400  << "Maximums: " << maximums << "\n"
2401  << "Means: " << means << "\n"
2402  << "Standard deviations: " << standard_deviations << "\n"
2403  << "Lower bounds: " << lower_bounds << "\n"
2404  << "Upper bounds: " << upper_bounds << "\n"
2405  << "Scaling method: " << scaling_method << "\n"
2406  << "Bounding method: " << bounding_method << "\n"
2407  << "Display range warning: " << display_range_warning << "\n"
2408  << "Display: " << display << "\n";
2409 
2410  return(buffer.str());
2411 }
2412 
2413 
2414 // tinyxml2::XMLDocument* to_XML(void) const method
2415 
2418 
2419 tinyxml2::XMLDocument* IndependentParameters::to_XML(void) const
2420 {
2421  std::ostringstream buffer;
2422 
2423  tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument;
2424 
2425  tinyxml2::XMLElement* independent_parameters_element = document->NewElement("IndependentParameters");
2426 
2427  document->InsertFirstChild(independent_parameters_element);
2428 
2429  const size_t parameters_number = get_parameters_number();
2430 
2431  // Parameters
2432 
2433  tinyxml2::XMLElement* parameters_element = document->NewElement("Parameters");
2434  independent_parameters_element->LinkEndChild(parameters_element);
2435 
2436  buffer.str("");
2437  buffer << parameters;
2438 
2439  tinyxml2::XMLText* parameters_text = document->NewText(buffer.str().c_str());
2440  parameters_element->LinkEndChild(parameters_text);
2441 
2442  // Names
2443  {
2444  tinyxml2::XMLElement* names_element = document->NewElement("Names");
2445  independent_parameters_element->LinkEndChild(names_element);
2446 
2447  Vector<tinyxml2::XMLElement*> elements(parameters_number);
2448  Vector<tinyxml2::XMLText*> texts(parameters_number);
2449 
2450  for(size_t i = 0; i < parameters_number; i++)
2451  {
2452  elements[i] = document->NewElement("Name");
2453  elements[i]->SetAttribute("Index", (unsigned)i+1);
2454  names_element->LinkEndChild(elements[i]);
2455 
2456  texts[i] = document->NewText(names[i].c_str());
2457  elements[i]->LinkEndChild(texts[i]);
2458  }
2459  }
2460 
2461  // Units
2462 
2463  {
2464  tinyxml2::XMLElement* units_element = document->NewElement("Units");
2465  independent_parameters_element->LinkEndChild(units_element);
2466 
2467  Vector<tinyxml2::XMLElement*> elements(parameters_number);
2468  Vector<tinyxml2::XMLText*> texts(parameters_number);
2469 
2470  for(size_t i = 0; i < parameters_number; i++)
2471  {
2472  elements[i] = document->NewElement("Unit");
2473  elements[i]->SetAttribute("Index", (unsigned)i+1);
2474  units_element->LinkEndChild(elements[i]);
2475 
2476  texts[i] = document->NewText(units[i].c_str());
2477  elements[i]->LinkEndChild(texts[i]);
2478  }
2479  }
2480 
2481  // Descriptions
2482  {
2483  tinyxml2::XMLElement* descriptions_element = document->NewElement("Descriptions");
2484  independent_parameters_element->LinkEndChild(descriptions_element);
2485 
2486  Vector<tinyxml2::XMLElement*> elements(parameters_number);
2487  Vector<tinyxml2::XMLText*> texts(parameters_number);
2488 
2489  for(size_t i = 0; i < parameters_number; i++)
2490  {
2491  elements[i] = document->NewElement("Description");
2492  elements[i]->SetAttribute("Index", (unsigned)i+1);
2493  descriptions_element->LinkEndChild(elements[i]);
2494 
2495  texts[i] = document->NewText(descriptions[i].c_str());
2496  elements[i]->LinkEndChild(texts[i]);
2497  }
2498  }
2499 
2500  // Minimums
2501  {
2502  tinyxml2::XMLElement* element = document->NewElement("Minimums");
2503  independent_parameters_element->LinkEndChild(element);
2504 
2505  buffer.str("");
2506  buffer << minimums;
2507 
2508  tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
2509  element->LinkEndChild(text);
2510  }
2511 
2512  // Maximums
2513 
2514  {
2515  tinyxml2::XMLElement* element = document->NewElement("Maximums");
2516  independent_parameters_element->LinkEndChild(element);
2517 
2518  buffer.str("");
2519  buffer << maximums;
2520 
2521  tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
2522  element->LinkEndChild(text);
2523  }
2524 
2525  // Means
2526  {
2527  tinyxml2::XMLElement* element = document->NewElement("Means");
2528  independent_parameters_element->LinkEndChild(element);
2529 
2530  buffer.str("");
2531  buffer << means;
2532 
2533  tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
2534  element->LinkEndChild(text);
2535  }
2536 
2537  // Standard deviations
2538 
2539  {
2540  tinyxml2::XMLElement* element = document->NewElement("StandardDeviations");
2541  independent_parameters_element->LinkEndChild(element);
2542 
2543  buffer.str("");
2544  buffer << standard_deviations;
2545 
2546  tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
2547  element->LinkEndChild(text);
2548  }
2549 
2550  // Lower bounds
2551  {
2552  tinyxml2::XMLElement* element = document->NewElement("LowerBounds");
2553  independent_parameters_element->LinkEndChild(element);
2554 
2555  buffer.str("");
2556  buffer << lower_bounds;
2557 
2558  tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
2559  element->LinkEndChild(text);
2560  }
2561 
2562  // Upper bounds
2563  {
2564  tinyxml2::XMLElement* element = document->NewElement("UpperBounds");
2565  independent_parameters_element->LinkEndChild(element);
2566 
2567  buffer.str("");
2568  buffer << upper_bounds;
2569 
2570  tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
2571  element->LinkEndChild(text);
2572  }
2573 
2574  // Scaling method
2575  {
2576  tinyxml2::XMLElement* element = document->NewElement("ScalingMethod");
2577  independent_parameters_element->LinkEndChild(element);
2578 
2579  tinyxml2::XMLText* text = document->NewText(write_scaling_method().c_str());
2580  element->LinkEndChild(text);
2581  }
2582 
2583  // Bounding method
2584 
2585  {
2586  tinyxml2::XMLElement* element = document->NewElement("BoundingMethod");
2587  independent_parameters_element->LinkEndChild(element);
2588 
2589  tinyxml2::XMLText* text = document->NewText(write_bounding_method().c_str());
2590  element->LinkEndChild(text);
2591  }
2592 
2593  // Display range warning
2594  {
2595  tinyxml2::XMLElement* element = document->NewElement("DisplayRangeWarning");
2596  independent_parameters_element->LinkEndChild(element);
2597 
2598  buffer.str("");
2599  buffer << display_range_warning;
2600 
2601  tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
2602  element->LinkEndChild(text);
2603  }
2604 
2605  // Display
2606  {
2607  tinyxml2::XMLElement* display_element = document->NewElement("Display");
2608  independent_parameters_element->LinkEndChild(display_element);
2609 
2610  buffer.str("");
2611  buffer << display;
2612 
2613  tinyxml2::XMLText* display_text = document->NewText(buffer.str().c_str());
2614  display_element->LinkEndChild(display_text);
2615  }
2616 
2617  return(document);
2618 }
2619 
2620 
2621 // void from_XML(const tinyxml2::XMLDocument&) method
2622 
2625 
2626 void IndependentParameters::from_XML(const tinyxml2::XMLDocument& document)
2627 {
2628  int index = 0; // size_t does not work
2629 
2630  size_t parameters_number = get_parameters_number();
2631 
2632  // Parameters
2633  {
2634  const tinyxml2::XMLElement* parameters_element = document.FirstChildElement("Parameters");
2635 
2636  if(parameters_element)
2637  {
2638  }
2639 
2640  set(parameters);
2641 
2642  parameters_number = get_parameters_number();
2643  }
2644 
2645  // Names
2646  {
2647  const tinyxml2::XMLElement* names_element = document.FirstChildElement("Names");
2648 
2649  if(names_element)
2650  {
2651  Vector<std::string> new_names(parameters_number);
2652 
2653  const tinyxml2::XMLElement* name_element = names_element->FirstChildElement("Name");
2654 
2655  if(name_element)
2656  {
2657  name_element->QueryIntAttribute("Index", &index);
2658 
2659  if(name_element->GetText())
2660  {
2661  new_names[index-1] = name_element->GetText();
2662  }
2663 
2664  for( ; name_element; name_element=name_element->NextSiblingElement())
2665  {
2666  name_element->QueryIntAttribute("Index", &index);
2667 
2668  if(name_element->GetText())
2669  {
2670  new_names[index-1] = name_element->GetText();
2671  }
2672  }
2673  }
2674 
2675  try
2676  {
2677  set_names(new_names);
2678  }
2679  catch(const std::logic_error& e)
2680  {
2681  std::cout << e.what() << std::endl;
2682  }
2683  }
2684  }
2685 
2686  // Units
2687  {
2688  const tinyxml2::XMLElement* units_element = document.FirstChildElement("VariablesUnits");
2689 
2690  if(units_element)
2691  {
2692  Vector<std::string> new_units(parameters_number);
2693 
2694  const tinyxml2::XMLElement* variable_units_element = units_element->FirstChildElement("VariableUnits");
2695 
2696  if(variable_units_element)
2697  {
2698  variable_units_element->QueryIntAttribute("Index", &index);
2699 
2700  if(variable_units_element->GetText())
2701  {
2702  new_units[index-1] = variable_units_element->GetText();
2703  }
2704 
2705  for( ; variable_units_element; variable_units_element=variable_units_element->NextSiblingElement())
2706  {
2707  variable_units_element->QueryIntAttribute("Index", &index);
2708 
2709  if(variable_units_element->GetText())
2710  {
2711  new_units[index-1] = variable_units_element->GetText();
2712  }
2713  }
2714  }
2715 
2716  try
2717  {
2718  set_units(new_units);
2719  }
2720  catch(const std::logic_error& e)
2721  {
2722  std::cout << e.what() << std::endl;
2723  }
2724  }
2725  }
2726 
2727  // Descriptions
2728  {
2729  const tinyxml2::XMLElement* descriptions_element = document.FirstChildElement("Descriptions");
2730 
2731  if(descriptions_element)
2732  {
2733  Vector<std::string> new_descriptions(parameters_number);
2734 
2735  const tinyxml2::XMLElement* variable_description_element = descriptions_element->FirstChildElement("Description");
2736 
2737  if(variable_description_element)
2738  {
2739  variable_description_element->QueryIntAttribute("Index", &index);
2740 
2741  if(variable_description_element->GetText())
2742  {
2743  new_descriptions[index-1] = variable_description_element->GetText();
2744  }
2745 
2746  for( ; variable_description_element; variable_description_element=variable_description_element->NextSiblingElement())
2747  {
2748  variable_description_element->QueryIntAttribute("Index", &index);
2749 
2750  if(variable_description_element->GetText())
2751  {
2752  new_descriptions[index-1] = variable_description_element->GetText();
2753  }
2754  }
2755  }
2756 
2757  try
2758  {
2759  set_descriptions(new_descriptions);
2760  }
2761  catch(const std::logic_error& e)
2762  {
2763  std::cout << e.what() << std::endl;
2764  }
2765  }
2766  }
2767 
2768  // Minimums
2769  {
2770  const tinyxml2::XMLElement* minimums_element = document.FirstChildElement("Minimums");
2771 
2772  if(minimums_element)
2773  {
2774  const char* minimums_text = minimums_element->GetText();
2775 
2776  if(minimums_text)
2777  {
2778  Vector<double> new_minimums;
2779  new_minimums.parse(minimums_text);
2780 
2781  try
2782  {
2783  set_minimums(new_minimums);
2784  }
2785  catch(const std::logic_error& e)
2786  {
2787  std::cout << e.what() << std::endl;
2788  }
2789  }
2790  }
2791  }
2792 
2793  // Maximums
2794  {
2795  const tinyxml2::XMLElement* maximums_element = document.FirstChildElement("Maximums");
2796 
2797  if(maximums_element)
2798  {
2799  const char* maximums_text = maximums_element->GetText();
2800 
2801  if(maximums_text)
2802  {
2803  Vector<double> new_maximums;
2804  new_maximums.parse(maximums_text);
2805 
2806  try
2807  {
2808  set_maximums(new_maximums);
2809  }
2810  catch(const std::logic_error& e)
2811  {
2812  std::cout << e.what() << std::endl;
2813  }
2814  }
2815  }
2816  }
2817 
2818  // Means
2819  {
2820  const tinyxml2::XMLElement* means_element = document.FirstChildElement("Means");
2821 
2822  if(means_element)
2823  {
2824  const char* means_text = means_element->GetText();
2825 
2826  if(means_text)
2827  {
2828  Vector<double> new_means;
2829  new_means.parse(means_text);
2830 
2831  try
2832  {
2833  set_means(new_means);
2834  }
2835  catch(const std::logic_error& e)
2836  {
2837  std::cout << e.what() << std::endl;
2838  }
2839  }
2840  }
2841  }
2842 
2843  // Standard deviations
2844  {
2845  const tinyxml2::XMLElement* standard_deviations_element = document.FirstChildElement("StandardDeviations");
2846 
2847  if(standard_deviations_element)
2848  {
2849  const char* standard_deviations_text = standard_deviations_element->GetText();
2850 
2851  if(standard_deviations_text)
2852  {
2853  Vector<double> new_standard_deviations;
2854  new_standard_deviations.parse(standard_deviations_text);
2855 
2856  try
2857  {
2858  set_standard_deviations(new_standard_deviations);
2859  }
2860  catch(const std::logic_error& e)
2861  {
2862  std::cout << e.what() << std::endl;
2863  }
2864  }
2865  }
2866  }
2867 
2868  // Lower bounds
2869  {
2870  const tinyxml2::XMLElement* lower_bounds_element = document.FirstChildElement("LowerBounds");
2871 
2872  if(lower_bounds_element)
2873  {
2874  const char* lower_bounds_text = lower_bounds_element->GetText();
2875 
2876  if(lower_bounds_text)
2877  {
2878  Vector<double> new_lower_bounds;
2879  new_lower_bounds.parse(lower_bounds_text);
2880 
2881  try
2882  {
2883  set_lower_bounds(new_lower_bounds);
2884  }
2885  catch(const std::logic_error& e)
2886  {
2887  std::cout << e.what() << std::endl;
2888  }
2889  }
2890  }
2891  }
2892 
2893  // Upper bounds
2894  {
2895  const tinyxml2::XMLElement* upper_bounds_element = document.FirstChildElement("UpperBounds");
2896 
2897  if(upper_bounds_element)
2898  {
2899  const char* upper_bounds_text = upper_bounds_element->GetText();
2900 
2901  if(upper_bounds_text)
2902  {
2903  Vector<double> new_upper_bounds;
2904  new_upper_bounds.parse(upper_bounds_text);
2905 
2906  try
2907  {
2908  set_upper_bounds(new_upper_bounds);
2909  }
2910  catch(const std::logic_error& e)
2911  {
2912  std::cout << e.what() << std::endl;
2913  }
2914  }
2915  }
2916  }
2917 
2918  // Display warnings
2919  {
2920  const tinyxml2::XMLElement* display_element = document.FirstChildElement("Display");
2921 
2922  if(display_element)
2923  {
2924  const std::string new_display_string = display_element->GetText();
2925 
2926  try
2927  {
2928  set_display(new_display_string != "0");
2929  }
2930  catch(const std::logic_error& e)
2931  {
2932  std::cout << e.what() << std::endl;
2933  }
2934  }
2935  }
2936 }
2937 
2938 }
2939 
2940 // OpenNN: Open Neural Networks Library.
2941 // Copyright (c) 2005-2015 Roberto Lopez.
2942 //
2943 // This library is free software; you can redistribute it and/or
2944 // modify it under the terms of the GNU Lesser General Public
2945 // License as published by the Free Software Foundation; either
2946 // version 2.1 of the License, or any later version.
2947 //
2948 // This library is distributed in the hope that it will be useful,
2949 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2950 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2951 // Lesser General Public License for more details.
2952 
2953 // You should have received a copy of the GNU Lesser General Public
2954 // License along with this library; if not, write to the Free Software
2955 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
void parse(const std::string &)
Definition: vector.h:5217
double get_maximum(const size_t &) const
void set_means_standard_deviations(const Vector< Vector< double > > &)
void randomize_uniform(const double &=-1.0, const double &=1.0)
Definition: vector.h:781
void set_means(const Vector< double > &)
const std::string & get_description(const size_t &) const
const Vector< double > & get_lower_bounds(void) const
const bool & get_display(void) const
const ScalingMethod & get_scaling_method(void) const
Returns the method used for scaling and unscaling the independent parameters.
Vector< std::string > units
Units of independent parameters.
void set_minimums_maximums(const Vector< Vector< double > > &)
void initialize(const T &)
Definition: vector.h:753
ScalingMethod
Enumeration of available methods for scaling and unscaling the independent parameters.
double get_upper_bound(const size_t &) const
void set_maximum(const size_t &, const double &)
void from_XML(const tinyxml2::XMLDocument &)
size_t get_parameters_number(void) const
Vector< double > means
Mean of independent parameters.
bool display
Display messages to screen.
void set_units(const Vector< std::string > &)
const Vector< double > & get_parameters(void) const
Returns the values of the independent parameters.
void set_scaling_method(const ScalingMethod &)
const Vector< double > & get_maximums(void) const
Vector< double > minimums
Minimum of independent parameters.
void set(void)
Sets the size of a vector to zero.
Definition: vector.h:656
Vector< Vector< double > * > get_bounds(void)
bool display_range_warning
Display warnings when the the independent parameters fall outside their minimum-maximum range...
void set_lower_bound(const size_t &, const double &)
Vector< double > standard_deviations
Standard deviation of independent parameters.
Vector< Vector< std::string > > arrange_information(void)
Vector< double > upper_bounds
Upper bound of independent parameters.
virtual void set_default(void)
Sets the members of this object to their default values.
const Vector< std::string > & get_names(void) const
BoundingMethod
Enumeration of available methods for bounding the independent parameters.
void set_upper_bounds(void)
Sets the vector of upper bounds for the independent parameters to have size zero. ...
void set_descriptions(const Vector< std::string > &)
void set_bounding_method(const BoundingMethod &)
std::string write_scaling_method(void) const
Returns a string with the method used for scaling and unscaling the independent parameters.
void set_standard_deviation(const size_t &, const double &)
void apply_lower_bound(const T &)
Definition: vector.h:3194
void set_unit(const size_t &, const std::string &)
double get_lower_bound(const size_t &) const
void unscale_parameters(const Vector< double > &)
const std::string & get_unit(const size_t &) const
tinyxml2::XMLDocument * to_XML(void) const
double get_minimum(const size_t &) const
Vector< double > maximums
Maximum of independent parameters.
void set_minimum(const size_t &, const double &)
const Vector< std::string > & get_units(void) const
const Vector< double > & get_means(void) const
const BoundingMethod & get_bounding_method(void) const
Returns the method used for bounding the independent parameters.
void set_minimums(const Vector< double > &)
Vector< Vector< double > > arrange_means_standard_deviations(void)
void set_upper_bound(const size_t &, const double &)
std::string write_bounding_method(void) const
Returns a string with the method used for bounding the independent parameters.
void set_bounds(void)
Sets the vectors of lower and upper bounds for the independent parameters to have size zero...
void randomize_parameters_uniform(void)
Initializes the independent parameters with values comprised between -1 and +1.
double get_parameter(const size_t &) const
void set_parameters(const Vector< double > &)
bool is_empty(void) const
Returns true if the number of parameters is zero, and false otherwise.
void set_name(const size_t &, const std::string &)
const Vector< double > & get_standard_deviations(void) const
BoundingMethod bounding_method
Independent parameters bounding method.
void set_statistics(const Vector< Vector< double > > &)
Vector< Vector< double > > arrange_statistics(void)
void set_maximums(const Vector< double > &)
double get_mean(const size_t &) const
void randomize_normal(const double &=0.0, const double &=1.0)
Definition: vector.h:867
void set_parameter(const size_t &, const double &)
void set_names(const Vector< std::string > &)
void set_mean(const size_t &, const double &)
Vector< double > parameters
Independent parameters.
const std::string & get_name(const size_t &) const
std::string to_string(void) const
Returns a string representation of the current independent parameters object.
void apply_upper_bound(const T &)
Definition: vector.h:3234
ScalingMethod scaling_method
Independent parameters scaling and unscaling method.
Vector< Vector< double > > arrange_minimums_maximums(void)
Vector< double > lower_bounds
Lower bound of independent parameters.
void set_lower_bounds(void)
Sets the lower bound of the independent parameters to an empty vector.
Vector< std::string > descriptions
Description of independent parameters.
bool operator==(const IndependentParameters &) const
Vector< double > calculate_scaled_parameters(void) const
double get_standard_deviation(const size_t &) const
void bound_parameters(void)
Makes the independent parameters to fall in the range defined by their lower and the upper bounds...
const Vector< std::string > & get_descriptions(void) const
const Vector< double > & get_upper_bounds(void) const
Vector< std::string > names
Name of independent parameters.
void apply_lower_upper_bounds(const T &, const T &)
Definition: vector.h:3276
void set_description(const size_t &, const std::string &)
const Vector< double > & get_minimums(void) const
void set_standard_deviations(const Vector< double > &)
IndependentParameters & operator=(const IndependentParameters &)