Hi All,
I'm trying to do the following constrained optimization example.
Maximize x1*(1-x1) + x2*(1-x2) + x3*(1-x3)
s.t. x1 + x2 + x3 = 1
x1 >= 0 and x1 <= 1
x2 >= 0 and x2 <= 1
x3 >= 0 and x3 <= 1
which are the constraints.
I'm expecting the answer x1=x2=x3 = 1/3.

I tried the "constrOptim" function in R and I'm running into some issues.
I first start off by setting my equalities to inequalities
x1+x2+x3 >= 1
x1+x2+x3 <= 1.001

However, I get a 
"Error in constrOptim(c(1.00004, 0, 0), fr, grr, ui = t(A), ci = b) : 
  initial value not feasible
Execution halted" error.
The values 1.00004,0,0 are well within the constraints domain.

fr = function(x){
  x1 = x[1]
  x2 = x[2]
  x3 = x[3]
  x1*(1-x1) + x2*(1-x2) + x3*(1-x3)
}

grr = function(x){
  x1 = x[1]
  x2 = x[2]
  x3 = x[3]
  c(1-2*x1,1-2*x2,1-2*x3)
}

A = matrix(c(1,1,1,-1,-1,-1,1,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,1),3,8,byrow=T)
b = c(1,-1.001,0,0,0,1,1,1)

y = constrOptim(c(1.00004,0,0),fr,grr,ui = t(A),ci = b)

Any help/pointers greatly appreciated.

Thanks








      
	[[alternative HTML version deleted]]


