I have an easy Economic Order Quantity (EOQ) optimization problem involving many variables and a few constraints.
The generalized objective function is sum(ai*x[i]+bi/[xi]) and the restrictions are:
When using the auglag() it takes too long (even for 100 variables) and so doing some research I found the problem is convex and tried to implement a convex solver.
I found this link:
Error in nonlinear optimization problem : infinite or missing values in 'x'
However, it seems that CVXR does not allow for the "x" in the denominator as it prompts the following error message:
Error in as.Constant(e1)/e2 : Can only divide by a scalar constant
ans2 <- auglag(par=rep(2,1000), fn=objfun, hin=confun) ##takes too long
p <- Variable(1000)
obj <- Minimize(sum(a*p+b/p)) ##prompts error
I expect the solver to work much faster for such an "easy" optimization problem... Am I doing something wrong with the 2nd option? Or is there any better solver for convex nonlinear optimization problems with nonlinear constraints?
Thanks
Try
Minimize(sum(a*p+b*inv_pos(p)))
I have not tried since you don't provide a reproducible code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.