Greedy heuristic approach in AMPL

Suppose I have 60 routes and 6 drones. I have a pricing subproblem model file, data file and run file to check the reduced cost for any route. When i check for drone no 1, i will check all the 60 routes and for some routes suppose i have found reduced cost.. When i check for the second drone , i want to omit those routes for which i have found the reduced cost. i will do the same process for all the 6 drones. how can i do this? i have attached my pricing subproblem model file, data file and run file. i am finding the reduced cost but i am not sure if my model is properly updating the routes for every drones.

MOD FILE:

# psA2.mod β€” Pricing Subproblem for Robust 2EVRP

# SETS

set C;
set S;
set Ds {S};
set Omega;
set Eds {S} within {(C union S), (C union S)};

# PARAMETER

# --- Physical and Demand Parameters ---
param tau_d {(i,j) in union {s in S} Eds[s]};
param W_d >= 0;
param L_max >= 0;
param Q {Omega, C} >= 0; # Added to limit deliveries

# --- Duals from the Main Problem ---
param dual_theta {S};
param dual_phi {s in S, l in Ds[s]};
param dual_rho {s in S, l in Ds[s]};
param dual_xi {C};
param dual_alpha {S, C};
param dual_beta {Omega, C};

# --- Scripting and Heuristic Parameters ---
param s_index symbolic in S;
param l_index symbolic in union {s in S} Ds[s];
param is_visited {C} binary default 0;
param M default 10000;

# --- Dynamic Set ---

# -------------------------
# VARIABLES
# -------------------------

var v {(i,j) in Eds[s_index]} binary;
var t {C union {s_index}} >= 0;
var q {omega in Omega, (i,j) in Eds[s_index]} >= 0;
var p {omega in Omega, j in C} >= 0;
# -------------------------

minimize ReducedCost:
    - dual_theta[s_index]
    - dual_phi[s_index, l_index]
    - sum {(i,j) in Eds[s_index]} dual_rho[s_index, l_index] * tau_d[i,j] * v[i,j]
    - sum {j in Cs, i in C union {s_index}: (i,j) in Eds[s_index]} dual_xi[j] * v[i,j]
    - sum {j in Cs} dual_alpha[s_index, j] * t[j]
    - sum {omega in Omega, j in Cs} dual_beta[omega, j] * p[omega,j];
# -------------------------

# Drone must not exceed its flight endurance
s.t. RangeLimit:
    sum {(i,j) in Eds[s_index]} tau_d[i,j] * v[i,j] <= W_d;

# Drone must leave the satellite at most once
s.t. StartRoute:
    sum {j in C union {s_index}: (s_index,j) in Eds[s_index]} v[s_index,j] <= 1;

# Each community in the current set can be visited at most once
s.t. VisitOnce {j in Cs}:
    sum {i in C union {s_index}: (i,j) in Eds[s_index]} v[i,j] <= 1;

# Flow conservation at community nodes
s.t. Flow {j in Cs}:
    sum {i in C union {s_index}: (i,j) in Eds[s_index]} v[i,j]
  - sum {k in C union {s_index}: (j,k) in Eds[s_index]} v[j,k] = 0;

# Timing constraints
s.t. TimeLB {i in C union {s_index}, j in C union {s_index}: (i,j) in Eds[s_index]}:
    t[j] >= t[i] + tau_d[i,j] - M * (1 - v[i,j]);

s.t. TimeUB {i in C union {s_index}, j in C union {s_index}: (i,j) in Eds[s_index]}:
    t[j] <= t[i] + tau_d[i,j] + M * (1 - v[i,j]);

# Start time at the satellite is zero
s.t. StartTime:
    t[s_index] = 0;

# Load on an arc cannot exceed drone capacity
s.t. LoadCap {omega in Omega, (i,j) in Eds[s_index]}:
    q[omega,i,j] <= v[i,j] * L_max;

# Load conservation at community nodes
s.t. FlowLoad {omega in Omega, j in Cs}:
    sum {i in C union {s_index}: (i,j) in Eds[s_index]} q[omega,i,j]
  - sum {k in C union {s_index}: (j,k) in Eds[s_index]} q[omega,j,k] = p[omega,j];

# Total delivered amount cannot exceed drone capacity
s.t. TotalLoad {omega in Omega}:
    sum {j in Cs} p[omega,j] <= L_max;
    
# Force p to zero for communities not in the current active set Cs
s.t. Enforce_p_Domain {omega in Omega, j in C: not (j in Cs)}:
    p[omega,j] = 0;

# Delivered amount cannot exceed the demand at a community
s.t. DeliveryLimit {omega in Omega, j in Cs}:
    p[omega, j] <= Q[omega, j];

DATA FILE:

set S := s1 s2 s3 s4 s5 s6 s7 s8 s9 s10;

