OpenNN  2.2
Open Neural Networks Library
probabilistic_layer.cpp
1 /****************************************************************************************************************/
2 /* */
3 /* OpenNN: Open Neural Networks Library */
4 /* www.artelnics.com/opennn */
5 /* */
6 /* P R O B A B I L I S T I C L A Y E R 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 "probabilistic_layer.h"
17 
18 namespace OpenNN
19 {
20 
21 // DEFAULT CONSTRUCTOR
22 
25 
27 {
28  set();
29 }
30 
31 
32 // PROBABILISTIC NEURONS NUMBER CONSTRUCTOR
33 
37 
38 ProbabilisticLayer::ProbabilisticLayer(const size_t& new_probabilistic_neurons_number)
39 {
40  set(new_probabilistic_neurons_number);
41 }
42 
43 
44 // COPY CONSTRUCTOR
45 
49 
51 {
52  set(other_probabilistic_layer);
53 }
54 
55 
56 // DESTRUCTOR
57 
60 
62 {
63 }
64 
65 
66 // ASSIGNMENT OPERATOR
67 
71 
73 {
74  if(this != &other_probabilistic_layer)
75  {
77 
78  probabilistic_method = other_probabilistic_layer.probabilistic_method;
79 
80  display = other_probabilistic_layer.display;
81  }
82 
83  return(*this);
84 }
85 
86 
87 // EQUAL TO OPERATOR
88 
89 // bool operator == (const ProbabilisticLayer&) const method
90 
95 
96 bool ProbabilisticLayer::operator == (const ProbabilisticLayer& other_probabilistic_layer) const
97 {
98  if(probabilistic_neurons_number == other_probabilistic_layer.probabilistic_neurons_number
99  && probabilistic_method == other_probabilistic_layer.probabilistic_method
100  && display == other_probabilistic_layer.display)
101  {
102  return(true);
103  }
104  else
105  {
106  return(false);
107  }
108 }
109 
110 
111 // METHODS
112 
113 // const size_t& get_outputs_number(void) const method
114 
116 
118 {
120 }
121 
122 
123 // const ProbabilisticMethod& get_probabilistic_method(void) const method
124 
127 
129 {
130  return(probabilistic_method);
131 }
132 
133 
134 // std::string write_probabilistic_method(void) const method
135 
138 
140 {
141  if(probabilistic_method == Competitive)
142  {
143  return("Competitive");
144  }
145  else if(probabilistic_method == Softmax)
146  {
147  return("Softmax");
148  }
149  else if(probabilistic_method == NoProbabilistic)
150  {
151  return("NoProbabilistic");
152  }
153  else
154  {
155  std::ostringstream buffer;
156 
157  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
158  << "std::string write_probabilistic_method(void) const method.\n"
159  << "Unknown probabilistic method.\n";
160 
161  throw std::logic_error(buffer.str());
162  }
163 }
164 
165 
166 // std::string write_probabilistic_method_text(void) const method
167 
170 
172 {
173  if(probabilistic_method == Competitive)
174  {
175  return("competitive");
176  }
177  else if(probabilistic_method == Softmax)
178  {
179  return("softmax");
180  }
181  else if(probabilistic_method == NoProbabilistic)
182  {
183  return("no probabilistic");
184  }
185  else
186  {
187  std::ostringstream buffer;
188 
189  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
190  << "std::string write_probabilistic_method_text(void) const method.\n"
191  << "Unknown probabilistic method.\n";
192 
193  throw std::logic_error(buffer.str());
194  }
195 }
196 
197 
198 // const bool& get_display(void) const method
199 
202 
203 const bool& ProbabilisticLayer::get_display(void) const
204 {
205  return(display);
206 }
207 
208 
209 // void set(void) method
210 
213 
215 {
217 
218  set_default();
219 }
220 
221 
222 // void set(const size_t&) method
223 
227 
228 void ProbabilisticLayer::set(const size_t& new_probabilistic_neurons_number)
229 {
230  probabilistic_neurons_number = new_probabilistic_neurons_number;
231 
232  set_default();
233 }
234 
235 
236 // void set(const ProbabilisticLayer&) method
237 
240 
241 void ProbabilisticLayer::set(const ProbabilisticLayer& other_probabilistic_layer)
242 {
244 
245  probabilistic_method = other_probabilistic_layer.probabilistic_method;
246 
247  display = other_probabilistic_layer.display;
248 }
249 
250 
251 // void set_probabilistic_neurons_number(const size_t&) method
252 
255 
256 void ProbabilisticLayer::set_probabilistic_neurons_number(const size_t& new_probabilistic_neurons_number)
257 {
258  probabilistic_neurons_number = new_probabilistic_neurons_number;
259 }
260 
261 
262 // void set_default(void) method
263 
269 
271 {
272  probabilistic_method = Softmax;
273 
274  display = true;
275 }
276 
277 
278 // void set_probablistic_method(const ProbabilisticMethod&) method
279 
283 
285 {
286  probabilistic_method = new_probabilistic_method;
287 }
288 
289 
290 // void set_probabilistic_method(const std::string&) method
291 
295 
296 void ProbabilisticLayer::set_probabilistic_method(const std::string& new_probabilistic_method)
297 {
298  if(new_probabilistic_method == "Competitive")
299  {
300  set_probabilistic_method(Competitive);
301  }
302  else if(new_probabilistic_method == "Softmax")
303  {
304  set_probabilistic_method(Softmax);
305  }
306  else if(new_probabilistic_method == "NoProbabilistic")
307  {
308  set_probabilistic_method(NoProbabilistic);
309  }
310  else
311  {
312  std::ostringstream buffer;
313 
314  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
315  << "void set_probabilistic_method(const std::string&) method.\n"
316  << "Unknown probabilistic method: " << new_probabilistic_method << ".\n";
317 
318  throw std::logic_error(buffer.str());
319  }
320 }
321 
322 
323 // void set_display(const bool&) method
324 
329 
330 void ProbabilisticLayer::set_display(const bool& new_display)
331 {
332  display = new_display;
333 }
334 
335 
336 // void prune_probabilistic_neuron(void) method
337 
340 
342 {
343  // Control sentence (if debug)
344 
345  #ifndef NDEBUG
346 
348  {
349  std::ostringstream buffer;
350 
351  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
352  << "void prune_probabilistic_neuron(void) method.\n"
353  << "Number of probabilistic neurons is zero.\n";
354 
355  throw std::logic_error(buffer.str());
356  }
357 
358  #endif
359 
361 }
362 
363 
364 // void initialize_random(void) method
365 
367 
369 {
370  // Probabilistic method
371 
372  switch(rand()%3)
373  {
374  case 0:
375  {
376  probabilistic_method = Competitive;
377  }
378  break;
379 
380  case 1:
381  {
382  probabilistic_method = Softmax;
383  }
384  break;
385 
386  case 2:
387  {
388  probabilistic_method = NoProbabilistic;
389  }
390  break;
391 
392  default:
393  {
394  std::ostringstream buffer;
395 
396  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
397  << "void initialize_random(void) method.\n"
398  << "Unknown probabilistic method.\n";
399 
400  throw std::logic_error(buffer.str());
401  }
402  break;
403  }
404 }
405 
406 
407 // Vector<double> calculate_outputs(const Vector<double>&) const method
408 
412 
414 {
415  // Control sentence (if debug)
416 
417  #ifndef NDEBUG
418 
419  const size_t size = inputs.size();
420 
421  if(size != probabilistic_neurons_number)
422  {
423  std::ostringstream buffer;
424 
425  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
426  << "Vector<double> calculate_outputs(const Vector<double>&) const method.\n"
427  << "Size must be equal to number of probabilistic neurons.\n";
428 
429  throw std::logic_error(buffer.str());
430  }
431 
432  #endif
433 
434  switch(probabilistic_method)
435  {
436  case Competitive:
437  {
438  return(calculate_competitive_output(inputs));
439  }
440  break;
441 
442  case Softmax:
443  {
444  return(calculate_softmax_output(inputs));
445  }
446  break;
447 
448  case NoProbabilistic:
449  {
450  return(calculate_no_probabilistic_output(inputs));
451  }
452  break;
453 
454  default:
455  {
456  std::ostringstream buffer;
457 
458  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
459  << "Vector<double> calculate_outputs(const Vector<double>&) const method.\n"
460  << "Unknown probabilistic method.\n";
461 
462  throw std::logic_error(buffer.str());
463  }// end default
464  break;
465 
466  }// end switch
467 }
468 
469 
470 // Matrix<double> calculate_Jacobian(const Vector<double>&) const method
471 
476 
478 {
479  // Control sentence (if debug)
480 
481  #ifndef NDEBUG
482 
483  const size_t size = inputs.size();
484 
485  if(size != probabilistic_neurons_number)
486  {
487  std::ostringstream buffer;
488 
489  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
490  << "Matrix<double> calculate_Jacobian(const Vector<double>&) const method.\n"
491  << "Size must be equal to number of probabilistic neurons.\n";
492 
493  throw std::logic_error(buffer.str());
494  }
495 
496  #endif
497 
498  switch(probabilistic_method)
499  {
500  case Competitive:
501  {
502  return(calculate_competitive_Jacobian(inputs));
503  }
504  break;
505 
506  case Softmax:
507  {
508  return(calculate_softmax_Jacobian(inputs));
509  }
510  break;
511 
512  case NoProbabilistic:
513  {
514  return(calculate_no_probabilistic_Jacobian(inputs));
515  }
516  break;
517 
518  default:
519  {
520  std::ostringstream buffer;
521 
522  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
523  << "Matrix<double> calculate_Jacobian(const Vector<double>&) const method.\n"
524  << "Unknown probabilistic method.\n";
525 
526  throw std::logic_error(buffer.str());
527  }// end default
528  break;
529 
530  }// end switch
531 }
532 
533 
534 // Vector< Matrix<double> > calculate_Hessian_form(const Vector<double>&) const method
535 
539 
541 {
542  // Control sentence (if debug)
543 
544  #ifndef NDEBUG
545 
546  const size_t size = inputs.size();
547 
548  if(size != probabilistic_neurons_number)
549  {
550  std::ostringstream buffer;
551 
552  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
553  << "Matrix<double> calculate_Hessian_form(const Vector<double>&) const method.\n"
554  << "Size must be equal to number of probabilistic neurons.\n";
555 
556  throw std::logic_error(buffer.str());
557  }
558 
559  #endif
560 
561  switch(probabilistic_method)
562  {
563  case Competitive:
564  {
565  return(calculate_competitive_Hessian_form(inputs));
566  }
567  break;
568 
569  case Softmax:
570  {
571  return(calculate_softmax_Hessian_form(inputs));
572  }
573  break;
574 
575  case NoProbabilistic:
576  {
578  }
579  break;
580 
581  default:
582  {
583  std::ostringstream buffer;
584 
585  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
586  << "Matrix<double> calculate_Hessian_form(const Vector<double>&) const method.\n"
587  << "Unknown probabilistic method.\n";
588 
589  throw std::logic_error(buffer.str());
590  }// end default
591  break;
592 
593  }// end switch
594 }
595 
596 
597 // Vector<double> calculate_competitive_output(const Vector<double>&) const method
598 
601 
603 {
604  return(inputs.calculate_competitive());
605 }
606 
607 
608 // Matrix<double> calculate_competitive_Jacobian(const Vector<double>&) const method
609 
611 
613 {
614  std::ostringstream buffer;
615 
616  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
617  << "Matrix<double> calculate_competitive_Jacobian(const Vector<double>&) const method.\n"
618  << "The competitive function is not derivable.\n";
619 
620  throw std::logic_error(buffer.str());
621 }
622 
623 
624 // Vector< Matrix<double> > calculate_competitive_Hessian_form(const Vector<double>&) const method
625 
627 
629 {
630  std::ostringstream buffer;
631 
632  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
633  << "Vector< Matrix<double> > calculate_competitive_Hessian_form(const Vector<double>&) const method.\n"
634  << "The competitive function is not derivable.\n";
635 
636  throw std::logic_error(buffer.str());
637 }
638 
639 
640 // Vector<double> calculate_softmax_output(const Vector<double>&) const method
641 
644 
646 {
647  return(inputs.calculate_softmax());
648 }
649 
650 
651 // Matrix<double> calculate_softmax_Jacobian(const Vector<double>&) const method
652 
655 
657 {
659 
660  const Vector<double> outputs = inputs.calculate_softmax();
661 
662  for(size_t i = 0; i < probabilistic_neurons_number; i++)
663  {
664  for(size_t j = 0; j < probabilistic_neurons_number; j++)
665  {
666  if(i == j)
667  {
668  probabilistic_Jacobian(i,i) = outputs[i]*(1.0 - outputs[i]);
669  }
670  else
671  {
672  probabilistic_Jacobian(i,j) = -outputs[i]*outputs[j];
673  }
674  }
675  }
676 
677  return(probabilistic_Jacobian);
678 }
679 
680 
681 // Vector< Matrix<double> > calculate_softmax_Hessian_form(const Vector<double>&) const method
682 
686 
688 {
689  Vector< Matrix<double> > Hessian_form;
690 
691  return(Hessian_form);
692 }
693 
694 
695 // Vector<double> calculate_no_probabilistic_output(const Vector<double>&) const method
696 
700 
702 {
703  return(inputs);
704 }
705 
706 
707 // Matrix<double> calculate_no_probabilistic_Jacobian(const Vector<double>&) const method
708 
711 
713 {
715 
716  Jacobian.initialize_identity();
717 
718  return(Jacobian);
719 }
720 
721 
722 // Vector< Matrix<double> > calculate_no_probabilistic_Hessian_form(const Vector<double>&) const method
723 
727 
729 {
730  Vector< Matrix<double> > Hessian_form;
731 
732  return(Hessian_form);
733 }
734 
735 
736 // std::string to_string(void) const method
737 
739 
740 std::string ProbabilisticLayer::to_string(void) const
741 {
742  std::ostringstream buffer;
743 
744  buffer << "Probabilistic layer\n"
745  << "Probabilistic neurons number: " << probabilistic_neurons_number << "\n"
746  << "Probabilistic method: " << write_probabilistic_method() << "\n"
747  << "Display: "<< display << "\n";
748 
749  return(buffer.str());
750 }
751 
752 
753 // tinyxml2::XMLDocument* to_XML(void) const method
754 
757 
758 tinyxml2::XMLDocument* ProbabilisticLayer::to_XML(void) const
759 {
760  std::ostringstream buffer;
761 
762  tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument;
763 
764  tinyxml2::XMLElement* root_element = document->NewElement("ProbabilisticLayer");
765 
766  document->InsertFirstChild(root_element);
767 
768  tinyxml2::XMLElement* element = NULL;
769  tinyxml2::XMLText* text = NULL;
770 
771  // Probabilistic neurons number
772  {
773  element = document->NewElement("ProbabilisticNeuronsNumber");
774  root_element->LinkEndChild(element);
775 
776  buffer.str("");
778 
779  text = document->NewText(buffer.str().c_str());
780  element->LinkEndChild(text);
781  }
782 
783  // Probabilistic method
784  {
785  element = document->NewElement("ProbabilisticMethod");
786  root_element->LinkEndChild(element);
787 
788  text = document->NewText(write_probabilistic_method().c_str());
789  element->LinkEndChild(text);
790  }
791 
792  // Display
793  {
794  element = document->NewElement("Display");
795  root_element->LinkEndChild(element);
796 
797  buffer.str("");
798  buffer << display;
799 
800  text = document->NewText(buffer.str().c_str());
801  element->LinkEndChild(text);
802  }
803 
804  return(document);
805 }
806 
807 
808 // void from_XML(const tinyxml2::XMLDocument&) method
809 
812 
813 void ProbabilisticLayer::from_XML(const tinyxml2::XMLDocument& document)
814 {
815  std::ostringstream buffer;
816 
817  const tinyxml2::XMLElement* probabilistic_layer_element = document.FirstChildElement("ProbabilisticLayer");
818 
819  if(!probabilistic_layer_element)
820  {
821  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
822  << "void from_XML(const tinyxml2::XMLDocument&) method.\n"
823  << "Probabilistic layer element is NULL.\n";
824 
825  throw std::logic_error(buffer.str());
826  }
827 
828  // Probabilistic neurons number
829  {
830  const tinyxml2::XMLElement* element = probabilistic_layer_element->FirstChildElement("ProbabilisticNeuronsNumber");
831 
832  if(element)
833  {
834  const char* text = element->GetText();
835 
836  if(text)
837  {
838  try
839  {
841  }
842  catch(const std::logic_error& e)
843  {
844  std::cout << e.what() << std::endl;
845  }
846  }
847  }
848  }
849 
850  // Probabilistic method
851  {
852  const tinyxml2::XMLElement* element = probabilistic_layer_element->FirstChildElement("ProbabilisticMethod");
853 
854  if(element)
855  {
856  const char* text = element->GetText();
857 
858  if(text)
859  {
860  try
861  {
862  std::string new_probabilistic_method(text);
863 
864  set_probabilistic_method(new_probabilistic_method);
865  }
866  catch(const std::logic_error& e)
867  {
868  std::cout << e.what() << std::endl;
869  }
870  }
871  }
872  }
873 
874  // Display
875  {
876  const tinyxml2::XMLElement* display_element = probabilistic_layer_element->FirstChildElement("Display");
877 
878  if(display_element)
879  {
880  std::string new_display_string = display_element->GetText();
881 
882  try
883  {
884  set_display(new_display_string != "0");
885  }
886  catch(const std::logic_error& e)
887  {
888  std::cout << e.what() << std::endl;
889  }
890  }
891  }
892 }
893 
894 
895 // std::string write_competitive_expression(const Vector<std::string>&, const Vector<std::string>&) const method
896 
900 
901 std::string ProbabilisticLayer::write_competitive_expression(const Vector<std::string>& inputs_names, const Vector<std::string>& outputs_names) const
902 {
903  std::ostringstream buffer;
904 
905  for(size_t i = 0; i < probabilistic_neurons_number; i++)
906  {
907  buffer << outputs_names[i] << "= Competitive(" << inputs_names.to_string(",") << ");\n";
908  }
909 
910  return(buffer.str());
911 }
912 
913 
914 // std::string write_softmax_expression(const Vector<std::string>&, const Vector<std::string>&) const method
915 
919 
920 std::string ProbabilisticLayer::write_softmax_expression(const Vector<std::string>& inputs_names, const Vector<std::string>& outputs_names) const
921 {
922  std::ostringstream buffer;
923 
924  for(size_t i = 0; i < probabilistic_neurons_number; i++)
925  {
926  buffer << outputs_names[i] << "= Softmax(" << inputs_names.to_string(",") << ");\n";
927  }
928 
929  return(buffer.str());
930 }
931 
932 
933 // std::string write_no_probabilistic_expression(const Vector<std::string>&, const Vector<std::string>&) const method
934 
938 
939 std::string ProbabilisticLayer::write_no_probabilistic_expression(const Vector<std::string>& inputs_names, const Vector<std::string>& outputs_names) const
940 {
941  std::ostringstream buffer;
942 
943  for(size_t i = 0; i < probabilistic_neurons_number; i++)
944  {
945  buffer << outputs_names[i] << " = " << inputs_names.to_string() << ";\n";
946  }
947 
948  return(buffer.str());
949 }
950 
951 
952 // std::string write_expression(const Vector<std::string>&, const Vector<std::string>&) const method
953 
958 
959 std::string ProbabilisticLayer::write_expression(const Vector<std::string>& inputs_names, const Vector<std::string>& outputs_names) const
960 {
961  switch(probabilistic_method)
962  {
963  case Competitive:
964  {
965  return(write_competitive_expression(inputs_names, outputs_names));
966  }
967  break;
968 
969  case Softmax:
970  {
971  return(write_softmax_expression(inputs_names, outputs_names));
972  }
973  break;
974 
975  case NoProbabilistic:
976  {
977  return(write_no_probabilistic_expression(inputs_names, outputs_names));
978  }
979  break;
980 
981  default:
982  {
983  std::ostringstream buffer;
984 
985  buffer << "OpenNN Exception: ProbabilisticLayer class.\n"
986  << "std::string write_expression(const Vector<std::string>&, const Vector<std::string>&) const method.\n"
987  << "Unknown probabilistic method.\n";
988 
989  throw std::logic_error(buffer.str());
990  }// end default
991  break;
992  }// end switch
993 }
994 
995 }
996 
997 // OpenNN: Open Neural Networks Library.
998 // Copyright (c) 2005-2015 Roberto Lopez.
999 //
1000 // This library is free software; you can redistribute it and/or
1001 // modify it under the terms of the GNU Lesser General Public
1002 // License as published by the Free Software Foundation; either
1003 // version 2.1 of the License, or any later version.
1004 //
1005 // This library is distributed in the hope that it will be useful,
1006 // but WITHOUT ANY WARRANTY; without even the implied warranty of
1007 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1008 // Lesser General Public License for more details.
1009 
1010 // You should have received a copy of the GNU Lesser General Public
1011 // License along with this library; if not, write to the Free Software
1012 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
std::string write_competitive_expression(const Vector< std::string > &, const Vector< std::string > &) const
Vector< Matrix< double > > calculate_no_probabilistic_Hessian_form(const Vector< double > &) const
std::string write_softmax_expression(const Vector< std::string > &, const Vector< std::string > &) const
ProbabilisticMethod probabilistic_method
Probabilistic processing method.
bool operator==(const ProbabilisticLayer &) const
Vector< Matrix< double > > calculate_Hessian_form(const Vector< double > &) const
const ProbabilisticMethod & get_probabilistic_method(void) const
bool display
Display messages to screen.
std::string write_probabilistic_method(void) const
std::string write_no_probabilistic_expression(const Vector< std::string > &, const Vector< std::string > &) const
std::string to_string(void) const
Returns a string representation of the current probabilistic layer object.
Vector< double > calculate_outputs(const Vector< double > &) const
Vector< T > calculate_softmax(void) const
Definition: vector.h:1807
Matrix< double > calculate_no_probabilistic_Jacobian(const Vector< double > &) const
virtual tinyxml2::XMLDocument * to_XML(void) const
size_t probabilistic_neurons_number
Number of probabilistic neurons in the layer.
void initialize_random(void)
Initializes at random the probabilistic method.
const size_t & get_probabilistic_neurons_number(void) const
Returns the number of probabilistic neurons in the layer.
Vector< double > calculate_competitive_output(const Vector< double > &) const
void set_probabilistic_method(const ProbabilisticMethod &)
ProbabilisticLayer & operator=(const ProbabilisticLayer &)
std::string write_probabilistic_method_text(void) const
void initialize_identity(void)
Definition: matrix.h:2659
const bool & get_display(void) const
void set_probabilistic_neurons_number(const size_t &)
Vector< T > calculate_competitive(void) const
Definition: vector.h:1787
virtual void from_XML(const tinyxml2::XMLDocument &)
Vector< double > calculate_no_probabilistic_output(const Vector< double > &) const
Matrix< double > calculate_softmax_Jacobian(const Vector< double > &) const
std::string write_expression(const Vector< std::string > &, const Vector< std::string > &) const
Vector< double > calculate_softmax_output(const Vector< double > &) const
Vector< Matrix< double > > calculate_competitive_Hessian_form(const Vector< double > &) const
This method throws an exception, since the competitive function is not derivable. ...
std::string to_string(const std::string &=" ") const
Returns a string representation of this vector.
Definition: vector.h:5255
ProbabilisticMethod
Enumeration of available methods for interpreting variables as probabilities.
Vector< Matrix< double > > calculate_softmax_Hessian_form(const Vector< double > &) const
Matrix< double > calculate_Jacobian(const Vector< double > &) const
Matrix< double > calculate_competitive_Jacobian(const Vector< double > &) const
This method throws an exception, since the competitive function is not derivable. ...