0
$\begingroup$

Imagine that I have two variables fw (>= 0) and a (binary) and my objective function is to minimize: fw.

In the constraints part, I want to ensure (among other things that are not important here) that if fw > 0, then a == 1. To ensure this, I used the following expression:

M * a >= fw; #(M is a big constant)

The problem is I also want to ensure that when fw == 0, then a == 0 , and the restriction above is not sufficient (due to the fact that a is not in the objective function). Is there any way to ensure this without adding a to the objective function?

$\endgroup$
0
$\begingroup$

Let's assume M=upper bound of fw (choose as small as possible). Then

0.01 a <= fw <= M a
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.