set Ds[s1] := d1 d2 d3 d4 d5 d6;

set Ds[s2] := d1 d2 d3 d4 d5 d6;

set Ds[s3] := d1 d2 d3 d4 d5 d6;

set Ds[s4] := d1 d2 d3 d4 d5 d6;

set Ds[s5] := d1 d2 d3 d4 d5 d6;

set Ds[s6] := d1 d2 d3 d4 d5 d6;

set Ds[s7] := d1 d2 d3 d4 d5 d6;

set Ds[s8] := d1 d2 d3 d4 d5 d6;

set Ds[s9] := d1 d2 d3 d4 d5 d6;

set Ds[s10] := d1 d2 d3 d4 d5 d6;

set C :=

c1 c2 c3 c4 c5 c6 c7 c8 c9 c10

c11 c12 c13 c14 c15 c16 c17 c18 c19 c20

c21 c22 c23 c24 c25 c26 c27 c28 c29 c30

c31 c32 c33 c34 c35 c36 c37 c38 c39 c40

c41 c42 c43 c44 c45 c46 c47 c48 c49 c50

c51 c52 c53 c54 c55 c56 c57 c58 c59 c60;

set Omega := w1;

set Eds[s1] :=

(s1,c15) (c15,s1) (s1,c16) (c16,s1) (s1,c17) (c17,s1) (s1,c52) (c52,s1) (s1,c53) (c53,s1) (s1,c54) (c54,s1)

(c15,c16) (c16,c15) (c15,c17) (c17,c15) (c15,c52) (c52,c15) (c15,c53) (c53,c15) (c15,c54) (c54,c15)

(c16,c17) (c17,c16) (c16,c52) (c52,c16) (c16,c53) (c53,c16) (c16,c54) (c54,c16)

(c17,c52) (c52,c17) (c17,c53) (c53,c17) (c17,c54) (c54,c17)

(c52,c53) (c53,c52) (c52,c54) (c54,c52)

(c53,c54) (c54,c53)

;

set Eds[s2] :=

(s2,c28) (c28,s2) (s2,c37) (c37,s2) (s2,c38) (c38,s2) (s2,c47) (c47,s2) (s2,c55) (c55,s2) (s2,c56) (c56,s2)

(c28,c37) (c37,c28) (c28,c38) (c38,c28) (c28,c47) (c47,c28) (c28,c55) (c55,c28) (c28,c56) (c56,c28)

(c37,c38) (c38,c37) (c37,c47) (c47,c37) (c37,c55) (c55,c37) (c37,c56) (c56,c37)

(c38,c47) (c47,c38) (c38,c55) (c55,c38) (c38,c56) (c56,c38)

(c47,c55) (c55,c47) (c47,c56) (c56,c47)

(c55,c56) (c56,c55)

;

set Eds[s3] :=

(s3,c1) (c1,s3) (s3,c6) (c6,s3) (s3,c13) (c13,s3) (s3,c18) (c18,s3) (s3,c43) (c43,s3) (s3,c44) (c44,s3) (s3,c60) (c60,s3)

(c1,c6) (c6,c1) (c1,c13) (c13,c1) (c1,c18) (c18,c1) (c1,c43) (c43,c1) (c1,c44) (c44,c1) (c1,c60) (c60,c1)

(c6,c13) (c13,c6) (c6,c18) (c18,c6) (c6,c43) (c43,c6) (c6,c44) (c44,c6) (c6,c60) (c60,c6)

(c13,c18) (c18,c13) (c13,c43) (c43,c13) (c13,c44) (c44,c13) (c13,c60) (c60,c13)

(c18,c43) (c43,c18) (c18,c44) (c44,c18) (c18,c60) (c60,c18)

(c43,c44) (c44,c43) (c43,c60) (c60,c43)

(c44,c60) (c60,c44)

;

set Eds[s4] :=

(s4,c3) (c3,s4) (s4,c4) (c4,s4) (s4,c27) (c27,s4) (s4,c29) (c29,s4) (s4,c30) (c30,s4) (s4,c34) (c34,s4) (s4,c40) (c40,s4)

(c3,c4) (c4,c3) (c3,c27) (c27,c3) (c3,c29) (c29,c3) (c3,c30) (c30,c3) (c3,c34) (c34,c3) (c3,c40) (c40,c3)

(c4,c27) (c27,c4) (c4,c29) (c29,c4) (c4,c30) (c30,c4) (c4,c34) (c34,c4) (c4,c40) (c40,c4)

(c27,c29) (c29,c27) (c27,c30) (c30,c27) (c27,c34) (c34,c27) (c27,c40) (c40,c27)

(c29,c30) (c30,c29) (c29,c34) (c34,c29) (c29,c40) (c40,c29)

(c30,c34) (c34,c30) (c30,c40) (c40,c30)

(c34,c40) (c40,c34)

