# PULP : Constraint violation - multiple of expected value

I am developing a linear programming model in PULP that sends material from Origin Facilities to Transfer and Final Treatment Facilities. The objective function is based on summing the transport and treatment costs for each of:

• Origin to Transfer Facilities
• Origin to Final Facilities
• Transfer to Final Facilities

The constraints are:

• Origin Facilities demand requirement (must equal)
• Transfer and Final Facility Capacity (must not exceed)
• All material that goes to a Transfer must then go to a Final Facility but the Transfer facility reduces the quantity by a given factor
• Some constraints that certain facilities cannot go to some facilities due to material type (done this for only Facility A to T1 for now)

Model

Objective Function

$$\sum_\limits{o=1}^{O}\sum_\limits{T=1}^{T}{}V_{O,T} *C{_T}*T_{O,T}+\sum_\limits{o=1}^{O}\sum_\limits{F=1}^{F}V_{O,F} *C{_F}*T_{O,F}+\sum_\limits{T=1}^{T}\sum_\limits{F=1}^{F}V_{T,F} *C{_F}*T_{T,F}$$

Where $$O,T$$ & $$F$$ subscripts correspond to Origin, Transfer and Final respectively and $$V_{i,j}$$ is the material exported from facility $$i$$ to facility $$j$$. $$C_{i}$$ is the Treatment cost at facility type $$i$$ and $$T_{i,j}$$ is the Transport cost from facility $$i$$ to facility $$j$$. The model is to sum across all decision variables of type $$V_{i,j}$$ in each instance - apologies but not sure how best to represent this in mathematical / LaTeX notation.

Constraints

$$\sum_\limits{T=1}^{T}V_{O,T}+\sum_\limits{F=1}^{F}V_{O,F} = D{_O}$$ for $$O = 1 .... O$$

Where $$D{_O}$$ is origin facility demand.

$$\sum_\limits{o=1}^{O}{}V_{O,T} \le Q{_T}$$ for $$T = 1 .... T$$

Where $$Q{_T}$$ is Transfer facility capacity.

$$\sum_\limits{o=1}^{O}{}V_{O,F} + \sum_\limits{T=1}^{T}{}V_{T,F} \le Q{_F}$$ for $$F = 1 ... F$$

Where $$Q{_F}$$ is Final facility capacity.

$$\sum_\limits{o=1}^{O}{}(V_{O,T}*S{{_O}/100}) - \sum_\limits{F=1}^{F}{}(V_{T,F}*S{_T}/100) = 0$$ for $$T = 1... T$$

Where $$S{_O}$$ and $$S{_T}$$ is the Origin and Transfer facility material reduction factor respectively.

$$V_{A,T1}= 0$$

Issue

I am having issues with the Origin Demand requirement not being met according to the figures given in the OriginReq list. When printing the variable names and values, it seems that the solution only meets 20% of the demand given in the list for each Origin Facility. I'm unsure why this is given the construction of the constraint is to be equal to ORDict which is the dictionary version of the OriginReq list with the Origin Facility names as the keys. See below for the LP File, the issue seems to be in the coefficients of the constraints not being the values that I expect - especially for C1-9 as they shouldn't have a coefficient at all.

See code,the value of the variables upon solving and the LP file below.

Code

from pulp import *

def logdictcreation(dictname, dict1, dict2):
varlist = []
for i in range(0, len(dict1) * len(dict2)):
varlist.append(i)

y = 0

for i in dict1:
dynamiclist = []
for x in dict2:
dynamiclist.append(varlist[y])
y = y + 1

zipped = zip(dict2, dynamiclist)
newdict = dict(zipped)
tempdict = {i: newdict}
dictname.update(tempdict)

# Defining Dictionaries

Origin = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]
Transfer = ["T1", "T2", "T3"]
Final = ["F1", "F2", "F3", "F4", "F5"]

TransferCapacity = [500, 500, 500]
OriginReq = [100, 1000, 500, 400, 300, 600, 100, 50, 75, 90]
FinalCapacity = [2000, 3000, 500, 250, 200]

TCZip = zip(Transfer, TransferCapacity)
ORZip = zip(Origin, OriginReq)
FCZip = zip(Final, FinalCapacity)

TransferCost = {"T1": 40, "T2": 25, "T3": 15}
FinalCost = {"F1": 90, "F2": 80, "F3": 150, "F4": 80, "F5": 20}

OtTLogDict = {}
OtFLogDict = {}
TtFLogDict = {}

logdictcreation(OtTLogDict,Origin,Transfer)
logdictcreation(OtFLogDict,Origin,Final)
logdictcreation(TtFLogDict,Transfer,Final)

