I want to minimise a function but with a constraint that i fail several time to insert.
Can any one help please? below are some fake figures to run the optimization.
*start value: u = 0.05; v = 0.3; xi = 0.2; r = - 0.5; m = 0.1;
*input variable given: k = c(10,15,20,25,30,35,40,45,50,55,60)
*input variables to estimate: c(u,v,xi,r,m)
*true values of fun: c(0.000729340273972603, 0.000784865621917808, 0.000701278101369863,
0.000845759473972603, 0.000695066432876712, 0.000945239802739726,
0.000705536095890411, 0.0010238459260274, 0.000724702191780822,
0.00116548326575342, 0.000781495898630137)
*objective function:
fun <- function(u,v,xi,r,m,k){
return(u + v ( r(k-m) + sqrt((k-m)^2 + xi^2)) )
}
*constraints : u + v * xi *sqrt(1-r^2) >0 & v>0 & xi >0 abs(r) <1
Nobody responds? may be i was not clear. perhaps i can progress with partial question?
I think about using constrOptim() function because others seem to fail when adding constraints. I don't know how to convert the constraints into ui and ci.
First, a disclaimer: strict inequalities are generally not allowed in mathematical programming. So you will have to live with >= rather than > and <= rather than <.
Second, you have a nonconvex nonlinearly constrained problem, which tends to be rather difficult. There are algorithms/solvers you can try, but I suspect that many if not all will guarantee only to produce a locally optimal feasible solution (if one can be found) and will not guarantee to find a globally optimal solution.