;

set Eds[s5] :=

(s5,c8) (c8,s5) (s5,c21) (c21,s5) (s5,c22) (c22,s5) (s5,c25) (c25,s5) (s5,c26) (c26,s5) (s5,c35) (c35,s5) (s5,c41) (c41,s5) (s5,c46) (c46,s5)

(c8,c21) (c21,c8) (c8,c22) (c22,c8) (c8,c25) (c25,c8) (c8,c26) (c26,c8) (c8,c35) (c35,c8) (c8,c41) (c41,c8) (c8,c46) (c46,c8)

(c21,c22) (c22,c21) (c21,c25) (c25,c21) (c21,c26) (c26,c21) (c21,c35) (c35,c21) (c21,c41) (c41,c21) (c21,c46) (c46,c21)

(c22,c25) (c25,c22) (c22,c26) (c26,c22) (c22,c35) (c35,c22) (c22,c41) (c41,c22) (c22,c46) (c46,c22)

(c25,c26) (c26,c25) (c25,c35) (c35,c25) (c25,c41) (c41,c25) (c25,c46) (c46,c25)

(c26,c35) (c35,c26) (c26,c41) (c41,c26) (c26,c46) (c46,c26)

(c35,c41) (c41,c35) (c35,c46) (c46,c35)

(c41,c46) (c46,c41)

;

set Eds[s6] :=

(s6,c13) (c13,s6) (s6,c14) (c14,s6) (s6,c33) (c33,s6) (s6,c36) (c36,s6) (s6,c50) (c50,s6) (s6,c51) (c51,s6)

(c13,c14) (c14,c13) (c13,c33) (c33,c13) (c13,c36) (c36,c13) (c13,c50) (c50,c13) (c13,c51) (c51,c13)

(c14,c33) (c33,c14) (c14,c36) (c36,c14) (c14,c50) (c50,c14) (c14,c51) (c51,c14)

(c33,c36) (c36,c33) (c33,c50) (c50,c33) (c33,c51) (c51,c33)

(c36,c50) (c50,c36) (c36,c51) (c51,c36)

(c50,c51) (c51,c50)

;

set Eds[s7] :=

(s7,c23) (c23,s7) (s7,c24) (c24,s7) (s7,c32) (c32,s7) (s7,c39) (c39,s7) (s7,c48) (c48,s7) (s7,c58) (c58,s7)

(c23,c24) (c24,c23) (c23,c32) (c32,c23) (c23,c39) (c39,c23) (c23,c48) (c48,c23) (c23,c58) (c58,c23)

(c24,c32) (c32,c24) (c24,c39) (c39,c24) (c24,c48) (c48,c24) (c24,c58) (c58,c24)

(c32,c39) (c39,c32) (c32,c48) (c48,c32) (c32,c58) (c58,c32)

(c39,c48) (c48,c39) (c39,c58) (c58,c39)

(c48,c58) (c58,c48)

;

set Eds[s8] :=

(s8,c22) (c22,s8) (s8,c25) (c25,s8) (s8,c42) (c42,s8) (s8,c45) (c45,s8) (s8,c57) (c57,s8) (s8,c59) (c59,s8)

(c22,c25) (c25,c22) (c22,c42) (c42,c22) (c22,c45) (c45,c22) (c22,c57) (c57,c22) (c22,c59) (c59,c22)

(c25,c42) (c42,c25) (c25,c45) (c45,c25) (c25,c57) (c57,c25) (c25,c59) (c59,c25)

(c42,c45) (c45,c42) (c42,c57) (c57,c42) (c42,c59) (c59,c42)

(c45,c57) (c57,c45) (c45,c59) (c59,c45)

(c57,c59) (c59,c57)

;

set Eds[s9] :=

(s9,c3) (c3,s9) (s9,c5) (c5,s9) (s9,c11) (c11,s9) (s9,c12) (c12,s9) (s9,c20) (c20,s9) (s9,c49) (c49,s9)

(c3,c5) (c5,c3) (c3,c11) (c11,c3) (c3,c12) (c12,c3) (c3,c20) (c20,c3) (c3,c49) (c49,c3)

(c5,c11) (c11,c5) (c5,c12) (c12,c5) (c5,c20) (c20,c5) (c5,c49) (c49,c5)

(c11,c12) (c12,c11) (c11,c20) (c20,c11) (c11,c49) (c49,c11)

(c12,c20) (c20,c12) (c12,c49) (c49,c12)

(c20,c49) (c49,c20)

;

set Eds[s10] :=

(s10,c2) (c2,s10) (s10,c7) (c7,s10) (s10,c9) (c9,s10) (s10,c10) (c10,s10) (s10,c19) (c19,s10) (s10,c31) (c31,s10)

