I'm doing an OTSP Problem and it gives me "Problem has no primal feasible solution"
The problem is simple. The program deals with supplying customers using delivery vehicles, the program determines the optimal routes (short distances) to satisfy the demand of the clients, so that each delivery vehicle supplies the demand of the customers without exceeding its capacity.
Note: At the moment the code is for TSP + Bus routing , but the objective is OTSP + Bus routing.
Here is the code. Thank you in advance
set Rep; # Dealer vehicles
set Cli;
param cantCli;
param cantRep;
param dem { Cli };
param capacRep { Rep };
param coordxCli { Cli };
param coordyCli { Cli };
param distCli { i in Cli , j in Cli : i != j } := sqrt((coordxCli[i] - coordxCli[j])^2 + (coordyCli[i] - coordyCli[j])^2); # Distance
var X { i in Cli, j in Cli , k in Rep : i != j }, binary; # Variable of route (used arcs)
var u { i in Cli :i != 'rep' } >= 0; # To delete de subroutes
var visitRep { i in Cli , k in Rep },binary; # 1 if dealer vehicle k visit client i.
s.t. R1 { j in Cli , k in Rep : j != 'rep' } : sum { i in Cli : i != j } X[i,j,k] = 1; # Just enter 1 arc on each client
s.t. R2 { i in Cli , k in Rep : i != 'rep' } : sum { j in Cli : i != j } X[i,j,k] = 1; # Just 1 arc leaves each client
s.t. R3 { k in Rep } : sum { i in Cli , j in Cli : j == 'rep' and i != j } X[i,j,k] <= cantRep; # All the dealer vehicles must enter to the 'rep' (depot)
s.t. R4 { k in Rep } : sum { i in Cli , j in Cli : i == 'rep' and i != j } X[i,j,k] <= cantRep; # All the dealer vehicles must leave the 'rep' (depot)
s.t. R5 { i in Cli , j in Cli , k in Rep : i != 'rep' and j != 'rep' and i != j } : u[j] - u[i] + capacRep[k] * (1 - X[i,j,k]) >= 1; # Delete subroutes
s.t. R6 { i in Cli : i != 'rep' } : sum { k in Rep } visitRep[i,k] = 1; # Each client is visited only once
s.t. R7 { k in Rep } : sum { i in Cli : i!= 'rep' } dem[i] <= capacRep[k]; # The capacity of the dealer vehicle must not be exceeded
minimize Z { k in Rep } : sum { i in Cli , j in Cli : i != j } distCli[i,j] * X[i,j,k];
solve;
for { k in Rep , i in Cli, j in Cli : i != j and X[i,j,k] == 1 } {
printf " %s %5s %5s %8s \n",i,j,k,X[i,j,k];
}
data;
param cantCli := 8;
param cantRep := 3;
param : Rep : capacRep := # The dealer Vehicles
'Rep1' 80
'Rep2' 150
'Rep3' 100;
# Clients and their choords
param : Cli : coordxCli coordyCli dem :=
'rep' 20 0 40
'c1' 40 200 30
'c2' 150 -50 20
'c3' 60 100 50
'c4' 80 150 20
'c5' 120 50 30
'c6' 150 100 30
'c7' 200 120 10
'c8' 250 50 40;
end;