Related question: Tell Wolfram Alpha that a variable is a natural number
I want to do the following in Wolfram Alpha:
Minimise
$$z = (y_1-x_1)+(x_2-y_2)+(1/2)(x_3)$$
s.t.
$$0 \le x_1 \le y_1$$
$$y_2 \le x_2 \le 2y_2$$
$$2y_3 \le x_3 \le 3y_3$$
$$y_1+y_2+y_3=1$$
$$y_1, y_2, y_3 \in \{0,1\}$$
$$x_1,x_2,x_3 \ge 0$$
It seems pretty long so I kind of converted
$$0 \le x_1 \le y_1$$
$$y_2 \le x_2 \le 2y_2$$
$$2y_3 \le x_3 \le 3y_3$$
$$y_1, y_2, y_3 \in \{0,1\}$$
$$x_1,x_2,x_3 \ge 0$$
into
$$0 \le x_1 \le y_1 \le 1$$
$$\color{red}{0 \le} y_2 \le x_2 \le 2y_2 \color{red}{\le 2}$$
$$\color{red}{0 \le} 2y_3 \le x_3 \le 3y_3 \color{red}{\le 3}$$
$$\color{red}{y_1, y_2, y_3 \ \text{is an integer}}$$
Anyway, I typed
minimize (y1-x1)+(x2-y2)+(1/2)*(x3), 0 <= x1 <= y1 <= 1, 0 <= y2 <= x2 <= 2*y2 <=2, 0 <= 2*y3 <= x3 <= 3*y3 <= 3, y1+y2+y3=1
That works but this
minimize (y1-x1)+(x2-y2)+(1/2)*(x3), 0 <= x1 <= y1 <= 1, 0 <= y2 <= x2 <= 2*y2 <=2, 0 <= 2*y3 <= x3 <= 3*y3 <= 3, y1+y2+y3=1, $\color{red}{\text{y1 is an integer}}$
doesn't work.
Help please.
You specified in your query that y1,y2,y3 are all positive definite. y1+y2+y3=1 and y3 is and integer.
Or y1,y2 =0 and y3 =1, this forces x1,x2 = 0, 2 <= x3 <= 3
z reaches its minimum under this condition at x3 =2, z=1
WA is confused because of the length of the query. Appending any additional argument to the end of
minimize (y1-x1)+(x2-y2)+(1/2)*(x3), 0 <= x1 <= y1 <= 1, 0 <= y2 <= x2 <= 2*y2 <=2, 0 <= 2*y3 <= x3 <= 3*y3 <= 3, y1+y2+y3=1
will confuse WA, such as
minimize (y1-x1)+(x2-y2)+(1/2)*(x3), 0 <= x1 <= y1 <= 1, 0 <= y2 <= x2 <= 2*y2 <=2, 0 <= 2*y3 <= x3 <= 3*y3 <= 3, y1+y2+y3=1,y3=1
minimize (y1-x1)+(x2-y2)+(1/2)*(x3), 0 <= x1 <= y1 <= 1, 0 <= y2 <= x2 <= 2*y2 <=2, 0 <= 2*y3 <= x3 <= 3*y3 <= 3, y1+y2+y3=1,y2=0
minimize (y1-x1)+(x2-y2)+(1/2)*(x3), 0 <= x1 <= y1 <= 1, 0 <= y2 <= x2 <= 2*y2 <=2, 0 <= 2*y3 <= x3 <= 3*y3 <= 3, y1+y2+y3=1,y1=0
all will confuse WA