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:
- x[i] >=1 for all "i" (at least 1 order)
- x[i] <=24 for all "i" (at most 24 orders)
- sum(x[i]) <= 2000 (at most 2000 orders all combined)
- sum(ci/x[i]) <= 2000 (cycle stock at most 2000 units)
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