Medha Atre <medha.atre <at> gmail.com> writes: > > Hi, > > I found the reason. By default it puts a condition for x >= 0. Is > there a way to get rid of this condition?
The constraints x >= 0 are used in most linear programming realizations. Some bounds from below are needed. The trick to circumvent the restriction is as follows: Assume you know x >= d where some or all of the d_i can be negative. Replace x with y = x - d >= 0 and minimize c'y with Ay <= b - A d ! Your solution is then x = y + d , that is solveLP(cvec, bvec - Amat %*% dvec, Amat)$solution + dvec Of course this works with all linear programming packages in R. [Good theorists] always make an even number of sign errors, and the bad ones always make an odd number of sign errors. -- Anthony Zee in: QFT in a Nutshell > Medha > > On Fri, Oct 23, 2009 at 2:34 PM, Medha Atre <medha.atre <at> gmail.com> wrote: > > Hi, > > > > I am using R in one of my courses. I am trying to use R's linprog > > package to solve to formulate 2-class classification problem as Linear > > programming problem. > > > > For my formulation, I need to set to "cvec" to all 0s. > > I know the points are linearly separable so an optimal solution "x" > > does exist, which satisfies all the constraints. > > > > But given the constraints and setting "cvec" to all 0s it simply gives > > me an "x" of all 0s. > > > > How can I fix this? > > > > Medha > > > > ______________________________________________ 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.