model ModelName
options noimplicit
uses "mmxprs" ,"mmsystem"
declarations
sites = 1..15
facilities = 1..10
facilities_possible=5
start_time, end_time: real
DISTANCES: array(sites,facilities) of real
Y: array(sites,facilities) of mpvar
X: array(facilities) of mpvar
Z:mpvar
Objective:linctr
end-declarations
initialisations from "input.dat"
DISTANCES
end-initialisations
forall(i in sites,j in facilities) Y(i,j) is_binary
forall(j in facilities) X(j) is_binary
(sum(j in facilities) X(j))=facilities_possible
forall(i in sites) (sum(j in facilities) Y(i,j))=1
forall(i in sites,j in facilities) Y(i,j)<=X(j)
forall(j in facilities) (sum(i in sites) Y(i,j) * DISTANCES(i,j))<=Z
Objective:=Z
!exportprob("model.lp")
!setparam("XPRS_VERBOSE", true)
start_time := gettime
minimise(Objective)
end_time := gettime
writeln("nTime: ", (end_time - start_time), " s")
writeln("facilities:")
forall(i in facilities|getsol(X(i))=1) do
writeln(i)
end-do
writeln("y")
forall(i in sites, j in facilities|getsol(Y(i, j))=1) do
writeln("For site " + i + " sito " + j + " assigned: " + getsol(Y(i, j)))
end-do
writeln(" " + getsol(Objective))
end-model
I wrote this problem, my goal is to find the difficult instances of it , then the input matrices (DISTANCES) that take the longest to then find the solution.
I have noticed that by giving as input an array generated with very similar values the execution time increases, but this is not always the case perhaps there are other factors involved.
Can I get some advice are there any conditions known to be more difficult? are they related to the branch and bound algorithm?
luca boffa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.