Closed arani-mohammad closed 5 years ago
Hi,
Can you please upgrade to docplex 2.10.150 and let me know if you still have this problem ? https://pypi.org/project/docplex/2.10.150/
Thank you very much. Everything is working perfectly. Do I need to close this issue?
I'll close the issue if everything is now working. Thanks again.
Hi everyone, I faced the following error while I tried to solve my operations research problem:
TypeError: can't pickle dict_keys objects
The above error showed up when I wrote the following line using the academic version of cplex toolbox 12.9 on python version 3.6 and my operating system is Windows 7 x64:solution=mdl.solve(log_output=True)
It is important to note that when I removed the input argument (log_output=True), everything works fine. But I need a detailed output.
If anyone needs background information please read the following: As a conventional OR programming, first I introduced the sets like this:
# LD: Set of locations of donors, d ∈ LD LD = {"d"+"%d"%i:i for i in range(1,5)} print("LD: ", LD) # LD: {'d1': 1, 'd2': 2, 'd3': 3, 'd4': 4}
Then I randomly generated the parameters of my problem with an specific seed:FTC_d_q = {(d,q):rnd.randint(low=5 , high=10) for d in range(1,len(LD)+1) for q in range(1,len(LPF)+1)}
After I introduced variables as following:dict_x_p_d_q_t = {(p,d,q,t):0 for p in range(1,len(P)+1) for d in range(1,len(LD)+1) for q in range(1,len(LPF)+1) for t in range(1,len(T)+1)}
As recap, parameters and variable are defined as dictionaries. Finally, I started adding objective function and constraints:As mentioned, since I have followed the described procedure to code my OR problem I employed cplex library to solve the problem by calling the following command:
solution=mdl.solve(log_output=True)
And received the error I mentioned earlier. The problem is a part of my dissertation and it has the following statistics:Please let me know if any additional information is required.