(c2,c7) (c7,c2) (c2,c9) (c9,c2) (c2,c10) (c10,c2) (c2,c19) (c19,c2) (c2,c31) (c31,c2)

(c7,c9) (c9,c7) (c7,c10) (c10,c7) (c7,c19) (c19,c7) (c7,c31) (c31,c7)

(c9,c10) (c10,c9) (c9,c19) (c19,c9) (c9,c31) (c31,c9)

(c10,c19) (c19,c10) (c10,c31) (c31,c10)

(c19,c31) (c31,c19)

;

param tau_d :=

s1 c15 11.0

s1 c16 12.3

s1 c17 8.8

s1 c52 9.0

s1 c53 12.8

s1 c54 13.0

c15 s1 11.0

c15 c16 8.9

c15 c17 4.1

c15 c52 2.1

c15 c53 1.9

c15 c54 2.1

c16 s1 12.3

c16 c15 8.9

c16 c17 7.0

c16 c52 10.8

c16 c53 10.9

c16 c54 11.1

c17 s1 8.8

c17 c15 4.1

c17 c16 7.0

c17 c52 2.1

c17 c53 6.0

c17 c54 6.1

c52 s1 9.0

c52 c15 2.1

c52 c16 10.8

c52 c17 2.1

c52 c53 3.9

c52 c54 4.0

c53 s1 12.8

c53 c15 1.9

c53 c16 10.9

c53 c17 6.0

c53 c52 3.9

c53 c54 0.5

c54 s1 13.0

c54 c15 2.1

c54 c16 11.1

c54 c17 6.1

c54 c52 4.0

c54 c53 0.5

s2 c28 9.1

s2 c37 11.2

s2 c38 9.1

s2 c47 12.0

s2 c55 12.0

s2 c56 16.6

c28 s2 9.1

c28 c37 2.1

c28 c38 1.4

c28 c47 2.9

c28 c55 3.1

c28 c56 7.5

c37 s2 11.2

c37 c28 2.1

c37 c38 2.8

c37 c47 1.0

c37 c55 1.4

c37 c56 5.4

c38 s2 9.1

c38 c28 1.4

c38 c37 2.8

c38 c47 3.3

c38 c55 3.3

c38 c56 7.6

c47 s2 12.0

c47 c28 2.9

c47 c37 1.0

c47 c38 3.3

c47 c55 0.6

c47 c56 4.7

c55 s2 12.0

c55 c28 3.1

c55 c37 1.4

c55 c38 3.3

c55 c47 0.6

c55 c56 4.6

c56 s2 16.6

c56 c28 7.5

c56 c37 5.4

c56 c38 7.6

c56 c47 4.7

c56 c55 4.6

s3 c1 5.0

s3 c6 8.7

s3 c13 7.8

s3 c18 10.1

s3 c43 9.2

s3 c44 8.7

s3 c60 8.7

c1 s3 5.0

c1 c6 3.7

c1 c13 12.8

c1 c18 15.1

c1 c43 14.1

c1 c44 13.7

c1 c60 13.6

c6 s3 8.7

c6 c1 3.7

c6 c13 16.5

c6 c18 18.8

c6 c43 17.8

c6 c44 17.4

c6 c60 17.3

c13 s3 7.8

c13 c1 12.8

c13 c6 16.5

c13 c14 0.2

c13 c18 2.3

c13 c33 2.53

c13 c36 2.49

c13 c43 2.6

c13 c44 2.1

c13 c50 8.5

c13 c51 2.0

c13 c60 3.0

c13 s6 7.8

c18 s3 10.1

c18 c1 15.1

c18 c6 18.8

c18 c13 2.3

c18 c43 2.2

c18 c44 2.4

c18 c60 1.9

c43 s3 9.2

c43 c1 14.1

c43 c6 17.8

c43 c13 2.6

c43 c18 2.2

c43 c44 2.6

c43 c60 1.2

c44 s3 8.7

c44 c1 13.7

c44 c6 17.4

c44 c13 2.1

c44 c18 2.4

c44 c43 2.6

c44 c60 2.2

c60 s3 8.7

c60 c1 13.6

c60 c6 17.3

c60 c13 3.0

c60 c18 1.9

c60 c43 1.2

c60 c44 2.2

s4 c3 8.1

s4 c4 5.7

s4 c27 9.8

s4 c29 8.6

s4 c30 7.2

s4 c34 9.1

s4 c40 7.4

c3 s4 8.1

c3 c4 2.6

c3 c27 1.7

c3 c29 2.5

c3 c30 5.4

c3 c34 1.1

c3 c40 1.6

c4 s4 5.7

c4 c3 2.6

c4 c27 4.1

c4 c29 3.0

c4 c30 2.9

c4 c34 3.7

c4 c40 4.3

c27 s4 9.8

c27 c3 1.7

c27 c4 4.1

c27 c29 1.4

c27 c30 6.6

