monir
This commit is contained in:
parent
d9ed386767
commit
6ac8ddbaed
@ -134,7 +134,7 @@ def simulate_craw_and_calendar(thread, nSimulations):
|
|||||||
# nSims=int(sys.argv[1])
|
# nSims=int(sys.argv[1])
|
||||||
|
|
||||||
|
|
||||||
mbus_time = 0
|
mbus_solvetime = 0
|
||||||
cal_vartime = 0
|
cal_vartime = 0
|
||||||
cal_constrtime = 0
|
cal_constrtime = 0
|
||||||
cal_solvetime = 0
|
cal_solvetime = 0
|
||||||
@ -145,12 +145,11 @@ def simulate_craw_and_calendar(thread, nSimulations):
|
|||||||
solution_strings =[]
|
solution_strings =[]
|
||||||
for i in range(nSims):
|
for i in range(nSims):
|
||||||
|
|
||||||
ttt = time.time()
|
|
||||||
|
|
||||||
if i%100==0:
|
if i%100==0:
|
||||||
with open(f"{logfile}.log", "a") as f:
|
with open(f"{logfile}.log", "a") as f:
|
||||||
f.write(f"{thread}: {i} after {datetime.now()-now}\n")
|
f.write(f"{thread}: {i} after {datetime.now()-now}\n")
|
||||||
f.write(f"\tmbus_time: {mbus_time}\n")
|
f.write(f"\tmbus_solvetime: {mbus_solvetime}\n")
|
||||||
f.write(f"\tcal_vartime: {cal_vartime}\n")
|
f.write(f"\tcal_vartime: {cal_vartime}\n")
|
||||||
f.write(f"\tcal_constrtime: {cal_constrtime}\n")
|
f.write(f"\tcal_constrtime: {cal_constrtime}\n")
|
||||||
f.write(f"\tcal_solvetime: {cal_solvetime}\n")
|
f.write(f"\tcal_solvetime: {cal_solvetime}\n")
|
||||||
@ -170,13 +169,15 @@ def simulate_craw_and_calendar(thread, nSimulations):
|
|||||||
# mbus.setObjective(quicksum([ max(0,int(pa[0][1]) - int(pa[1][1] )) * plays[pa] for pa in possAssigns ]))
|
# mbus.setObjective(quicksum([ max(0,int(pa[0][1]) - int(pa[1][1] )) * plays[pa] for pa in possAssigns ]))
|
||||||
|
|
||||||
# print ("DRAWING !!!!")
|
# print ("DRAWING !!!!")
|
||||||
|
ttt = time.time()
|
||||||
|
|
||||||
# mbus.optimize()
|
# mbus.optimize()
|
||||||
mbus.solve()
|
mbus.solve()
|
||||||
checker_sol = mbus.getSolution(plays)
|
checker_sol = mbus.getSolution(plays)
|
||||||
|
|
||||||
mbus_time += time.time()-ttt
|
mbus_solvetime += time.time()-ttt
|
||||||
ttt = time.time()
|
ttt = time.time()
|
||||||
|
|
||||||
sol= [ pa for pa in possAssigns if checker_sol[pa]>0.9]
|
sol= [ pa for pa in possAssigns if checker_sol[pa]>0.9]
|
||||||
solutions.append(sol.copy())
|
solutions.append(sol.copy())
|
||||||
|
|
||||||
@ -319,6 +320,8 @@ def simulate_craw_and_calendar(thread, nSimulations):
|
|||||||
# sol= [ (t1,t2) for (t1,t2) in sol if t1[0]=="A" and t2[0]=="D" ]
|
# sol= [ (t1,t2) for (t1,t2) in sol if t1[0]=="A" and t2[0]=="D" ]
|
||||||
print ("No calendar for ", sol)
|
print ("No calendar for ", sol)
|
||||||
print ("Tested " , str(i+1) , " calendars" )
|
print ("Tested " , str(i+1) , " calendars" )
|
||||||
|
print("Status",cal.getProbStatus(),f"{cal.getProbStatus()}")
|
||||||
|
print("Solution",cal.getObjVal())
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
# pas2_sol= [ pas for pas in pas2 if cal.getSolution(x[pas])>0.9]
|
# pas2_sol= [ pas for pas in pas2 if cal.getSolution(x[pas])>0.9]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user