Skip to content

How to stop the minimization when the condition does not hold

2 messages · Vicky Landsman, Ales Ziberna

#
First you have to be more specific, what are actually the parameters of the 
function that
you want to optiomize and what are actually constants.

So you would need to specify your objective function
"function(theta)=lambda*(Constr)^2-f(x,theta)" (which is not realy writen
the R-way)
as
fun<-function(Constr,theta){lambda*(Constr)^2-f(x,theta)}
However, since, if I understand correclty, you don't want Constr to be
smaller or equal to d, you should somehow build this into your objective
function, like:

fun<-function(Constr,theta){lambda*(Constr)^2-f(x,theta)+ifelse(Constr<=d,
Inf, 0)}

I hope this helps,
Ales Ziberna


----- Original Message ----- 
From: "Vicky Landsman" <msvika at mscc.huji.ac.il>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, March 24, 2005 8:38 PM
Subject: [R] How to stop the minimization when the condition does not hold