Hello,
I am trying to export all feasible solutions for my MIP problem from mdl.start_search() in docplex.cp(Python) in a txt file. I have millions of feasible solutions and looping through all solutions and creating a txt file is not an efficient way for me. Is there any faster ways to get all feasible solutions in a text file?
Here is my code:
from sys import stdout
f=open("output_100_112-148_v3.txt","w+") # file name and mode
siter = mdl.start_search() # Parameters needed to avoid duplicate solutions
try:
for j, msol in enumerate(siter):
f.write(str(j + 1) + " ")
for i,v in enumerate(x):
if msol[v]==1:
f.write(" " + str(i))
f.write("\n")
except CpoNotSupportedException:
print("I thinThis instance of the solver does not support solution iteration.")
Thank you
------------------------------
Shahrzad Amoozegar
------------------------------
#DecisionOptimization