c27 c34 0.6

c27 c40 2.4

c29 s4 8.6

c29 c3 2.5

c29 c4 3.0

c29 c27 1.4

c29 c30 5.2

c29 c34 1.8

c29 c40 1.7

c30 s4 7.2

c30 c3 5.4

c30 c4 2.9

c30 c27 6.6

c30 c29 5.2

c30 c34 6.2

c30 c40 6.5

c34 s4 9.1

c34 c3 1.1

c34 c4 3.7

c34 c27 0.6

c34 c29 1.8

c34 c30 6.2

c34 c40 1.9

c40 s4 7.4

c40 c3 1.6

c40 c4 4.3

c40 c27 2.4

c40 c29 1.7

c40 c30 6.5

c40 c34 1.9

s5 c8 9.5

s5 c21 10.8

s5 c22 13.4

s5 c25 12.3

s5 c26 11.5

s5 c35 8.3

s5 c41 12.6

s5 c46 12.2

c8 s5 9.5

c8 c21 1.4

c8 c22 4.1

c8 c25 4.3

c8 c26 2.0

c8 c35 2.0

c8 c41 3.1

c8 c46 3.1

c21 s5 10.8

c21 c8 1.4

c21 c22 2.7

c21 c25 5.6

c21 c26 3.4

c21 c35 2.6

c21 c41 1.8

c21 c46 2.3

c22 s5 13.4

c22 s8 8.8

c22 c8 4.1

c22 c21 2.7

c22 c25 2.2

c22 c26 6.1

c22 c35 5.3

c22 c41 2.6

c22 c42 2.3

c22 c45 2.5

c22 c46 4.9

c22 c57 1.8

c22 c59 1.1

c25 s5 12.3

c25 s8 11.0

c25 c8 4.3

c25 c21 5.6

c25 c22 2.2

c25 c26 2.3

c25 c35 4.0

c25 c41 7.2

c25 c42 1.9

c25 c45 0.2

c25 c46 0.2

c25 c57 2.8

c25 c59 2.9

c26 s5 11.5

c26 c8 2.0

c26 c21 3.4

c26 c22 6.1

c26 c25 2.3

c26 c35 3.3

c26 c41 5.0

c26 c46 2.3

c35 s5 8.3

c35 c8 2.0

c35 c21 2.6

c35 c22 5.3

c35 c25 4.0

c35 c26 3.3

c35 c41 4.3

c35 c46 4.0

c41 s5 12.6

c41 c8 3.1

c41 c21 1.8

c41 c22 2.6

c41 c25 7.2

c41 c26 5.0

c41 c35 4.3

c41 c46 6.9

c46 s5 12.2

c46 c8 3.1

c46 c21 2.3

c46 c22 4.9

c46 c25 0.2

c46 c26 2.3

c46 c35 4.0

c46 c41 6.9

s6 c13 7.8

s6 c14 8.0

s6 c33 10.3

s6 c36 9.0

s6 c50 16.3

s6 c51 9.8

c14 s6 8.0

c14 c13 0.2

c14 c33 2.6

c14 c36 2.7

c14 c50 8.4

c14 c51 1.8

c33 s6 10.3

c33 c13 2.53

c33 c14 2.6

c33 c36 1.3

c33 c50 6.0

c33 c51 0.7

c36 s6 9.0

c36 c13 2.49

c36 c14 2.7

c36 c33 1.3

c36 c50 7.3

c36 c51 1.6

c50 s6 16.3

c50 c13 8.5

c50 c14 8.4

c50 c33 6.0

c50 c36 7.3

c50 c51 6.5

c51 s6 9.8

c51 c13 2.0

c51 c14 1.8

c51 c33 0.7

c51 c36 1.6

c51 c50 6.5

s7 c23 10.5

s7 c24 10.6

s7 c32 8.2

s7 c39 8.3

s7 c48 11.7

s7 c58 10.1

c23 s7 10.5

c23 c24 0.2

c23 c32 2.3

c23 c39 3.0

c23 c48 2.0

c23 c58 0.4

c24 s7 10.6

c24 c23 0.2

c24 c32 2.4

c24 c39 3.1

c24 c48 2.2

c24 c58 0.5

c32 s7 8.2

c32 c23 2.3

c32 c24 2.4

c32 c39 0.8

c32 c48 3.5

c32 c58 1.9

c39 s7 8.3

c39 c23 3.0

c39 c24 3.1

c39 c32 0.8

c39 c48 3.5

c39 c58 2.3

c48 s7 11.7

c48 c23 2.0

c48 c24 2.2

c48 c32 3.5

c48 c39 3.5

c48 c58 1.6

c58 s7 10.1

c58 c23 0.4

c58 c24 0.5

c58 c32 1.9

c58 c39 2.3

c58 c48 1.6

s8 c22 8.8

