#include <eoHowMany.h>
Inheritance diagram for eoHowMany:

Public Member Functions | |
| eoHowMany (double _rate=0.0, bool _interpret_as_rate=true) | |
| Original Ctor from direct rate + bool. | |
| eoHowMany (int _combien) | |
| Ctor from an int - both from int and unsigned int are needed to avoid ambiguity with the Ctor from a double. | |
| eoHowMany (unsigned int _combien) | |
| Ctor from an unsigned int - both from int and unsigned int are needed to avoid ambiguity with the Ctor from a double. | |
| virtual | ~eoHowMany () |
| Virtual dtor. They are needed in virtual class hierarchies. | |
| unsigned int | operator() (unsigned int _size) |
| Does what it was designed for combien==0 : return rate*_size else combien>0 : return combien (regardless of _size) combien<0 : return _size-|combien|. | |
| virtual void | printOn (std::ostream &_os) const |
| Write object. | |
| virtual void | readFrom (std::istream &_is) |
| Read object. | |
| void | readFrom (std::string _value) |
| eoHowMany | operator- () |
| The unary - operator: reverses the computation. | |
Private Attributes | |
| double | rate |
| int | combien |
the number of offspring from the number of parents, or the number of survivors for an eoReduce functor, ...
Such construct is very useful because in some cases you might not know the population size that will enter the replacement. For instance, you cannot simply have a pre-computed (double) rate of 1/popSize if you want to select or kill just 1 guy. Using an eoHowMany allows one to modify the population size without touching anything else.
There are 4 possible way to compute the return value from the argument:
It has 2 private members, a double and an integer to cover all cases
Example use: in eoGeneralBreeder.h Example reading from parser: in do/make_algo_scalar.h line 141
MS 10/04/2002: Added the possibility to have a negative number - when treated as a number: returns then (size - combien) Should not modify anything when a positive number is passed in the ctor
MS 20/06/2002: Added the negative rate and the operator-() (for eoG3Repalcement)
It is an eoPersistent because we need to be able to use eoParamValue<eoHowMany>
Definition at line 69 of file eoHowMany.h.
|
||||||||||||
|
Original Ctor from direct rate + bool.
Definition at line 76 of file eoHowMany.h. |
|
|
Does what it was designed for combien==0 : return rate*_size else combien>0 : return combien (regardless of _size) combien<0 : return _size-|combien|.
Definition at line 114 of file eoHowMany.h. |
|
|
Write object. It's called printOn since it prints the object on a stream.
Implements eoPrintable. Definition at line 130 of file eoHowMany.h. |
|
|
Read object.
Implements eoPersistent. Definition at line 140 of file eoHowMany.h. |
1.3.9.1