0,1,2,3,... so a lot of constraints above cant be applied to my
On Aug 25, 7:49 pm, Alexander <
alexander.mit...@gmail.com> wrote:
> Ali,
>
> If the objective function does not push X in one direction you need
> more
> than one constraint.
>
> To keep things simpler forget about the indices and have the example
> if (Y1=1 or Y2=1) then X=1 else X=0.
>
> You can write the following (this may not be the unique or best way
> for
> your problem, but works)
> 1) Y1 in {0,1}, Y2 in {0,1}, X in [0,1]
>
> 2) X<= Y1 + Y2
> which ensures that X=0 if both Y1 and Y2 are 0.
> if either Y1=1 or Y2=1 the constraint becomes redundant X<=1
> if both Y1=1 and Y2=1 the constraint becomes redundant X<=2
>
> 3) X>= Y1
> which ensures that X=1 if Y1=1
> if Y1=0 the constraint becomes redundant X>=0
>
> 4) X>= Y2
> which ensures that X=1 if Y2=1
> if Y2=0 the constraint becomes redundant X>=0
>
> In general there are well-established techniques to write this type of
> constraints. Have a look at the following links to see how we used
> such