I am trying to implement lazy constraint callback. I looked at the usual TSP example on github
and I found that only 6 out of 26 constraint were being unsatisfied and added. It turns out that this stills needs further constraints and the loop never stops or you know I see the same constraints getting added and added, again and again.
So I am unable to come up with the internal ways in which data is represented which is given by self.get_cpx_unsatisfied_cts([ct], sol, tolerance=1e-6)
* 0+ 0 2017.0000 171.8000 91.48%
0 0 214.7501 7 2017.0000 Cuts: 5 315 89.35%
0 0 264.3077 9 2017.0000 Cuts: 9 337 86.90%
0 0 351.3789 9 2017.0000 Cuts: 19 356 82.58%
0 0 628.3137 8 2017.0000 Cuts: 14 364 68.85%
0 2 628.3137 8 2017.0000 664.7353 364 67.04% 0 0
Elapsed time = 1.53 sec. (287.14 ticks, tree = 0.01 MB, solutions = 1)
56 37 cutoff 2017.0000 1119.5000 628 44.50% x_6_4 D 56 55 13
120 68 1380.0000 1 2017.0000 1380.0000 921 31.58% xe_8_9_4 U 120 103 7
189 92 1380.0000 3 2017.0000 1380.0000 1306 31.58% xe_17_18_4 U 189 188 10
267 88 cutoff 2017.0000 1380.0000 1662 31.58% x_4_4 U 267 129 10
353 126 1380.0000 2 2017.0000 1380.0000 2088 31.58% x_4_4 D 353 352 11
458 141 1380.0000 3 2017.0000 1380.0000 2583 31.58% xe_17_19_4 D 458 443 11
535 125 1511.2157 3 2017.0000 1380.0000 2884 31.58% x_6_4 D 535 533 10
622 152 cutoff 2017.0000 1380.0000 3242 31.58% x_6_4 U 622 621 9
690 157 1503.6667 3 2017.0000 1380.0000 3486 31.58% x_6_4 D 690 688 11
992 208 1445.8930 4 2017.0000 1380.0000 4625 31.58% xe_17_18_4 U 992 819 9
Elapsed time = 4.41 sec. (3403.92 ticks, tree = 3.37 MB, solutions = 1)
1288 255 cutoff 2017.0000 1380.0000 5733 31.58% x_6_4 U 1288 1287 13
1600 302 1380.0000 2 2017.0000 1380.0000 6864 31.58% xe_11_13_4 U 1600 1586 7
1938 337 cutoff 2017.0000 1380.0001 8020 31.58% x_6_4 D 1938 1936 11
Implied bound cuts applied: 20
Mixed integer rounding cuts applied: 7
Gomory fractional cuts applied: 8
Root node processing (before b&c):
Real time = 1.53 sec. (287.33 ticks)
Sequential b&c:
Real time = 6.23 sec. (6900.99 ticks)
------------
Total (root+branch&cut) = 7.77 sec. (7188.32 ticks)
Traceback (most recent call last):
File "C:\Users\shari\OneDrive\Desktop\RamRam-TrainDISPLIB\Code\ProperCode\BranchAndCut\BandC_controller.py", line 244, in <module>
process_all_instances()
File "C:\Users\shari\OneDrive\Desktop\RamRam-TrainDISPLIB\Code\ProperCode\BranchAndCut\BandC_controller.py", line 236, in process_all_instances
train_partitioner(f"Data\\{instance_name}")
File "C:\Users\shari\OneDrive\Desktop\RamRam-TrainDISPLIB\Code\ProperCode\BranchAndCut\BandC_controller.py", line 205, in train_partitioner
mdl_class,mdl = model_solve_bandc(job_dict_cloned, ob_list, filename, idtor_dict, rtoid_dict, min_duration_dict, release_times_dict, save_sol)
File "C:\Users\shari\OneDrive\Desktop\RamRam-TrainDISPLIB\Code\ProperCode\BranchAndCut\helper_full.py", line 404, in model_solve_bandc
print("Model solved with status:", mdl.solve_details.status, "and objective value:", mdl.objective_value)
File "C:\Users\shari\anaconda3\envs\cplexenv\lib\site-packages\docplex\mp\model.py", line 5443, in objective_value
self._check_has_solution()
File "C:\Users\shari\anaconda3\envs\cplexenv\lib\site-packages\docplex\mp\model.py", line 5261, in _check_has_solution
self.fatal("Model<{0}> did not solve successfully",
self.name)
File "C:\Users\shari\anaconda3\envs\cplexenv\lib\site-packages\docplex\mp\model.py", line 1093, in fatal
self._error_handler.fatal(msg, args)
File "C:\Users\shari\anaconda3\envs\cplexenv\lib\site-packages\docplex\mp\error_handler.py", line 210, in fatal
raise DOcplexException(resolved_message)
docplex.mp.utils.DOcplexException: Model<SINTEF-DISPLIB-Challenge> did not solve successfully