Changeset 765 for cpp/frams/genetics


Ignore:
Timestamp:
03/28/18 02:33:11 (2 years ago)
Author:
Maciej Komosinski
Message:

Wider ranges of allowed values for mutation when only partial information of min/max/default is provided

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/oper_fx.cpp

    r764 r765  
    5151                double _mn = 0, _mx = 1, _def = 0.5;
    5252                defined = p->getMinMaxDouble(i, _mn, _mx, _def);
    53                 if (defined == 1) _mx = _mn + 1.0;
    54                 if (_mx < _mn && defined == 3) _mn = _mx = _def; //only default was defined, let's assume min=max=default
     53                if (defined == 1) _mx = _mn + 1000.0; //only min was defined, so let's set some arbitrary range, just to have some freedom. Assumes _mn is not close to maxdouble...
     54                if (_mx < _mn && defined == 3) //only default was defined, so let's assume some arbitrary range. Again, no check for min/maxdouble...
     55                {
     56                        _mn = _def - 500.0;
     57                        _mx = _def + 500.0;
     58                }
    5559                if (defined < 3) _def = (_mn + _mx) / 2.0;
    5660                mn = _mn; mx = _mx; def = _def;
     
    6064                paInt _mn = 0, _mx = 1, _def = 0;
    6165                defined = p->getMinMaxInt(i, _mn, _mx, _def);
    62                 if (defined == 1) _mx = _mn + 1;
    63                 if (_mx < _mn && defined == 3) _mn = _mx = _def; //only default was defined, let's assume min=max=default
     66                if (defined == 1) _mx = _mn + 1000; //only min was defined, so let's set some arbitrary range, just to have some freedom. Assumes _mn is not close to maxint...
     67                if (_mx < _mn && defined == 3) //only default was defined, so let's assume some arbitrary range. Again, no check for min/maxint...
     68                {
     69                        _mn = _def - 500;
     70                        _mx = _def + 500;
     71                }
    6472                if (defined < 3) _def = (_mn + _mx) / 2;
    6573                mn = _mn; mx = _mx; def = _def;
Note: See TracChangeset for help on using the changeset viewer.