I am writing a linear program in python gurobi
and I am trying to create some constraints only including a multiplication of the elements of two lists but excluding the zeros. More specifically: A
is a list that contains only positive or zero elements, B
is a list with binary variables demonstrating the positions where there are zeros in A list, for example:
A=[1,2,0,3,0]
B=[1,1,0,1,0]
I want to add some constraints including only the A[x]*B[x]
but not the zeros.
Anybody has any idea how this could be done?