TCDict = dict(TCZip)
ORDict = dict(ORZip)
FCDict = dict(FCZip)

OriginDS = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
TransferDS = [27, 27, 6]

ODSZip = zip(Origin, OriginDS)
TDSZip = zip(Transfer, TransferDS)

ODSDict = dict(ODSZip)
TDSDict = dict(TDSZip)

OZip = zip(Origin, OriginTypes)
TZip = zip(Transfer, TransferTypes)
FZip = zip(Final, FinalTypes)

ODict = dict(OZip)
TDict = dict(TZip)
FDict = dict(FZip)

OtFroutes = [(i, j) for i in Origin for j in Final]
TtFroutes = [(i, j) for i in Transfer for j in Final]
OtTroutes = [(i, j) for i in Origin for j in Transfer]

# Problem Definition

model = LpProblem("Cost Optimiser", LpMinimize)

#Decision Variables
OtT_Vars = LpVariable.dicts("Origin_to_Transfer_Volume_Exported", (Origin, Transfer), lowBound=0, cat=LpContinuous)

OtF_Vars = LpVariable.dicts("Origin_to_Final_Volume_Exported", (Origin, Final), lowBound=0, cat=LpContinuous)

TtF_Vars = LpVariable.dicts("Transfer_to_Final_Volume_Exported", (Transfer, Final), lowBound=0, cat=LpContinuous)

#Objective Function

model += lpSum(OtT_Vars[i][j]*(OtTLogDict[i][j]+TransferCost[j])+(OtF_Vars[a][b]*(OtFLogDict[a][b]+FinalCost[b])) +
(TtF_Vars[c][d]*(TtFLogDict[c][d]+FinalCost[d]))
for (i, j) in OtTroutes for (a, b) in OtFroutes for (c, d) in TtFroutes)

#Constraints

for i in Origin:
model += lpSum(OtT_Vars[i][j] + OtF_Vars[i][z] for j in Transfer for z in Final) == ORDict[i]

for j in Transfer:
model += lpSum(OtT_Vars[i][j] for i in Origin) <= TCDict[j]

for j in Final:
model += lpSum(OtF_Vars[i][j]+TtF_Vars[z][j] for i in Origin for z in Transfer) <= FCDict[j]

for j in Transfer:
model += lpSum((OtT_Vars[i][j]*(ODSDict[i]/100))-(TtF_Vars[j][z]*(TDSDict[j]/100))
for i in Origin for z in Final) == 0

model += lpSum(OtT_Vars["A"]["T1"]) == 0

model.solve()

print("Status:", LpStatus[model.status])

print("All Variables")
for v in model.variables():
print(v.name, "=", v.varValue)


Variable Values

