0
$\begingroup$

Really need help for building two constraints with MIP model, I have written the required information and variable information on the diagram below. enter image description here

The way I think of it now is to use two identifiers $A$ and $B$ to indicate whether $a$ and $b$ are $0$, if $a=0$ then $A=0$, if $b=0$ then $B=0$; And then I change the equation to

$$(e*A + f*B) * x_1 \ge V * \max\{A, B\} \tag{3} $$

$$G + (e*A + f*B) * x_2 = 1 \tag{4}$$

To achieve the purpose that $G$ is controlled by $a$ and $b$, and $x_1$, $x_2$ is $0$ when both $a$ and $b$ are $0$ the problem is, When I convert the equation format, I notice that a ZeroDivisionError occurs once both $A$ and $B$ are $0$.

$$x_1 \ge V * \frac{\max\{A, B\}}{e*A + f*B} \tag{3'}$$

$$x_2 = \frac{1-G}{e*A + f*B} \tag{4'}$$

However, when I do programming using scipy.minimize, the program does not report errors and gives results that conform to the constraints,which confuses me. Logically, when the values of $A$ and $B$ are both $0$, the constraint (3') and (4') will fail, so why does it work?

$\endgroup$
4
  • $\begingroup$ Constraints are slightly different from equations as the solver try to find a feasible solution that satisfies the constraint. With $A,B = 0$ constr $3$ turns to $V*0 \le 0$ & $4$ to $G=1$. Absent any other information constrs $1,2$ then decide the values of $x$ $\endgroup$ Commented Apr 16 at 19:04
  • $\begingroup$ @Sutanu Majumdar So your point is because of slover's features, constrs 3、 4 don't work if A,B = 0, does that mean? x1 and x2 are not restricted to zero, right?So if I add a positive coefficient to the minimizing objective function for x1 ,x2, say obj=c1*x1+c2*x2+... cn*xn, assuming there are no other constraints, will x1 and x2 be reduced to 0 because of the optimization objective? (Assuming that x1 and x2 are always greater than or equal to 0) $\endgroup$
    – CangWangu
    Commented Apr 17 at 0:47
  • $\begingroup$ @CangWangu, which kinds of variables are $e, f$? $\endgroup$
    – A.Omidi
    Commented Apr 17 at 4:51
  • $\begingroup$ @A.Omidi, e and f are two constants, and the way my program is designed is to go through range(5) twice, pick two numbers as the values of e and f, and then solve the corresponding model in the solver $\endgroup$
    – CangWangu
    Commented Apr 17 at 5:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.