dimanche 18 juin 2017

Control Flow - if condition in Julia

I'm using Julia to solve an integer program. My variables are of the form z[i,j], i in N and j in N and N=10and z[i,j] is a binary variable.

In the first half of the program, I have a set of solutions for which z[1,2]= 1 and z[1,3]=1 and all other variables are zero. Now, I need to pass these values to another set S in such a way that S={1,2,3}. I'm tried to code it in Julia, but I couldn't get it in the right way. The following is the what I've tried.Here, z_value is the way that I declare my variables z[i,j]. Can someone please help me to make it correct?

for i in N
 for j in N 
   z_value = Pair(i,j)
   if z_value == 1;
     push!(S, Pair(i,j))
     print(S)
   end
 end
end

Aucun commentaire:

Enregistrer un commentaire