G'day Paul, On Mon, 7 May 2007 22:30:32 +0100 "Paul Smith" <[EMAIL PROTECTED]> wrote:
> I am trying to perform the below optimization problem, but getting > (0.5,0.5) as optimal solution, which is wrong; Why? As far as I can tell you are trying to minimize |x1-x2| where x1 and x2 are between 0 and 1. The minimal value that the absolute function can take is zero and any point (x1,x2)=(x,1-x) where x is between 0 and 1 will achieve this value and also respect the constraints that you have imposed. Hence, any such point, including (0.5,0.5) is a solution to your problem. > the correct solution should be (1,0) or (0,1). Why? Unless there are some additional constraint that you have not told optim() (and us) about, these are two possible solutions from an infinite set of solutions. As I said, any point of the form (x, 1-x) with x between 0 and 1 is a solution to your problem, unless I am missing something.... Cheers, Berwin ______________________________________________ R-help@stat.math.ethz.ch 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.