Reputation: 31
I'm looking for a way to extract a matrix from a system of equations in Julia or Python. I'm solving a MILP problem which is built with a lot of variables. Thus, my constraints are expressed as sums of variables (<=/ ==/ >=) to integers. And I would like to create the matrix associated with the A.x = b form (my objective is to determine whether the matrix is totally unimodular).
Can anyone help me doing this ? I'm open to all propositions.
Thanks in advance.
Upvotes: 1
Views: 263
Reputation: 31
Yes, it is something like :
[v in 1:Nb_vehicles], sum(x[1, j, v, s] for j in 2:Nb_nodes, s in 1:Nb_actions) == 1
[v in 1:Nb_vehicles], sum(x[j, 1, v, s] for j in 2:Nb_nodes, s in 1:Nb_actions) == 1
[v in 1:Nb_vehicles, k in 1:Nb_targets, s1 in 1:Nb_actions, s2 in 1:Nb_actions], sum(x[1,j,v,s2] * d[1, j] for j in targets[k,:])/ ω[v] <= t[k, v, s2] + M * (1 - sum(x[1,i,v,s2] for i in targets[k,:]))
with the x[i,j,v,s] and t[k,v,s] as variables
Upvotes: 1