Location of Service Facilities for the Elderly - A utilization-maximizing

How do I insert an external script generated on Python into my model, with random data?
In particular:
lambda_data.dat (6.1 KB)
project_maximization-1.txt (3.4 KB)
thank you

Hi @francesca_lorenzi,

From that context we are not sure exactly what you are looking for. However, since you have values for lambda in that dat file, a way to load that parameter from randomly generated data in Python is the following:

from amplpy import AMPL
import random
ampl = AMPL()
I, K = range(1, 374+1), [1, 2]
ampl.set["I"] = I
ampl.set["K"] = K
ampl.param["lambda"] = {(i, k): random.uniform(80, 100) for i in I for k in K}
ampl.eval("display lambda;")
1 Like