You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Bruce Johnson <nm...@me.com> on 2014/03/01 00:26:46 UTC

[math] CMAESOptimizer fails sometimes when bounds are violated

The CMAESOptimizer repairs points that are out of bounds by moving them into bounds, and adding a penalty based on how far they were moved.

The penalty added is scaled by the range of values in the current population (valueRange field in code below).

double[] x, final double[] repaired) {
            double penalty = 0;
            for (int i = 0; i < x.length; i++) {
                double diff = FastMath.abs(x[i] - repaired[i]);
                penalty += diff * valueRange;
            }
            return isMinimize ? penalty : -penalty;
        }

The calculation of the valueRange, however, includes the penalty so at each iteration the amount of penalty grows multiplicatively until the calculated value is infinite.


I have a, not yet very elegant, patch that keeps the value and penalty separate so the valueRange can be based on the actual range of values (not the penalized range of values).

I can open a Jira issue for this if that makes sense.

Bruce



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] CMAESOptimizer fails sometimes when bounds are violated

Posted by Gilles <gi...@harfang.homelinux.org>.
On Fri, 28 Feb 2014 18:26:46 -0500, Bruce Johnson wrote:
> The CMAESOptimizer repairs points that are out of bounds by moving
> them into bounds, and adding a penalty based on how far they were
> moved.
>
> The penalty added is scaled by the range of values in the current
> population (valueRange field in code below).
>
> double[] x, final double[] repaired) {
>             double penalty = 0;
>             for (int i = 0; i < x.length; i++) {
>                 double diff = FastMath.abs(x[i] - repaired[i]);
>                 penalty += diff * valueRange;
>             }
>             return isMinimize ? penalty : -penalty;
>         }
>
> The calculation of the valueRange, however, includes the penalty so
> at each iteration the amount of penalty grows multiplicatively until
> the calculated value is infinite.
>
>
> I have a, not yet very elegant, patch that keeps the value and
> penalty separate so the valueRange can be based on the actual range 
> of
> values (not the penalized range of values).
>
> I can open a Jira issue for this if that makes sense.

Yes, please.

Gilles



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org