On Fri, Aug 10, 2012 at 05:41:07AM -0700, aajit75 wrote: > Hi, > > I am new to R for solving optimization problems, I have set of communication > channels with limited capacity with two types of costs, fixed and variable > cost. Each channel has expected gain for a single communication. > I want to determine optimal number of communications for each channel > maximizing ROI)return on investment) with overall budget as constraint.60000 > is the budget allocated. > > Channel Fixed_Cost Variable_Cost Capacity Expected_Gain > C1 400 2.5 5000 0.25 > C2 10000 0 30000 0.3 > C3 4000 0.15 20000 0.15 > C4 2000 2 10000 0.36 > C5 100 3 4000 0.09 > > Channel_Select <-data.frame(Channel=c('c1','c2','c3','c4','c5'), > Fixed_Cost=c(400,5000,4000,2000,100), > Variable_Cost=c(2.5,0,0.15,2,3), > Capacity=c(5000,30000,20000,10000,4000), > Expected_gain=c(0.25,0.3,0.15,0.36,0.09)) > > > Let x1,x2,x3,x4,x5 are the decision variables for c1,c2,c3,c4,c5 channel > and z1,z2,z3,z4,z5 are the indicator binary variables if channel has > allocated communication if any. > > max((0.25*x1+0.30*x2+0.15*x3+0.36*x4+0.09*x5)-(2.5*x1+0*x2+0.15*x3+2*x4+3*x5+400*z1+10000*z2+4000*z3+2000*z4+100*z5)/( > 2.5*x1+0*x2+0.15*x3+2*x4+3*x5+400*z1+10000*z2+4000*z3+2000*z4+100*z5)) > > Constraints: > (2.5*x1+0*x2+0.15*x3+2*x4+3*x5+400*z1+10000*z2+4000*z3+2000*z4+100*z5)) <= > 60000 ##Budget Constraint > x1-5000*z1<=0 > x2-30000*z2<=0 > x3-20000*z3<=0 > x4-10000*z4<=0 > x5-4000*z5<=0 > x1 >= 200 > x2 >= 100 > x3>=100 > x4>=500 > x5>=0 > > I had tried lp function from lpsolve but not able to set objective.in for > objective function. Any help or hint is welcomed!
Hi. Your objective function is not a linear function, since it contains a ratio of two linear functions. So, the current form of the problem cannot be formulated as an input to lpSolve. Petr Savicky. ______________________________________________ R-help@r-project.org 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.