Origin_to_Final_Volume_Exported_A_F1 = 0.0
Origin_to_Final_Volume_Exported_A_F2 = 0.0
Origin_to_Final_Volume_Exported_A_F3 = 0.0
Origin_to_Final_Volume_Exported_A_F4 = 0.0
Origin_to_Final_Volume_Exported_A_F5 = 0.0
Origin_to_Final_Volume_Exported_B_F1 = 0.0
Origin_to_Final_Volume_Exported_B_F2 = 0.0
Origin_to_Final_Volume_Exported_B_F3 = 0.0
Origin_to_Final_Volume_Exported_B_F4 = 0.0
Origin_to_Final_Volume_Exported_B_F5 = 0.0
Origin_to_Final_Volume_Exported_C_F1 = 0.0
Origin_to_Final_Volume_Exported_C_F2 = 0.0
Origin_to_Final_Volume_Exported_C_F3 = 0.0
Origin_to_Final_Volume_Exported_C_F4 = 0.0
Origin_to_Final_Volume_Exported_C_F5 = 0.0
Origin_to_Final_Volume_Exported_D_F1 = 0.0
Origin_to_Final_Volume_Exported_D_F2 = 0.0
Origin_to_Final_Volume_Exported_D_F3 = 0.0
Origin_to_Final_Volume_Exported_D_F4 = 0.0
Origin_to_Final_Volume_Exported_D_F5 = 0.0
Origin_to_Final_Volume_Exported_E_F1 = 0.0
Origin_to_Final_Volume_Exported_E_F2 = 0.0
Origin_to_Final_Volume_Exported_E_F3 = 0.0
Origin_to_Final_Volume_Exported_E_F4 = 0.0
Origin_to_Final_Volume_Exported_E_F5 = 0.0
Origin_to_Final_Volume_Exported_F_F1 = 0.0
Origin_to_Final_Volume_Exported_F_F2 = 0.0
Origin_to_Final_Volume_Exported_F_F3 = 0.0
Origin_to_Final_Volume_Exported_F_F4 = 0.0
Origin_to_Final_Volume_Exported_F_F5 = 0.0
Origin_to_Final_Volume_Exported_G_F1 = 0.0
Origin_to_Final_Volume_Exported_G_F2 = 0.0
Origin_to_Final_Volume_Exported_G_F3 = 0.0
Origin_to_Final_Volume_Exported_G_F4 = 0.0
Origin_to_Final_Volume_Exported_G_F5 = 0.0
Origin_to_Final_Volume_Exported_H_F1 = 0.0
Origin_to_Final_Volume_Exported_H_F2 = 0.0
Origin_to_Final_Volume_Exported_H_F3 = 0.0
Origin_to_Final_Volume_Exported_H_F4 = 0.0
Origin_to_Final_Volume_Exported_H_F5 = 0.0
Origin_to_Final_Volume_Exported_I_F1 = 0.0
Origin_to_Final_Volume_Exported_I_F2 = 0.0
Origin_to_Final_Volume_Exported_I_F3 = 0.0
Origin_to_Final_Volume_Exported_I_F4 = 0.0
Origin_to_Final_Volume_Exported_I_F5 = 0.0
Origin_to_Final_Volume_Exported_J_F1 = 0.0
Origin_to_Final_Volume_Exported_J_F2 = 0.0
Origin_to_Final_Volume_Exported_J_F3 = 0.0
Origin_to_Final_Volume_Exported_J_F4 = 0.0
Origin_to_Final_Volume_Exported_J_F5 = 0.0
Origin_to_Transfer_Volume_Exported_A_T1 = 0.0
Origin_to_Transfer_Volume_Exported_A_T2 = 20.0
Origin_to_Transfer_Volume_Exported_A_T3 = 0.0
Origin_to_Transfer_Volume_Exported_B_T1 = 0.0
Origin_to_Transfer_Volume_Exported_B_T2 = 200.0
Origin_to_Transfer_Volume_Exported_B_T3 = 0.0
Origin_to_Transfer_Volume_Exported_C_T1 = 0.0
Origin_to_Transfer_Volume_Exported_C_T2 = 100.0
Origin_to_Transfer_Volume_Exported_C_T3 = 0.0
Origin_to_Transfer_Volume_Exported_D_T1 = 0.0
Origin_to_Transfer_Volume_Exported_D_T2 = 80.0
Origin_to_Transfer_Volume_Exported_D_T3 = 0.0
Origin_to_Transfer_Volume_Exported_E_T1 = 0.0
Origin_to_Transfer_Volume_Exported_E_T2 = 60.0
Origin_to_Transfer_Volume_Exported_E_T3 = 0.0
Origin_to_Transfer_Volume_Exported_F_T1 = 80.0
Origin_to_Transfer_Volume_Exported_F_T2 = 40.0
Origin_to_Transfer_Volume_Exported_F_T3 = 0.0
Origin_to_Transfer_Volume_Exported_G_T1 = 20.0
Origin_to_Transfer_Volume_Exported_G_T2 = 0.0
Origin_to_Transfer_Volume_Exported_G_T3 = 0.0
Origin_to_Transfer_Volume_Exported_H_T1 = 10.0
Origin_to_Transfer_Volume_Exported_H_T2 = 0.0
Origin_to_Transfer_Volume_Exported_H_T3 = 0.0
Origin_to_Transfer_Volume_Exported_I_T1 = 15.0
Origin_to_Transfer_Volume_Exported_I_T2 = 0.0
Origin_to_Transfer_Volume_Exported_I_T3 = 0.0
Origin_to_Transfer_Volume_Exported_J_T1 = 18.0
Origin_to_Transfer_Volume_Exported_J_T2 = 0.0
Origin_to_Transfer_Volume_Exported_J_T3 = 0.0
Transfer_to_Final_Volume_Exported_T1_F1 = 0.0
Transfer_to_Final_Volume_Exported_T1_F2 = 0.0
Transfer_to_Final_Volume_Exported_T1_F3 = 0.0
Transfer_to_Final_Volume_Exported_T1_F4 = 0.0
Transfer_to_Final_Volume_Exported_T1_F5 = 7.9444444
Transfer_to_Final_Volume_Exported_T2_F1 = 0.0
Transfer_to_Final_Volume_Exported_T2_F2 = 15.722222
Transfer_to_Final_Volume_Exported_T2_F3 = 0.0
Transfer_to_Final_Volume_Exported_T2_F4 = 0.0
Transfer_to_Final_Volume_Exported_T2_F5 = 12.055556
Transfer_to_Final_Volume_Exported_T3_F1 = 0.0
Transfer_to_Final_Volume_Exported_T3_F2 = 0.0
Transfer_to_Final_Volume_Exported_T3_F3 = 0.0
Transfer_to_Final_Volume_Exported_T3_F4 = 0.0
Transfer_to_Final_Volume_Exported_T3_F5 = 0.0


LP File

Minimize
OBJ: 40500 Origin_to_Final_Volume_Exported_A_F1
+ 36450 Origin_to_Final_Volume_Exported_A_F2
+ 68400 Origin_to_Final_Volume_Exported_A_F3
+ 37350 Origin_to_Final_Volume_Exported_A_F4
+ 10800 Origin_to_Final_Volume_Exported_A_F5
+ 42750 Origin_to_Final_Volume_Exported_B_F1
+ 38700 Origin_to_Final_Volume_Exported_B_F2
+ 70650 Origin_to_Final_Volume_Exported_B_F3
+ 39600 Origin_to_Final_Volume_Exported_B_F4
+ 13050 Origin_to_Final_Volume_Exported_B_F5
+ 45000 Origin_to_Final_Volume_Exported_C_F1
+ 40950 Origin_to_Final_Volume_Exported_C_F2
+ 72900 Origin_to_Final_Volume_Exported_C_F3
+ 41850 Origin_to_Final_Volume_Exported_C_F4
+ 15300 Origin_to_Final_Volume_Exported_C_F5
+ 47250 Origin_to_Final_Volume_Exported_D_F1
+ 43200 Origin_to_Final_Volume_Exported_D_F2
+ 75150 Origin_to_Final_Volume_Exported_D_F3
+ 44100 Origin_to_Final_Volume_Exported_D_F4
+ 17550 Origin_to_Final_Volume_Exported_D_F5
+ 49500 Origin_to_Final_Volume_Exported_E_F1
+ 45450 Origin_to_Final_Volume_Exported_E_F2
+ 77400 Origin_to_Final_Volume_Exported_E_F3
+ 46350 Origin_to_Final_Volume_Exported_E_F4
+ 19800 Origin_to_Final_Volume_Exported_E_F5
+ 51750 Origin_to_Final_Volume_Exported_F_F1
+ 47700 Origin_to_Final_Volume_Exported_F_F2
+ 79650 Origin_to_Final_Volume_Exported_F_F3
+ 48600 Origin_to_Final_Volume_Exported_F_F4
+ 22050 Origin_to_Final_Volume_Exported_F_F5
+ 54000 Origin_to_Final_Volume_Exported_G_F1
+ 49950 Origin_to_Final_Volume_Exported_G_F2
+ 81900 Origin_to_Final_Volume_Exported_G_F3
+ 50850 Origin_to_Final_Volume_Exported_G_F4
+ 24300 Origin_to_Final_Volume_Exported_G_F5
+ 56250 Origin_to_Final_Volume_Exported_H_F1
+ 52200 Origin_to_Final_Volume_Exported_H_F2
+ 84150 Origin_to_Final_Volume_Exported_H_F3
+ 53100 Origin_to_Final_Volume_Exported_H_F4
+ 26550 Origin_to_Final_Volume_Exported_H_F5
+ 58500 Origin_to_Final_Volume_Exported_I_F1
+ 54450 Origin_to_Final_Volume_Exported_I_F2
+ 86400 Origin_to_Final_Volume_Exported_I_F3
+ 55350 Origin_to_Final_Volume_Exported_I_F4
+ 28800 Origin_to_Final_Volume_Exported_I_F5
+ 60750 Origin_to_Final_Volume_Exported_J_F1
+ 56700 Origin_to_Final_Volume_Exported_J_F2
+ 88650 Origin_to_Final_Volume_Exported_J_F3
+ 57600 Origin_to_Final_Volume_Exported_J_F4
+ 31050 Origin_to_Final_Volume_Exported_J_F5
+ 30000 Origin_to_Transfer_Volume_Exported_A_T1
+ 19500 Origin_to_Transfer_Volume_Exported_A_T2
+ 12750 Origin_to_Transfer_Volume_Exported_A_T3
+ 32250 Origin_to_Transfer_Volume_Exported_B_T1
+ 21750 Origin_to_Transfer_Volume_Exported_B_T2
+ 15000 Origin_to_Transfer_Volume_Exported_B_T3
+ 34500 Origin_to_Transfer_Volume_Exported_C_T1
+ 24000 Origin_to_Transfer_Volume_Exported_C_T2
+ 17250 Origin_to_Transfer_Volume_Exported_C_T3
+ 36750 Origin_to_Transfer_Volume_Exported_D_T1
+ 26250 Origin_to_Transfer_Volume_Exported_D_T2
+ 19500 Origin_to_Transfer_Volume_Exported_D_T3
+ 39000 Origin_to_Transfer_Volume_Exported_E_T1
+ 28500 Origin_to_Transfer_Volume_Exported_E_T2
+ 21750 Origin_to_Transfer_Volume_Exported_E_T3
+ 41250 Origin_to_Transfer_Volume_Exported_F_T1
+ 30750 Origin_to_Transfer_Volume_Exported_F_T2
+ 24000 Origin_to_Transfer_Volume_Exported_F_T3
+ 43500 Origin_to_Transfer_Volume_Exported_G_T1
+ 33000 Origin_to_Transfer_Volume_Exported_G_T2
+ 26250 Origin_to_Transfer_Volume_Exported_G_T3
+ 45750 Origin_to_Transfer_Volume_Exported_H_T1
+ 35250 Origin_to_Transfer_Volume_Exported_H_T2
+ 28500 Origin_to_Transfer_Volume_Exported_H_T3
+ 48000 Origin_to_Transfer_Volume_Exported_I_T1
+ 37500 Origin_to_Transfer_Volume_Exported_I_T2
+ 30750 Origin_to_Transfer_Volume_Exported_I_T3
+ 50250 Origin_to_Transfer_Volume_Exported_J_T1
+ 39750 Origin_to_Transfer_Volume_Exported_J_T2
+ 33000 Origin_to_Transfer_Volume_Exported_J_T3
+ 135000 Transfer_to_Final_Volume_Exported_T1_F1
+ 121500 Transfer_to_Final_Volume_Exported_T1_F2
+ 228000 Transfer_to_Final_Volume_Exported_T1_F3
+ 124500 Transfer_to_Final_Volume_Exported_T1_F4
+ 36000 Transfer_to_Final_Volume_Exported_T1_F5
+ 142500 Transfer_to_Final_Volume_Exported_T2_F1
+ 129000 Transfer_to_Final_Volume_Exported_T2_F2
+ 235500 Transfer_to_Final_Volume_Exported_T2_F3
+ 132000 Transfer_to_Final_Volume_Exported_T2_F4
+ 43500 Transfer_to_Final_Volume_Exported_T2_F5
+ 150000 Transfer_to_Final_Volume_Exported_T3_F1
+ 136500 Transfer_to_Final_Volume_Exported_T3_F2
+ 243000 Transfer_to_Final_Volume_Exported_T3_F3
+ 139500 Transfer_to_Final_Volume_Exported_T3_F4
+ 51000 Transfer_to_Final_Volume_Exported_T3_F5
Subject To
_C1: 3 Origin_to_Final_Volume_Exported_A_F1
+ 3 Origin_to_Final_Volume_Exported_A_F2
+ 3 Origin_to_Final_Volume_Exported_A_F3
+ 3 Origin_to_Final_Volume_Exported_A_F4
+ 3 Origin_to_Final_Volume_Exported_A_F5
+ 5 Origin_to_Transfer_Volume_Exported_A_T1
+ 5 Origin_to_Transfer_Volume_Exported_A_T2
+ 5 Origin_to_Transfer_Volume_Exported_A_T3 = 100
_C10: 3 Origin_to_Final_Volume_Exported_J_F1
+ 3 Origin_to_Final_Volume_Exported_J_F2
+ 3 Origin_to_Final_Volume_Exported_J_F3
+ 3 Origin_to_Final_Volume_Exported_J_F4
+ 3 Origin_to_Final_Volume_Exported_J_F5
+ 5 Origin_to_Transfer_Volume_Exported_J_T1
+ 5 Origin_to_Transfer_Volume_Exported_J_T2
+ 5 Origin_to_Transfer_Volume_Exported_J_T3 = 90
_C11: Origin_to_Transfer_Volume_Exported_A_T1
+ Origin_to_Transfer_Volume_Exported_B_T1
+ Origin_to_Transfer_Volume_Exported_C_T1
+ Origin_to_Transfer_Volume_Exported_D_T1
+ Origin_to_Transfer_Volume_Exported_E_T1
+ Origin_to_Transfer_Volume_Exported_F_T1
+ Origin_to_Transfer_Volume_Exported_G_T1
+ Origin_to_Transfer_Volume_Exported_H_T1
+ Origin_to_Transfer_Volume_Exported_I_T1
+ Origin_to_Transfer_Volume_Exported_J_T1 <= 500
_C12: Origin_to_Transfer_Volume_Exported_A_T2
+ Origin_to_Transfer_Volume_Exported_B_T2
+ Origin_to_Transfer_Volume_Exported_C_T2
+ Origin_to_Transfer_Volume_Exported_D_T2
+ Origin_to_Transfer_Volume_Exported_E_T2
+ Origin_to_Transfer_Volume_Exported_F_T2
+ Origin_to_Transfer_Volume_Exported_G_T2
+ Origin_to_Transfer_Volume_Exported_H_T2
+ Origin_to_Transfer_Volume_Exported_I_T2
+ Origin_to_Transfer_Volume_Exported_J_T2 <= 500
_C13: Origin_to_Transfer_Volume_Exported_A_T3
+ Origin_to_Transfer_Volume_Exported_B_T3
+ Origin_to_Transfer_Volume_Exported_C_T3
+ Origin_to_Transfer_Volume_Exported_D_T3
+ Origin_to_Transfer_Volume_Exported_E_T3
+ Origin_to_Transfer_Volume_Exported_F_T3
+ Origin_to_Transfer_Volume_Exported_G_T3
+ Origin_to_Transfer_Volume_Exported_H_T3
+ Origin_to_Transfer_Volume_Exported_I_T3
+ Origin_to_Transfer_Volume_Exported_J_T3 <= 500
_C14: 3 Origin_to_Final_Volume_Exported_A_F1
+ 3 Origin_to_Final_Volume_Exported_B_F1
+ 3 Origin_to_Final_Volume_Exported_C_F1
+ 3 Origin_to_Final_Volume_Exported_D_F1
+ 3 Origin_to_Final_Volume_Exported_E_F1
+ 3 Origin_to_Final_Volume_Exported_F_F1
+ 3 Origin_to_Final_Volume_Exported_G_F1
+ 3 Origin_to_Final_Volume_Exported_H_F1
+ 3 Origin_to_Final_Volume_Exported_I_F1
+ 3 Origin_to_Final_Volume_Exported_J_F1
+ 10 Transfer_to_Final_Volume_Exported_T1_F1
+ 10 Transfer_to_Final_Volume_Exported_T2_F1
+ 10 Transfer_to_Final_Volume_Exported_T3_F1 <= 2000
_C15: 3 Origin_to_Final_Volume_Exported_A_F2
+ 3 Origin_to_Final_Volume_Exported_B_F2
+ 3 Origin_to_Final_Volume_Exported_C_F2
+ 3 Origin_to_Final_Volume_Exported_D_F2
+ 3 Origin_to_Final_Volume_Exported_E_F2
+ 3 Origin_to_Final_Volume_Exported_F_F2
+ 3 Origin_to_Final_Volume_Exported_G_F2
+ 3 Origin_to_Final_Volume_Exported_H_F2
+ 3 Origin_to_Final_Volume_Exported_I_F2
+ 3 Origin_to_Final_Volume_Exported_J_F2
+ 10 Transfer_to_Final_Volume_Exported_T1_F2
+ 10 Transfer_to_Final_Volume_Exported_T2_F2
+ 10 Transfer_to_Final_Volume_Exported_T3_F2 <= 3000
_C16: 3 Origin_to_Final_Volume_Exported_A_F3
+ 3 Origin_to_Final_Volume_Exported_B_F3
+ 3 Origin_to_Final_Volume_Exported_C_F3
+ 3 Origin_to_Final_Volume_Exported_D_F3
+ 3 Origin_to_Final_Volume_Exported_E_F3
+ 3 Origin_to_Final_Volume_Exported_F_F3
+ 3 Origin_to_Final_Volume_Exported_G_F3
+ 3 Origin_to_Final_Volume_Exported_H_F3
+ 3 Origin_to_Final_Volume_Exported_I_F3
+ 3 Origin_to_Final_Volume_Exported_J_F3
+ 10 Transfer_to_Final_Volume_Exported_T1_F3
+ 10 Transfer_to_Final_Volume_Exported_T2_F3
+ 10 Transfer_to_Final_Volume_Exported_T3_F3 <= 500
_C17: 3 Origin_to_Final_Volume_Exported_A_F4
+ 3 Origin_to_Final_Volume_Exported_B_F4
+ 3 Origin_to_Final_Volume_Exported_C_F4
+ 3 Origin_to_Final_Volume_Exported_D_F4
+ 3 Origin_to_Final_Volume_Exported_E_F4
+ 3 Origin_to_Final_Volume_Exported_F_F4
+ 3 Origin_to_Final_Volume_Exported_G_F4
+ 3 Origin_to_Final_Volume_Exported_H_F4
+ 3 Origin_to_Final_Volume_Exported_I_F4
+ 3 Origin_to_Final_Volume_Exported_J_F4
+ 10 Transfer_to_Final_Volume_Exported_T1_F4
+ 10 Transfer_to_Final_Volume_Exported_T2_F4
+ 10 Transfer_to_Final_Volume_Exported_T3_F4 <= 250
_C18: 3 Origin_to_Final_Volume_Exported_A_F5
+ 3 Origin_to_Final_Volume_Exported_B_F5
+ 3 Origin_to_Final_Volume_Exported_C_F5
+ 3 Origin_to_Final_Volume_Exported_D_F5
+ 3 Origin_to_Final_Volume_Exported_E_F5
+ 3 Origin_to_Final_Volume_Exported_F_F5
+ 3 Origin_to_Final_Volume_Exported_G_F5
+ 3 Origin_to_Final_Volume_Exported_H_F5
+ 3 Origin_to_Final_Volume_Exported_I_F5
+ 3 Origin_to_Final_Volume_Exported_J_F5
+ 10 Transfer_to_Final_Volume_Exported_T1_F5
+ 10 Transfer_to_Final_Volume_Exported_T2_F5
+ 10 Transfer_to_Final_Volume_Exported_T3_F5 <= 200
_C19: 0.15 Origin_to_Transfer_Volume_Exported_A_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_B_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_C_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_D_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_E_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_F_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_G_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_H_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_I_T1
+ 0.15 Origin_to_Transfer_Volume_Exported_J_T1
- 2.7 Transfer_to_Final_Volume_Exported_T1_F1
- 2.7 Transfer_to_Final_Volume_Exported_T1_F2
- 2.7 Transfer_to_Final_Volume_Exported_T1_F3
- 2.7 Transfer_to_Final_Volume_Exported_T1_F4
- 2.7 Transfer_to_Final_Volume_Exported_T1_F5 = 0
_C2: 3 Origin_to_Final_Volume_Exported_B_F1
+ 3 Origin_to_Final_Volume_Exported_B_F2
+ 3 Origin_to_Final_Volume_Exported_B_F3
+ 3 Origin_to_Final_Volume_Exported_B_F4
+ 3 Origin_to_Final_Volume_Exported_B_F5
+ 5 Origin_to_Transfer_Volume_Exported_B_T1
+ 5 Origin_to_Transfer_Volume_Exported_B_T2
+ 5 Origin_to_Transfer_Volume_Exported_B_T3 = 1000
_C20: 0.15 Origin_to_Transfer_Volume_Exported_A_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_B_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_C_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_D_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_E_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_F_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_G_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_H_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_I_T2
+ 0.15 Origin_to_Transfer_Volume_Exported_J_T2
- 2.7 Transfer_to_Final_Volume_Exported_T2_F1
- 2.7 Transfer_to_Final_Volume_Exported_T2_F2
- 2.7 Transfer_to_Final_Volume_Exported_T2_F3
- 2.7 Transfer_to_Final_Volume_Exported_T2_F4
- 2.7 Transfer_to_Final_Volume_Exported_T2_F5 = 0
_C21: 0.15 Origin_to_Transfer_Volume_Exported_A_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_B_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_C_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_D_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_E_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_F_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_G_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_H_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_I_T3
+ 0.15 Origin_to_Transfer_Volume_Exported_J_T3
- 0.6 Transfer_to_Final_Volume_Exported_T3_F1
- 0.6 Transfer_to_Final_Volume_Exported_T3_F2
- 0.6 Transfer_to_Final_Volume_Exported_T3_F3
- 0.6 Transfer_to_Final_Volume_Exported_T3_F4
- 0.6 Transfer_to_Final_Volume_Exported_T3_F5 = 0
_C22: Origin_to_Transfer_Volume_Exported_A_T1 = 0
_C3: 3 Origin_to_Final_Volume_Exported_C_F1
+ 3 Origin_to_Final_Volume_Exported_C_F2
+ 3 Origin_to_Final_Volume_Exported_C_F3
+ 3 Origin_to_Final_Volume_Exported_C_F4
+ 3 Origin_to_Final_Volume_Exported_C_F5
+ 5 Origin_to_Transfer_Volume_Exported_C_T1
+ 5 Origin_to_Transfer_Volume_Exported_C_T2
+ 5 Origin_to_Transfer_Volume_Exported_C_T3 = 500
_C4: 3 Origin_to_Final_Volume_Exported_D_F1
+ 3 Origin_to_Final_Volume_Exported_D_F2
+ 3 Origin_to_Final_Volume_Exported_D_F3
+ 3 Origin_to_Final_Volume_Exported_D_F4
+ 3 Origin_to_Final_Volume_Exported_D_F5
+ 5 Origin_to_Transfer_Volume_Exported_D_T1
+ 5 Origin_to_Transfer_Volume_Exported_D_T2
+ 5 Origin_to_Transfer_Volume_Exported_D_T3 = 400
_C5: 3 Origin_to_Final_Volume_Exported_E_F1
+ 3 Origin_to_Final_Volume_Exported_E_F2
+ 3 Origin_to_Final_Volume_Exported_E_F3
+ 3 Origin_to_Final_Volume_Exported_E_F4
+ 3 Origin_to_Final_Volume_Exported_E_F5
+ 5 Origin_to_Transfer_Volume_Exported_E_T1
+ 5 Origin_to_Transfer_Volume_Exported_E_T2
+ 5 Origin_to_Transfer_Volume_Exported_E_T3 = 300
_C6: 3 Origin_to_Final_Volume_Exported_F_F1
+ 3 Origin_to_Final_Volume_Exported_F_F2
+ 3 Origin_to_Final_Volume_Exported_F_F3
+ 3 Origin_to_Final_Volume_Exported_F_F4
+ 3 Origin_to_Final_Volume_Exported_F_F5
+ 5 Origin_to_Transfer_Volume_Exported_F_T1
+ 5 Origin_to_Transfer_Volume_Exported_F_T2
+ 5 Origin_to_Transfer_Volume_Exported_F_T3 = 600
_C7: 3 Origin_to_Final_Volume_Exported_G_F1
+ 3 Origin_to_Final_Volume_Exported_G_F2
+ 3 Origin_to_Final_Volume_Exported_G_F3
+ 3 Origin_to_Final_Volume_Exported_G_F4
+ 3 Origin_to_Final_Volume_Exported_G_F5
+ 5 Origin_to_Transfer_Volume_Exported_G_T1
+ 5 Origin_to_Transfer_Volume_Exported_G_T2
+ 5 Origin_to_Transfer_Volume_Exported_G_T3 = 100
_C8: 3 Origin_to_Final_Volume_Exported_H_F1
+ 3 Origin_to_Final_Volume_Exported_H_F2
+ 3 Origin_to_Final_Volume_Exported_H_F3
+ 3 Origin_to_Final_Volume_Exported_H_F4
+ 3 Origin_to_Final_Volume_Exported_H_F5
+ 5 Origin_to_Transfer_Volume_Exported_H_T1
+ 5 Origin_to_Transfer_Volume_Exported_H_T2
+ 5 Origin_to_Transfer_Volume_Exported_H_T3 = 50
_C9: 3 Origin_to_Final_Volume_Exported_I_F1
+ 3 Origin_to_Final_Volume_Exported_I_F2
+ 3 Origin_to_Final_Volume_Exported_I_F3
+ 3 Origin_to_Final_Volume_Exported_I_F4
+ 3 Origin_to_Final_Volume_Exported_I_F5
+ 5 Origin_to_Transfer_Volume_Exported_I_T1
+ 5 Origin_to_Transfer_Volume_Exported_I_T2
+ 5 Origin_to_Transfer_Volume_Exported_I_T3 = 75
End

• I recommend you separate possible issues from the model and from the code. So it would be good to post your model written in mathematical terms to begin with. Commented Jul 28, 2022 at 13:09
• @Kuifje Thanks, I've added in the model in mathematical terms - hopefully it all makes sense in terms of notation etc. Commented Jul 28, 2022 at 13:48
• It may help to write out the LP file and study that carefully. Commented Jul 28, 2022 at 14:01
• Unfortunately, the mathematical representation of the model is very hard to follow due to notation issues (omitted subscripts, symbols materializing out of thin air, ...). Perhaps you could rewrite it with more precision.
– prubin
Commented Jul 28, 2022 at 15:40
• @prubin thanks for the feedback, I've made some edits and hopefully that provides more clarity, provided a bit more commentary in the text so hopefully my lack of knowledge on the notation doesn't make it impossible to follow. Commented Jul 29, 2022 at 13:43

I think there might be an error in the following constraint: $$\sum_{}(V_{O,T}*S{{_O}/100}) - \sum_{}(V_{T,F}*S{_T}/100) = 0.$$
You did not indicate what you are summing over, but for the sake of argument assume there is a single facility of each type (origin, transfer, final). Also assume that $$S_O=75$$ and $$S_T=50,$$ so that the constraint becomes $$0.75 V_{O,T} = 0.5 V_{T,F},$$ or equivalently $$V_{T,F} = 1.5V_{O,T}.$$
I suspect what you want is two constraints, the first saying that what a transfer facility tries to transfer to a final facility ($$V_{T,F}$$) is a fraction of what comes in from origins, and the second saying that what a final facility actually gets is a fraction of what the transfer facilities send it.