ampl: reset; model NYPD.mod.txt; data NYPD.dat.txt; ampl: expand Total_Cost, Meet_Demand; minimize Total_Cost: 120*x[1,2] + 144*x[1,3] + 144*x[1,4] + 144*x[1,5] + 144*x[1,6] + 120*x[2,3] + 144*x[2,4] + 144*x[2,5] + 144*x[2,6] + 120*x[3,4] + 144*x[3,5] + 144*x[3,6] + 120*x[4,5] + 144*x[4,6] + 120*x[5,6]; subject to Meet_Demand[1]: x[1,2] + x[1,3] + x[1,4] + x[1,5] + x[1,6] >= 8; subject to Meet_Demand[2]: x[1,2] + x[2,3] + x[2,4] + x[2,5] + x[2,6] >= 7; subject to Meet_Demand[3]: x[1,3] + x[2,3] + x[3,4] + x[3,5] + x[3,6] >= 12; subject to Meet_Demand[4]: x[1,4] + x[2,4] + x[3,4] + x[4,5] + x[4,6] >= 9; subject to Meet_Demand[5]: x[1,5] + x[2,5] + x[3,5] + x[4,5] + x[5,6] >= 6; subject to Meet_Demand[6]: x[1,6] + x[2,6] + x[3,6] + x[4,6] + x[5,6] >= 10; ampl: solve; Gurobi 10.0.0: optimal solution; objective 3216 7 simplex iterations ampl: for {i in 1..n_Shift, j in i+1..n_Shift} { if x[i,j] > 0 then printf "%d, %d : %2d\n",i,j,x[i,j];}; 1, 2 : 7 1, 6 : 1 3, 4 : 9 3, 6 : 3 5, 6 : 6 # Interpretation: # The minimum total cost to NYPD for staffing the cops is $3216. The # numbers of cops working shifts i,j in the optimal schedule are # listed above.