s8 c25 11.0

s8 c42 11.1

s8 c45 11.1

s8 c57 9.7

s8 c59 8.1

c42 s8 11.1

c42 c22 2.3

c42 c25 1.9

c42 c45 2.1

c42 c57 2.0

c42 c59 3.1

c45 s8 11.1

c45 c22 2.5

c45 c25 0.2

c45 c42 2.1

c45 c57 3.0

c45 c59 3.1

c57 s8 9.7

c57 c22 1.8

c57 c25 2.8

c57 c42 2.0

c57 c45 3.0

c57 c59 1.6

c59 s8 8.1

c59 c22 1.1

c59 c25 2.9

c59 c42 3.1

c59 c45 3.1

c59 c57 1.6

s9 c3 8.1

s9 c5 8.1

s9 c11 10.0

s9 c12 9.5

s9 c20 8.3

s9 c49 8.6

c3 s9 8.1

c3 c5 0.5

c3 c11 2.0

c3 c12 2.4

c3 c20 3.8

c3 c49 1.2

c5 s9 8.1

c5 c3 0.5

c5 c11 1.9

c5 c12 2.4

c5 c20 3.7

c5 c49 0.8

c11 s9 10.0

c11 c3 2.0

c11 c5 1.9

c11 c12 0.5

c11 c20 1.8

c11 c49 2.6

c12 s9 9.5

c12 c3 2.4

c12 c5 2.4

c12 c11 0.5

c12 c20 1.3

c12 c49 2.4

c20 s9 8.3

c20 c3 3.8

c20 c5 3.7

c20 c11 1.8

c20 c12 1.3

c20 c49 3.7

c49 s9 8.6

c49 c3 1.2

c49 c5 0.8

c49 c11 2.6

c49 c12 2.4

c49 c20 3.7

s10 c2 9.9

s10 c7 10.3

s10 c9 10.6

s10 c10 11.0

s10 c19 8.7

s10 c31 8.8

c2 s10 9.9

c2 c7 0.4

c2 c9 1.7

c2 c10 1.2

c2 c19 2.3

c2 c31 1.1

c7 s10 10.3

c7 c2 0.4

c7 c9 1.4

c7 c10 0.8

c7 c19 2.1

c7 c31 1.5

c9 s10 10.6

c9 c2 1.7

c9 c7 1.4

c9 c10 0.5

c9 c19 2.1

c9 c31 2.8

c10 s10 11.0

c10 c2 1.2

c10 c7 0.8

c10 c9 0.5

c10 c19 2.4

c10 c31 2.2

c19 s10 8.7

c19 c2 2.3

c19 c7 2.1

c19 c9 2.1

c19 c10 2.4

c19 c31 1.2

c31 s10 8.8

c31 c2 1.1

c31 c7 1.5

c31 c9 2.8

c31 c10 2.2

c31 c19 1.2

;

param W_d := 35;

param L_max := 25;

param Q :=

w1 c1 7

w1 c2 3

w1 c3 13

w1 c4 4

w1 c5 8

w1 c6 10

w1 c7 5

w1 c8 4

w1 c9 10

w1 c10 3

w1 c11 4

w1 c12 8

w1 c13 8

w1 c14 9

w1 c15 9

w1 c16 9

w1 c17 4

w1 c18 8

w1 c19 11

w1 c20 8

w1 c21 5

w1 c22 6

w1 c23 5

w1 c24 5

w1 c25 9

w1 c26 8

w1 c27 13

w1 c28 8

w1 c29 3

w1 c30 5

w1 c31 3

w1 c32 6

w1 c33 6

w1 c34 7

w1 c35 6

w1 c36 5

w1 c37 15

w1 c38 3

w1 c39 3

w1 c40 8

w1 c41 9

w1 c42 5

w1 c43 8

w1 c44 8

w1 c45 9

w1 c46 9

w1 c47 3

w1 c48 6

w1 c49 6

w1 c50 2

w1 c51 9

w1 c52 9

w1 c53 6

w1 c54 6

w1 c55 4

w1 c56 7

w1 c57 7

w1 c58 5

w1 c59 5

w1 c60 14

;

param dual_theta :=

s1 0

s2 -6.16843e-12

s3 3.04451e-11

s4 -3.63798e-12

s5 1.5247e-11

s6 1.53083e-12

s7 2.72848e-12

s8 -2.50043e-12

s9 -3.22551e-11

s10 -7.52298e-12

;

param dual_phi :=

[s1,d1] 0 [s1,d2] 0 [s1,d3] 0 [s1,d4] 0 [s1,d5] 0 [s1,d6] 0

[s2,d1] 1.73372e-11 [s2,d2] 7.27596e-12 [s2,d3] 1.81899e-11 [s2,d4] 1.73372e-11 [s2,d5] -2.06654e-11 [s2,d6] 0

