this is an AMPL model, I'm pretty new in this, so I'm doing a classical problem of logistics, a network flow problem, where I have to find the least expensive way to transport available blood donations in a net of cities where there are different costs in the edges. So I have to minimize its objective function (maybe is better understandable reading the code). I solve the problem right now, but now I'm facing the second task, where a fixed cost equal to 10 must be paid for each edge used for transporting blood donations (in addition to the shipping costs). For what I have understood, the question is easy. In practice I just have to add 10*numberOfEdgeUsed to the objective funcion. I want to do it in the correct way trying to add a binary variable for every edge, 1 if an edge is used, 0 if not. I'm pretty new to this kind of programmation, and I don't know how to do it. Any help is welcome. I put just the .mod code, I don't put the .dat file becouse is not necessary. This is the code of the first task, I have to modify this:
set Cities;
set Origins within (Cities);
set Destinations within (Cities);
set Link within (Cities cross Cities);
param Costs{Link};
param DemSup{Cities};
param fixedCost{(i, j) in Link} = 10;
var y{Link}, binary;
var Ship{Link} >= 0, <= 1000;
minimize Total_Cost: sum{(i,j) in Link} fixedCost[i,j] * y[i,j] + sum {(i,j) in Link} (Costs[i,j] * Ship[i,j]);
subject to Supply {i in Origins}: - sum {(i,k) in Link} Ship[i,k] >= DemSup[i];
subject to Demand {i in Destinations}: sum {(j,i) in Link} Ship[j,i] - sum {(i,k) in Link} Ship[i,k] == DemSup[i];