[R] Nonlinear constrains with optim
Spencer Graves
spencer.graves at pdf.com
Thu May 10 20:48:45 CEST 2007
Hi, Patrick, Paul, et al.:
<see in line>
Patrick Burns wrote:
> I don't know of any sources, but the idea is quite simple.
>
> For each constraint that is broken, the penalty is the amount
> by which the constraint is broken times a penalty rate. The
> total penalty to add to the objective is the sum of penalties
> over all constraints.
>
> There is a catch or two when using this with derivative-based
> optimizers. The objective typically becomes non-differentiable
> at the boundary, and optimizers can get confused.
I believe I've gotten good results with penalties that are the SQUARE of
the amount by which the constraints were violated. These are
continuously differentiable and so don't confuse the derivative-based
optimizers much.
Also, I start with a small penalty, then increase the penalty until I
get a solution that seems sensible. If you can't handle a solution just
a little outside your constraints, shrink a little the place at which
the penalty starts.
Hope this helps.
Spencer Graves
> They might
> be less confused with smaller penalty rates. However if the
> penalty rate is too small, then you can get a "solution" that breaks
> one or more penalties.
>
> Starting from a solution given by Rgenoud or its ilk is probably
> a good idea.
>
> Patrick Burns
> patrick at burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
>
> Paul Smith wrote:
>
>
>> Dear All
>>
>> I am dealing at the moment with optimization problems with nonlinear
>> constraints. Regenoud is quite apt to solve that kind of problems, but
>> the precision of the optimal values for the parameters is sometimes
>> far from what I need. Optim seems to be more precise, but it can only
>> accept box-constrained optimization problems. I read in the list
>> archives that optim can also be used with nonlinear constrains through
>> penalizations. However, I am not familiar with the technique of
>> penalizations. Could someone please indicate to me a site or a book to
>> learn about that penalization technique?
>>
>> Thanks in advance,
>>
>> Paul
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>>
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list