The package lpSolve (that I have recommended before) supports so-called 'semi-continuous variables', that is
"Semi-continuous variables are variables that must take a value between their their minimum and maximum or zero. So these variables are treated the same as regular variables, except that a value of zero is also accepted, even if a minimum bigger than zero is set on the variable." which exactly how you want to handle your variable x3. For an example, see the documentation at <lpsolve.sourceforge.net/5.5/>. By the way, the minimum of your problem is 44.64 (manual calculation). vikrant S wrote: > > HI All, > I am unable to solve a optimization Problem Please Help Me out of this to > solve. The Optimization problem is as follows :- > My objective function is linear and one of the constraint is quadratic. > > Min z = 5 * X1 + 9* X2 + 7.15 *X3 + 2 * X4 > subject to > X1 + X2 + X3 +X4 = 9 > X1 + X4 < = 6.55 > X3(X3 - 3.5) >=0 > X1,X2,X3,X4 >=0 > Now the problem is how to solve this kind of problem. Which package > should be used to handle such problems. Please explain with an example. > Another problem is that I have to cases to be solve in this problem. > case 1:-) If X3 = 0 > case 2 :-) If X3 > 0 then X3 > 3.6 > I want to handle both this case in one problem so the quadratic > constraints is written > The thing is that I want to evaluate my objective function for both cases > and which ever is optimum that solution i need, > Here I don't want to use the If Else condition and repeat the program. IS > there any other better way in which i could solve this problem? > If not please try to provide me the solution for my original problem > having a quadratic constraint. > -- View this message in context: http://www.nabble.com/Quadratic-Constraints-tp25528480p25529374.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.