[s3,d1] -3.25278e-11 [s3,d2] -3.20801e-11 [s3,d3] -3.25278e-11 [s3,d4] -4.18791e-11 [s3,d5] 0 [s3,d6] -4.36557e-11

[s4,d1] 0 [s4,d2] 0 [s4,d3] 0 [s4,d4] 0 [s4,d5] 0 [s4,d6] 0

[s5,d1] -1.23882e-11 [s5,d2] -1.81899e-11 [s5,d3] -3.42402e-12 [s5,d4] -3.92902e-11 [s5,d5] 0 [s5,d6] -1.81899e-11

[s6,d1] 6.02751e-12 [s6,d2] -4.69051e-12 [s6,d3] 0 [s6,d4] -1.0522e-11 [s6,d5] 0 [s6,d6] 0

[s7,d1] -3.63798e-12 [s7,d2] 0 [s7,d3] -8.70662e-13 [s7,d4] -3.63798e-12 [s7,d5] 0 [s7,d6] -3.63798e-12

[s8,d1] 5.80438e-12 [s8,d2] -2.67733e-12 [s8,d3] 7.01204e-12 [s8,d4] 2.91038e-11 [s8,d5] 0 [s8,d6] -2.43085e-11

[s9,d1] 4.4661e-11 [s9,d2] 2.9774e-11 [s9,d3] 2.9774e-11 [s9,d4] 7.27596e-11 [s9,d5] 0 [s9,d6] 1.65624e-11

[s10,d1] 0 [s10,d2] 3.88051e-11 [s10,d3] 2.22968e-11 [s10,d4] -3.05159e-11 [s10,d5] 0 [s10,d6] 1.45519e-11

;

param dual_rho :=

[s1,d1] 2.84217e-14 [s1,d2] 0 [s1,d3] 0 [s1,d4] 0 [s1,d5] 0 [s1,d6] 0

[s2,d1] -3.41061e-13 [s2,d2] -3.7867e-14 [s2,d3] -3.48207e-13 [s2,d4] -3.41061e-13 [s2,d5] 8.71628e-13 [s2,d6] 2.55795e-13

[s3,d1] 7.52339e-14 [s3,d2] 6.08187e-14 [s3,d3] 7.52339e-14 [s3,d4] 3.88545e-13 [s3,d5] -1.08002e-12 [s3,d6] 4.47963e-13

[s4,d1] -1.42109e-14 [s4,d2] -1.42109e-14 [s4,d3] 0 [s4,d4] -1.42109e-14 [s4,d5] -1.42109e-14 [s4,d6] -1.42109e-14

[s5,d1] -1.22684e-13 [s5,d2] 8.50121e-14 [s5,d3] -3.53144e-13 [s5,d4] 7.57912e-13 [s5,d5] -5.11591e-13 [s5,d6] 8.50121e-14

[s6,d1] -2.92921e-13 [s6,d2] 7.09393e-14 [s6,d3] -7.6561e-14 [s6,d4] 2.54319e-13 [s6,d5] -7.6561e-14 [s6,d6] -7.6561e-14

[s7,d1] -9.1637e-14 [s7,d2] -1.206e-13 [s7,d3] -1.58788e-13 [s7,d4] -9.1637e-14 [s7,d5] -1.77444e-13 [s7,d6] -9.1637e-14

[s8,d1] -4.38866e-14 [s8,d2] 2.18341e-13 [s8,d3] -9.02373e-14 [s8,d4] -7.54236e-13 [s8,d5] 1.33076e-13 [s8,d6] 8.7419e-13

[s9,d1] -3.90476e-13 [s9,d2] 1.22662e-13 [s9,d3] 1.22662e-13 [s9,d4] -1.31782e-12 [s9,d5] 1.13687e-12 [s9,d6] 5.36871e-13

[s10,d1] 2.55795e-13 [s10,d2] -9.31674e-13 [s10,d3] -4.54747e-13 [s10,d4] 1.16672e-12 [s10,d5] 2.55795e-13 [s10,d6] -1.7859e-13

;

param dual_xi :=

c1 4026.5 c11 9183.9 c21 5579.9 c31 10000 c41 10000 c51 10000

c2 9001.9 c12 4153.3 c22 9689.7 c32 6466.7 c42 5965.4 c52 10000

c3 4328.1 c13 9335.6 c23 6584 c33 5720.4 c43 5722.8 c53 6906.1

c4 8067.8 c14 10000 c24 10000 c34 10000 c44 10000 c54 10000

c5 10000 c15 10000 c25 10000 c35 10000 c45 10000 c55 10000

c6 10000 c16 1228.9 c26 2639.4 c36 8486.3 c46 10000 c56 10000

c7 10000 c17 8013.1 c27 3090.6 c37 6654.8 c47 9170.8 c57 5771.5

