MCPcopy Create free account
hub / github.com/avaneev/biteopt / wrapParamReal

Method wrapParamReal

biteaux.h:2064–2095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2062 */
2063
2064 double wrapParamReal( CBiteRnd& rnd, const double v, const int i ) const
2065 {
2066 const double minv = MinValues[ i ];
2067
2068 if( v < minv )
2069 {
2070 const double dv = DiffValues[ i ];
2071
2072 if( v > minv - dv )
2073 {
2074 return( minv + rnd.get() * ( minv - v ));
2075 }
2076
2077 return( minv + rnd.get() * dv );
2078 }
2079
2080 const double maxv = MaxValues[ i ];
2081
2082 if( v > maxv )
2083 {
2084 const double dv = DiffValues[ i ];
2085
2086 if( v < maxv + dv )
2087 {
2088 return( maxv - rnd.get() * ( v - maxv ));
2089 }
2090
2091 return( maxv - rnd.get() * dv );
2092 }
2093
2094 return( v );
2095 }
2096
2097 /**
2098 * Function sets up starting parameters for normalized space.

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected