I have wrote the .mod file for the Single Allocation Hub Location Problem, following the mathematical program given in this paper:

Skorin-Kapov D, Skorin-Kapov J,
O'Kelly M (1996) Tight linear
programming relaxations of
uncapacitated p-hub median problems.
European Journal of Operational
Research 94 (1996) 582-593

Somehow I can not obtain the results provided by the authors. I am doing something wrong, but I can not find out what I am doing wrong.

```
// nodes
int n = ...;
range N = 0..n-1;
// direct-line transport cost
float directTransportCost[N][N] = ...;
// discount coefficient
float alpha = ...;
// demand
float w[N][N] = ...;
// transport cost
float c[i in N][j in N][k in N][m in N] =
directTransportCost[i][k] + alpha * directTransportCost[k][m] + directTransportCost[m][j];
// decision variables
dvar boolean z[N][N];
dvar float+ x[N][N][N][N];
// cost minimization objective
minimize
(sum(i in N, j in N, k in N, m in N) w[i][j] * c[i][j][k][m] * x[i][j][k][m]);
subject to {
// number of hubs
// ctNumberOfHubs:
sum(k in N) z[k][k] == 4; // Inconsistency is observed not only for 4 hubs, but for every given number of hubs
// single allocation
forall(i in N)
//ctSingleAllocation:
sum(k in N) z[i][k] == 1;
// allocation to hub
forall(i in N, k in N)
//ctAllocation2Hub:
z[i][k] <= z[k][k];
// allocation of flow from origin
forall(i in N, j in N, k in N)
//ctOriginFlowAllocation:
sum(m in N) x[i][j][k][m] == z[i][k];
// allocation of flow to destination
forall(i in N, j in N, m in N)
//ctDestinationFlowAllocation:
sum(k in N) x[i][j][k][m] == z[j][m];
}
```

asked
**23 Feb, 19:46**

DDCh

13●4

accept rate:
0%

Wherein lies the inconsistency? Is it the solution's objective function value? Or is it the solution itself? If you only have access to the objective function values and there's an inconsistency there, it could be as simple as setting the optimality tolerance to 0 in the CPLEX parameters.

@Sune The inconsistency is in the objective value and usually in the solution itself.

Have you tried setting the optimality tolerance to zero?

I set the optimality tolerance to zero, but unfortunately it did not help. If you like, I can provide one corresponding .dat file.

@Sune If I am using the CPLEX Studio, then the obtained solutions are correct, only the objective value is little bit less (which can be explained by setting tolerance, or that rounding errors were smaller). On the other hand, when I call through Python API subprocess.check_call([oplrun, modname, datname]) I do not get the optimal solutions.

I do not know the python api (at all). But if you want to oplrun a mod +dat

andinclude some settings other than the standard, you should run it as "oplrun hub.mod hub.dat hub.ops". If you do not provide the same settings when calling through the python api, it's not fair to expect the same result.