c8 7315.1 c18 9140.1 c28 10000 c38 4106.6 c48 4703.6 c58 10000

c9 8532.3 c19 9827.6 c29 10000 c39 10000 c49 10000 c59 10000

c10 10000 c20 10000 c30 4870.5 c40 10000 c50 10000 c60 10000

;

param dual_alpha default 0 :=

[s3,c1] 1 [s10,c2] 1 [s9,c3] 1 [s4,c4] 1 [s9,c5] 1 [s3,c6] 1 [s10,c7] 1 [s5,c8] 1 [s10,c9] 1

[s10,c10] 1 [s9,c11] 1 [s9,c12] 1 [s6,c13] 1 [s6,c14] 1 [s1,c15] 1 [s1,c16] 1 [s1,c17] 1 [s3,c18] 1

[s10,c19] 1 [s9,c20] 1 [s5,c21] 1 [s8,c22] 1 [s7,c23] 1 [s7,c24] 1 [s8,c25] 1 [s5,c26] 1 [s4,c27] 1

[s2,c28] 1 [s4,c29] 1 [s4,c30] 1 [s10,c31] 1 [s7,c32] 1 [s6,c33] 1 [s4,c34] 1 [s5,c35] 1 [s6,c36] 1

[s2,c37] 1 [s2,c38] 1 [s7,c39] 1 [s4,c40] 1 [s5,c41] 1 [s8,c42] 1 [s3,c43] 1 [s3,c44] 1 [s8,c45] 1

[s5,c46] 1 [s2,c47] 1 [s7,c48] 1 [s9,c49] 1 [s6,c50] 1 [s6,c51] 1 [s1,c52] 1 [s1,c53] 1 [s1,c54] 1

[s2,c55] 1 [s2,c56] 1 [s8,c57] 1 [s7,c58] 1 [s8,c59] 1 [s3,c60] 1

;

param dual_beta default 0 :=

[w1,c1] 856 [w1,c2] 342 [w1,c4] 488 [w1,c5] 712 [w1,c8] 678 [w1,c10] 499 [w1,c11] 211

[w1,c12] 734 [w1,c13] 86 [w1,c15] 978 [w1,c17] 503 [w1,c18] 111 [w1,c21] 890 [w1,c22] 56

[w1,c24] 689 [w1,c26] 924 [w1,c28] 740 [w1,c31] 66 [w1,c32] 593 [w1,c33] 718 [w1,c34] 991

[w1,c40] 644 [w1,c42] 813 [w1,c43] 538 [w1,c48] 888 [w1,c50] 770 [w1,c54] 521 [w1,c55] 844

[w1,c56] 123 [w1,c57] 608

;

param M := 10000;

RUN FILE:

# === 1. Load Model and Data ===

model psA2.mod;
data psA3.dat;

# === 2. Set Solver Options ===
option solver cplex;
option cplex_options 'timelimit=300 mipgap=0.01';

# === 3. Initialize Global Flag ===
param any_negative_rc_found default 0; # This is the "master" flag

# === 4. Main Loop for all Satellites and Drones ===
for {s_current in S} {
    for {l_current in Ds[s_current]} {

        # Set the indices for the current run
        let s_index := s_current;
        let l_index := l_current;
        
        # --- Diagnostic: Check tau_d completeness before solving ---
        # Diagnostic check for undefined tau_d values for current satellite s_index

        printf "\nChecking for missing tau_d entries for satellite %s...\n", s_index;

        for {(i,j) in Eds[s_index]} {
          if (tau_d[i,j] == Infinity) then {
            printf " Missing tau_d[%s,%s]\n", i, j;
          }
        }
        

        # Solve the pricing subproblem for this specific (s, l) pair
        solve;

        # Display the results for this run
        if ReducedCost < -1e-6 then {
            # If a good route is found, set the master flag to 1
            let any_negative_rc_found := 1;
            
            printf "\n*** Improving route FOUND for satellite %s, drone %s (RC = %.6f) ***\n", s_index, l_index, ReducedCost;
            # (You can add more printf statements here if you want to see route details)

        } else {
            printf "\nNo improving route found for satellite %s, drone %s (RC = %.6f)\n", s_index, l_index, ReducedCost;
        }
        printf "============================================================\n";
    }
}

# === 5. Display the Final Overall Result ===
printf "\n--- Overall Result ---";
display any_negative_rc_found;

Check step 3 and 4. i want my model to follow this.

1 Like

Hi @Ahsan ,

It doesn’t make much sense to use Ampl that way to implement your Algorithm. Could you try implementing the steps using Amplpy instead from Python?

You can use your model in Ampl language but then all the data and the algorithm will happen in Python through the Api. It’s much more convenient to use.

Here there are plenty of examples of similar problems solved that way:

If you have some concrete doubt, please do not hesitate to ask!