diff --git a/adulyasak2015/gurobi_code.py b/adulyasak2015/gurobi_code.py index 3b1facdca786cb6c70b4f1f106a7e18fcb3741ab..c1e4cd3254ee99a78e60e0c00b4fd42669d817d8 100644 --- a/adulyasak2015/gurobi_code.py +++ b/adulyasak2015/gurobi_code.py @@ -344,8 +344,7 @@ def solve(instance_path, solution_path, time_limit): result["x"] = x_sol with open(solution_path, 'w') as fp: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, fp, indent=2) print(f"Objective value: {result['objective_value']}") diff --git a/alba2013/gurobi_code.py b/alba2013/gurobi_code.py index d999b9fb374c5aef7d71fe3dbc8539b5d923ca53..524e3820b4e12ce4bcbe9246cd709858cbf80bef 100644 --- a/alba2013/gurobi_code.py +++ b/alba2013/gurobi_code.py @@ -958,8 +958,7 @@ def solve_dtspms(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to {solution_path}") diff --git a/alfieri2020/gurobi_code.py b/alfieri2020/gurobi_code.py index 47caa08f572d8f5726515e6fa90616f9db41ed9f..57731dc498dd0e8b92826c9e68fdaa5f19aaabb3 100644 --- a/alfieri2020/gurobi_code.py +++ b/alfieri2020/gurobi_code.py @@ -165,8 +165,7 @@ def solve_gcp_compact(instance_path: str, solution_path: str, time_limit: int): # Write solution # ---------------------------------------------------------------- with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/amaldi2013/gurobi_code.py b/amaldi2013/gurobi_code.py index 3cae1501e44f3624372a6fead349cb0a0fa757c8..ee3667b0bcd592c5035eae08ff6bdd54c33135ef 100644 --- a/amaldi2013/gurobi_code.py +++ b/amaldi2013/gurobi_code.py @@ -205,8 +205,7 @@ def solve_min_hcp(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/araujo2015/gurobi_code.py b/araujo2015/gurobi_code.py index 3899ca5a78f2ba3d81b43b59203dd81b7d3bcdf2..495fea8725bf7ce964ad409e4bc2f64295b05932 100644 --- a/araujo2015/gurobi_code.py +++ b/araujo2015/gurobi_code.py @@ -198,8 +198,7 @@ def main(): result = solve_clst(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/araujo2020/gurobi_code.py b/araujo2020/gurobi_code.py index bd4f4f4396f715110ac232c1869b35228e9077ea..ed4d2e198525107e3278a3742214b018bd7c72f6 100644 --- a/araujo2020/gurobi_code.py +++ b/araujo2020/gurobi_code.py @@ -451,8 +451,7 @@ def main(): solution = build_and_solve(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/archetti2007/gurobi_code.py b/archetti2007/gurobi_code.py index e14723f60b354fd171bfc4909fd8d8966864d7b9..c109980724761fd42d1faa48880df55e3cd90467 100644 --- a/archetti2007/gurobi_code.py +++ b/archetti2007/gurobi_code.py @@ -540,8 +540,7 @@ def main(): result = solve_vmir_ou(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2, default=str) print(f"Solution written to {args.solution_path}") diff --git a/armbruster2012/gurobi_code.py b/armbruster2012/gurobi_code.py index e21c3e0dd2359a225310d3badb26c30c0b801133..aa425c87515ed54b51307960c295cc9840c1b42c 100644 --- a/armbruster2012/gurobi_code.py +++ b/armbruster2012/gurobi_code.py @@ -222,8 +222,7 @@ def main(): result = solve_bisection(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status: {result['status_str']}") diff --git a/arslan2021/gurobi_code.py b/arslan2021/gurobi_code.py index a3c7640b2a1c58f4738d4949d635d86501d755f9..d9ca7433804d29383ccb43fa9646c01d8c018559 100644 --- a/arslan2021/gurobi_code.py +++ b/arslan2021/gurobi_code.py @@ -188,8 +188,7 @@ def main(): solution = build_and_solve(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) if solution["objective_value"] is not None: diff --git a/bard2002/gurobi_code.py b/bard2002/gurobi_code.py index 22a09b68d84288e03bf4c31d5214b3ec996b05bb..67e1251377e6fa054cb929db69abe6f9d6e82a52 100644 --- a/bard2002/gurobi_code.py +++ b/bard2002/gurobi_code.py @@ -323,8 +323,7 @@ def build_and_solve(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/barnhart2000/gurobi_code.py b/barnhart2000/gurobi_code.py index 895b6dd1213531f17ed42325c45b9e4ac3d344e6..65a76f547c52d639f2ab69e2b6dc0c3e072ab95c 100644 --- a/barnhart2000/gurobi_code.py +++ b/barnhart2000/gurobi_code.py @@ -198,8 +198,7 @@ def main(): solution = build_and_solve(data, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/bayani2024/gurobi_code.py b/bayani2024/gurobi_code.py index 58728321832915168dc90c085307cb642a7894ee..7405f0fa6222791459f1490c7e5bfc2205d004e9 100644 --- a/bayani2024/gurobi_code.py +++ b/bayani2024/gurobi_code.py @@ -178,8 +178,7 @@ def main(): # Write solution with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/belhoul2014/gurobi_code.py b/belhoul2014/gurobi_code.py index 3baf57f0d7ef1917d3fb804538337c2019763f06..14e587659c092046e4196e2110813b8506013c1e 100644 --- a/belhoul2014/gurobi_code.py +++ b/belhoul2014/gurobi_code.py @@ -159,8 +159,7 @@ def solve_lcap(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to {solution_path}") diff --git a/belvaux2000/gurobi_code.py b/belvaux2000/gurobi_code.py index 659261cc7fcfc46e75a6c0d8ad57bcdd4c568675..0d8a5ef77ecbe3ab730482725d8ea2b87f251f82 100644 --- a/belvaux2000/gurobi_code.py +++ b/belvaux2000/gurobi_code.py @@ -262,8 +262,7 @@ def solve(instance_path, solution_path, time_limit): result["objective_value"] = None with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/bentert2022/gurobi_code.py b/bentert2022/gurobi_code.py index 419dc640d0a992e0d5eed7bc86d567511e04f752..8bbf2e3a5cefecb41c5a224ddea896600eae5f53 100644 --- a/bentert2022/gurobi_code.py +++ b/bentert2022/gurobi_code.py @@ -234,8 +234,7 @@ def main(): solution["vertex_costs"] = {str(v): c for v, c in vertex_costs.items()} with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) if obj_val is not None: diff --git a/bergman2019/gurobi_code.py b/bergman2019/gurobi_code.py index ac97ca401f2522c1a8df86edec144bad2af82e74..b6fe22305dcc94a49f2983ab3321d6227a4a1802 100644 --- a/bergman2019/gurobi_code.py +++ b/bergman2019/gurobi_code.py @@ -149,8 +149,7 @@ def main(): result = solve_qmkp(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value: {result['objective_value']}") diff --git a/bertsimas2022/gurobi_code.py b/bertsimas2022/gurobi_code.py index e4158aa5f22f7e81668c5f89d72a655ffccfb84a..a9fd15c357b425fe15df321b6fa7d45fd103d1fa 100644 --- a/bertsimas2022/gurobi_code.py +++ b/bertsimas2022/gurobi_code.py @@ -259,8 +259,7 @@ def main(): } with open(args.solution_path, "w") as fh: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, fh, indent=2) print(f"Status : {solution['solver_status_str']}") diff --git a/bertsimas2024/gurobi_code.py b/bertsimas2024/gurobi_code.py index ceecb644c91688bb9292806e90ff346329a1d7f6..d748929e21837ee75833975881b08361e8f71f2c 100644 --- a/bertsimas2024/gurobi_code.py +++ b/bertsimas2024/gurobi_code.py @@ -224,8 +224,7 @@ def main(): result = build_and_solve(data, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/bettinelli2017/gurobi_code.py b/bettinelli2017/gurobi_code.py index b3dcb894fdec1d42d6f0f927d0c47124fe9dd858..489a19626671a75867c7762909bfe223798f4c5a 100644 --- a/bettinelli2017/gurobi_code.py +++ b/bettinelli2017/gurobi_code.py @@ -175,8 +175,7 @@ def solve_kpcg(instance_path, solution_path, time_limit): } with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value : {objective_value}") diff --git a/bierwirth2017/gurobi_code.py b/bierwirth2017/gurobi_code.py index 223a7ad41fef06e7760a9c46a988506c3d773f53..555ec0fcf106c66bb0e81f17767455b07192b862 100644 --- a/bierwirth2017/gurobi_code.py +++ b/bierwirth2017/gurobi_code.py @@ -249,8 +249,7 @@ def solve_jsptwt(instance_path: str, solution_path: str, time_limit: float) -> N ) with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/bode2012/gurobi_code.py b/bode2012/gurobi_code.py index 02dc2759c0a2de59478392c2b5b66a00006c6d2c..975cb061c1241a256ea69406e3d1ea53520f4e11 100644 --- a/bode2012/gurobi_code.py +++ b/bode2012/gurobi_code.py @@ -338,8 +338,7 @@ def solve_carp(instance_path, solution_path, time_limit): solution["routes"].append(route_info) with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") print(f"Objective value: {obj_val}") @@ -350,8 +349,7 @@ def solve_carp(instance_path, solution_path, time_limit): "status_str": "NO_SOLUTION_FOUND" } with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print("No feasible solution found.") diff --git a/bodur2017/gurobi_code.py b/bodur2017/gurobi_code.py index b080ebfaa7f03d431a633cdb6500922022330463..9188d92f6bbe723b8e70b276d5b59096d082bd65 100644 --- a/bodur2017/gurobi_code.py +++ b/bodur2017/gurobi_code.py @@ -137,8 +137,7 @@ def solve(instance_path, solution_path, time_limit): } with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {obj_val}") diff --git a/boland2019/gurobi_code.py b/boland2019/gurobi_code.py index d5b5640f0158bcca81568004131efd8a289d03a5..9628a7ad8ee967c22534be0095a2312a3b899e62 100644 --- a/boland2019/gurobi_code.py +++ b/boland2019/gurobi_code.py @@ -337,8 +337,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Found {len(pareto_front)} non-dominated points in {elapsed:.2f}s") diff --git a/bollapragada2001/gurobi_code.py b/bollapragada2001/gurobi_code.py index 6d85228d1e093c6b2caa949e08f99f44fa104f74..24afc68a8f2c1c1ac8e1df2a4992509184824fdc 100644 --- a/bollapragada2001/gurobi_code.py +++ b/bollapragada2001/gurobi_code.py @@ -369,8 +369,7 @@ def main(): print(f" Bar {ba['bar_id']}: area = {ba['area']}") with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to {args.solution_path}") diff --git a/borndorfer2007/gurobi_code.py b/borndorfer2007/gurobi_code.py index 796eb9bf221987986d2490b33802a936abc0df06..d0a8d741d28257f6ac0d5ecd05a1418d5c3067cc 100644 --- a/borndorfer2007/gurobi_code.py +++ b/borndorfer2007/gurobi_code.py @@ -341,8 +341,7 @@ def main(): print("ERROR: No feasible lines found.") solution = {"objective_value": None, "status": "infeasible", "error": "No lines enumerated"} with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) return @@ -544,8 +543,7 @@ def main(): print("No feasible solution found.") with open(args.solution_path, 'w') as outf: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, outf, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/bragin2022/gurobi_code.py b/bragin2022/gurobi_code.py index 5dcae18a945373e4d8e7f613b5f45def3553b11a..c320572bf11be44b293eb0028ebfb6e2d8c60f49 100644 --- a/bragin2022/gurobi_code.py +++ b/bragin2022/gurobi_code.py @@ -109,8 +109,7 @@ def main(): # Write solution with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Status: {model.Status}") diff --git a/brandao2016/gurobi_code.py b/brandao2016/gurobi_code.py index 694be2cc0c128ba3eb6108d7e93916a9092b4d60..e7ffa8559e4abf70197443065133c59b21f9a8e4 100644 --- a/brandao2016/gurobi_code.py +++ b/brandao2016/gurobi_code.py @@ -431,8 +431,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/bront2009/gurobi_code.py b/bront2009/gurobi_code.py index 7d65f0e2ec9ed3fb8600817e0cd83ebcdd820cff..20eeb1d492d90fc74f914a203a7bd5c776535436 100644 --- a/bront2009/gurobi_code.py +++ b/bront2009/gurobi_code.py @@ -516,8 +516,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"\nSolution saved to {args.solution_path}") diff --git a/buchheim2018/gurobi_code.py b/buchheim2018/gurobi_code.py index c5732f2c3fdebbaef9bef0c73c18996f905afc0a..1c1a7abda9050d52a24cec1a5d8151708722c667 100644 --- a/buchheim2018/gurobi_code.py +++ b/buchheim2018/gurobi_code.py @@ -169,8 +169,7 @@ def main(): result = build_and_solve(data, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/byeon2022/gurobi_code.py b/byeon2022/gurobi_code.py index a6a7a40a473591e0b288f8c13e9c869030cc3e79..f8189c3830389aab873e4495b4f96401d31c2bff 100644 --- a/byeon2022/gurobi_code.py +++ b/byeon2022/gurobi_code.py @@ -1184,8 +1184,7 @@ def solve_and_output(m, solution_path): print("WARNING: No feasible solution found.") with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/caprara1999/gurobi_code.py b/caprara1999/gurobi_code.py index c9712ae05b26d62b21a2a7b093145b2196c13608..06190174dc381c8d26fbb942f9cecc2a1bbf18b5 100644 --- a/caprara1999/gurobi_code.py +++ b/caprara1999/gurobi_code.py @@ -116,8 +116,7 @@ def solve_qkp(instance_path: str, solution_path: str, time_limit: float) -> None } with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) diff --git a/carosi2019/gurobi_code.py b/carosi2019/gurobi_code.py index 803a654335ec2895ff24377932281ca02b92a5e1..895f88dfdfb89677f8e8784b3f7164b99c8e7527 100644 --- a/carosi2019/gurobi_code.py +++ b/carosi2019/gurobi_code.py @@ -600,8 +600,7 @@ def main(): solution = solve_ittvs(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2, default=str) print(f"Solution written to: {args.solution_path}") diff --git a/carvalho1999/gurobi_code.py b/carvalho1999/gurobi_code.py index e08f539b99f44faac721d347b6242435305f7207..b9fb213c0a302b8e25af07b0752b38643cbd0ad5 100644 --- a/carvalho1999/gurobi_code.py +++ b/carvalho1999/gurobi_code.py @@ -285,8 +285,7 @@ def solve(instance_path, solution_path, time_limit): result["mip_gap"] = model.MIPGap if model.SolCount > 0 else None with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/carvalho2022/gurobi_code.py b/carvalho2022/gurobi_code.py index 3ab2c89a441d120d2b4526555eb1d8d4e6f9dbe5..9be520661020dd4f7e88d1f78de20222998256e7 100644 --- a/carvalho2022/gurobi_code.py +++ b/carvalho2022/gurobi_code.py @@ -454,8 +454,7 @@ def main(): result = build_and_solve(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/castro2021/gurobi_code.py b/castro2021/gurobi_code.py index 0d8f3a492e273532c9496a02f440a20e08c081ac..d48c5f55b44270c881d9725e1d41adc67825763c 100644 --- a/castro2021/gurobi_code.py +++ b/castro2021/gurobi_code.py @@ -170,8 +170,7 @@ def main(): result = build_and_solve(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/chebil2015/gurobi_code.py b/chebil2015/gurobi_code.py index b0277113343c871c755ca71b528926e788c8e538..d9fae44551e2f8e2f407fb521b4113906c4af4c3 100644 --- a/chebil2015/gurobi_code.py +++ b/chebil2015/gurobi_code.py @@ -108,8 +108,7 @@ def solve_kps(instance_path, solution_path, time_limit): solution["objective_value"] = objective_value with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {objective_value}") diff --git a/chebil2019/gurobi_code.py b/chebil2019/gurobi_code.py index 7ad2b7b4516b5d57c2507c27e0a04a73c0f222a9..92dab73c2d3252f8ff327620be9d6c767052da78 100644 --- a/chebil2019/gurobi_code.py +++ b/chebil2019/gurobi_code.py @@ -138,8 +138,7 @@ def main(): solution = solve_kps(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/chen1999/gurobi_code.py b/chen1999/gurobi_code.py index 684d365d09884d928f96e08dc9ee47f1da388d20..c7d9bccb7bf08f4a25a504b16ba45dae9347074c 100644 --- a/chen1999/gurobi_code.py +++ b/chen1999/gurobi_code.py @@ -619,8 +619,7 @@ def main(): # Write solution with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to: {args.solution_path}") diff --git a/cherkesly2015/gurobi_code.py b/cherkesly2015/gurobi_code.py index 0bb00613b9d5f3cc7706331bb412977dab436ffe..903ca4b253e6afaacbd94c0812ed8bd8292168cb 100644 --- a/cherkesly2015/gurobi_code.py +++ b/cherkesly2015/gurobi_code.py @@ -451,8 +451,7 @@ def main(): print("No feasible solution found.") with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution saved to: {args.solution_path}") diff --git a/colombi2017/gurobi_code.py b/colombi2017/gurobi_code.py index 96b5a7802c4238ef1ae46b91d1f982c8903e15eb..a02199976ed1f3599b7de4b94dde74c7f370f3d9 100644 --- a/colombi2017/gurobi_code.py +++ b/colombi2017/gurobi_code.py @@ -389,8 +389,7 @@ def main(): result = solve_dprpp_ic(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value: {result['objective_value']}") diff --git a/contreras2011/gurobi_code.py b/contreras2011/gurobi_code.py index d5b177df5e7778894508d8942bd501b608aff0ba..4da48c63bab206763493c4bcb08aa83a21c5772f 100644 --- a/contreras2011/gurobi_code.py +++ b/contreras2011/gurobi_code.py @@ -201,8 +201,7 @@ def main(): result = solve_chlpsa(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/cordeau2006/gurobi_code.py b/cordeau2006/gurobi_code.py index 6a3ecbc0a45cc2ff123eb67d10336ecf2824c4f6..5cf86bad4975664a277b30ebc5ccab818d9bc30f 100644 --- a/cordeau2006/gurobi_code.py +++ b/cordeau2006/gurobi_code.py @@ -396,8 +396,7 @@ def build_and_solve(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/cordeau2014/gurobi_code.py b/cordeau2014/gurobi_code.py index 7ae006a3faf872627ba638eb910ac191af274984..a6d84f6de08a1c2b8a374ef20ba5bec5e794941d 100644 --- a/cordeau2014/gurobi_code.py +++ b/cordeau2014/gurobi_code.py @@ -1143,8 +1143,7 @@ def solve_tdtsp(instance_path, solution_path, time_limit): # 8. Write solution # ------------------------------------------------------------------ with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to: {solution_path}") diff --git a/cordeau2019/gurobi_code.py b/cordeau2019/gurobi_code.py index 549d5f6034107cc70168d8d3a566661f7d85707c..c3490f92171bed456dff104f5f89718ac521dd90 100644 --- a/cordeau2019/gurobi_code.py +++ b/cordeau2019/gurobi_code.py @@ -277,8 +277,7 @@ def main(): "results": results, } with open(sol_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"\nSolution written to {sol_path}") diff --git a/cote2018/gurobi_code.py b/cote2018/gurobi_code.py index 9ed7623359d74991fb007114f6a9969015948d3e..6356df938b5cca4632306eeac3d9f79e9ef05fac 100644 --- a/cote2018/gurobi_code.py +++ b/cote2018/gurobi_code.py @@ -234,8 +234,7 @@ def solve_and_output(model, z, solution_path): result["mip_gap"] = model.MIPGap if model.SolCount > 0 else None with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) diff --git a/cote2019/gurobi_code.py b/cote2019/gurobi_code.py index 4e098fb212353b377c955150c7a24d15c4df297f..50d18d61053a7293e20e5bd1ce97aa1e538db158 100644 --- a/cote2019/gurobi_code.py +++ b/cote2019/gurobi_code.py @@ -898,8 +898,7 @@ def solve(args): # Save solution with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status: {result['status']}") diff --git a/cunha2021/gurobi_code.py b/cunha2021/gurobi_code.py index b362a4220d9589f0e7bab85e66d050dd6f7d06e5..022e99fa2b7e1cafe8f804db7a9d63e49525d8e2 100644 --- a/cunha2021/gurobi_code.py +++ b/cunha2021/gurobi_code.py @@ -194,8 +194,7 @@ def solve(instance_path: str, solution_path: str, time_limit: float): result["objective_value"] = None with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) return result diff --git a/damcikurt2016/gurobi_code.py b/damcikurt2016/gurobi_code.py index f66e6685d8990d418209e152e2afdec3be3d6ea6..d5ad566e13eccd07f25b1797f3e53171313a92ba 100644 --- a/damcikurt2016/gurobi_code.py +++ b/damcikurt2016/gurobi_code.py @@ -268,8 +268,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {solution['objective_value']}") diff --git a/dayarian2019/gurobi_code.py b/dayarian2019/gurobi_code.py index 707cc8d7828b9fef98dc9e97e8cd40fa7f39a52e..376dfc3eddb459d4120fe9cb4978cd8c4880802e 100644 --- a/dayarian2019/gurobi_code.py +++ b/dayarian2019/gurobi_code.py @@ -804,8 +804,7 @@ def main(): solution = solve_cprp(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"\nSolution written to: {args.solution_path}") diff --git a/degraeve2007/gurobi_code.py b/degraeve2007/gurobi_code.py index 583b9eed626c5235569096a464cfe70114d20ee3..0715ce466ac85b969b5d14f03296431dbcf03ebd 100644 --- a/degraeve2007/gurobi_code.py +++ b/degraeve2007/gurobi_code.py @@ -150,8 +150,7 @@ def solve_clst(instance_path: str, solution_path: str, time_limit: float) -> Non # Write solution with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Status: {solution['status_name']}") diff --git a/delage2022/gurobi_code.py b/delage2022/gurobi_code.py index c2e4a4c4c4164b7163b3a93e4ac505babc3a1580..52a0ac19b9fbb19c0807442ee739e55af9b3a65f 100644 --- a/delage2022/gurobi_code.py +++ b/delage2022/gurobi_code.py @@ -237,8 +237,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/delorme2020/gurobi_code.py b/delorme2020/gurobi_code.py index 19e04fdd646685c01406e0159954f1c4339cd14f..cc06e2ae96f5ac886d659bbe225588286f2ac602 100644 --- a/delorme2020/gurobi_code.py +++ b/delorme2020/gurobi_code.py @@ -515,8 +515,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/desaulniers2010/gurobi_code.py b/desaulniers2010/gurobi_code.py index a5f98161044ae75c0addbde3a7c6f50e25be98bd..bf5e18edf9f008fa00efb1fcbee8c60bb69742db 100644 --- a/desaulniers2010/gurobi_code.py +++ b/desaulniers2010/gurobi_code.py @@ -340,8 +340,7 @@ def build_and_solve(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/desaulniers2014/gurobi_code.py b/desaulniers2014/gurobi_code.py index a998a2292d03537ca59f7b752af998dd6a99a668..a68eaa079f1a24dd0c61363c1f5f04c5db149389 100644 --- a/desaulniers2014/gurobi_code.py +++ b/desaulniers2014/gurobi_code.py @@ -347,8 +347,7 @@ def solve_irp(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/desaulniers2016/gurobi_code.py b/desaulniers2016/gurobi_code.py index 793ac26c2f77526d0d0fc25986216df9f001ce72..07f8b2203528075b1cbb79493bde53029b05f83f 100644 --- a/desaulniers2016/gurobi_code.py +++ b/desaulniers2016/gurobi_code.py @@ -442,8 +442,7 @@ def main(): # Write solution with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"\nSolution written to {args.solution_path}") diff --git a/dienstknecht2024/gurobi_code.py b/dienstknecht2024/gurobi_code.py index 4acc554d33c4d705976f823a45b51fc3a54186f3..9b92b1fa8da16c37f183124872c8935132e3bc90 100644 --- a/dienstknecht2024/gurobi_code.py +++ b/dienstknecht2024/gurobi_code.py @@ -417,8 +417,7 @@ def main(): solution = solve_tcapcp_win(instance_data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/earl2005/gurobi_code.py b/earl2005/gurobi_code.py index 9c0ae66aab174e4856b7b80f883cc14a6807bd13..8eeea76aa8a6a5e425572dd3551561e602623f61 100644 --- a/earl2005/gurobi_code.py +++ b/earl2005/gurobi_code.py @@ -488,8 +488,7 @@ def solve(instance_path, solution_path, time_limit): file=sys.stderr) with open(solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to: {solution_path}") diff --git a/eiselt2009/gurobi_code.py b/eiselt2009/gurobi_code.py index 03d9f6fc09f95317be7d103b4fc26ccc128a1b2a..4cfe5651e2ef27bdf8c3d1390eba471fa9f87633 100644 --- a/eiselt2009/gurobi_code.py +++ b/eiselt2009/gurobi_code.py @@ -346,8 +346,7 @@ def main(): result = build_and_solve(inst, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status : {result['status']}") diff --git a/elci2022/gurobi_code.py b/elci2022/gurobi_code.py index 0172e79f72e5d1ca7fc5a849c2bc249b28c33619..4eeb8b381dff97f1490af80f1ebbaff3486c35ef 100644 --- a/elci2022/gurobi_code.py +++ b/elci2022/gurobi_code.py @@ -255,8 +255,7 @@ def solve(instance_path, solution_path, time_limit): result["schedule"] = schedule with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value : {result['objective_value']}") diff --git a/engineer2012/gurobi_code.py b/engineer2012/gurobi_code.py index ac457b7ec4284d693c51f607b6ebd15698ced32b..72c5801cd102a890612d1b7964a19e8e1974fc81 100644 --- a/engineer2012/gurobi_code.py +++ b/engineer2012/gurobi_code.py @@ -893,8 +893,7 @@ def main(): print(f"\nSaving solution to: {args.solution_path}") with open(args.solution_path, "w") as fout: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, fout, indent=2) print("Done.") diff --git a/fischetti1997/gurobi_code.py b/fischetti1997/gurobi_code.py index 6fffe00f6664a6379843094a5389fca7be73eb3e..6b5f2af07ec058cf9115da49c7d831bc032e7786 100644 --- a/fischetti1997/gurobi_code.py +++ b/fischetti1997/gurobi_code.py @@ -301,8 +301,7 @@ def solve_egtsp(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/fischetti1998/gurobi_code.py b/fischetti1998/gurobi_code.py index a9085c2d69123f50553e7ac8d940a6ab0c7bcc73..4f19e03e98e36f10388c7907ddbf88658dffee8d 100644 --- a/fischetti1998/gurobi_code.py +++ b/fischetti1998/gurobi_code.py @@ -485,8 +485,7 @@ def solve_op(instance_path, solution_path, time_limit): # 9. Write solution to JSON # ------------------------------------------------------------------ with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"\nSolution written to: {solution_path}") diff --git a/fischetti2017/gurobi_code.py b/fischetti2017/gurobi_code.py index a61ede9ddd1a777fb5f31ac04f2e37d037549596..efa3e93aaf683149ab5ebc45e096263ed4447bc4 100644 --- a/fischetti2017/gurobi_code.py +++ b/fischetti2017/gurobi_code.py @@ -143,8 +143,7 @@ def main(): solution["solver_status"] = model.Status with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) diff --git a/fleszar2022b/gurobi_code.py b/fleszar2022b/gurobi_code.py index dc7ee004305aeb63a13944dbe43ec645debf58c7..fb68a68154b2b7b3e4687e2be821add7b600bf33 100644 --- a/fleszar2022b/gurobi_code.py +++ b/fleszar2022b/gurobi_code.py @@ -122,8 +122,7 @@ def solve_qmkp(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) diff --git a/forrest2006/gurobi_code.py b/forrest2006/gurobi_code.py index da8a140f320637646c2745911e79d8b49df39a23..47d4a164caf9d8b8d3c2cdcafaac0ccc692f92bf 100644 --- a/forrest2006/gurobi_code.py +++ b/forrest2006/gurobi_code.py @@ -232,8 +232,7 @@ def main(): print(f"Objective value: {result['objective_value']}") with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to: {args.solution_path}") diff --git a/fragkos2016/gurobi_code.py b/fragkos2016/gurobi_code.py index 9fbdba13014535348068131c3a9bab80fe7dafd2..279a488c9e85df30bee29d00992530450c642779 100644 --- a/fragkos2016/gurobi_code.py +++ b/fragkos2016/gurobi_code.py @@ -172,8 +172,7 @@ def main(): result = solve_clst(data, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/fragkos2021/gurobi_code.py b/fragkos2021/gurobi_code.py index bbd6f0de7a640dc4e11509d78e6a2626dbf15327..713b5507071d9007ececc863532f184b4be0a6a3 100644 --- a/fragkos2021/gurobi_code.py +++ b/fragkos2021/gurobi_code.py @@ -235,8 +235,7 @@ def main(): suffix=".tmp", dir=dirn) try: with _os.fdopen(fd, "w") as f: - if isinstance(payload, dict) and "objective_value" in payload and "runtime" not in payload: - payload["runtime"] = time.time() - _GUROBI_CODE_START_TIME + payload["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(payload, f, indent=2) _os.replace(tmp, path) except Exception: diff --git a/freeman2018/gurobi_code.py b/freeman2018/gurobi_code.py index 892bf18de2c2757f3f0e659eb5c97de10d8a63d7..c1cce8c6222428cea8c14bea2379b5067d31573c 100644 --- a/freeman2018/gurobi_code.py +++ b/freeman2018/gurobi_code.py @@ -440,8 +440,7 @@ def main(): solution = build_and_solve(data, args) with open(args.solution_path, 'w') as fout: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, fout, indent=2) if solution['objective_value'] is not None: diff --git a/freling2003/gurobi_code.py b/freling2003/gurobi_code.py index 9a803c0e2ffd8ac8f9029071c5e9b738e4117832..1017af0a5f0832bedfde318a5b4d92152393a89d 100644 --- a/freling2003/gurobi_code.py +++ b/freling2003/gurobi_code.py @@ -165,8 +165,7 @@ def solve_mpssp(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/frey2017/gurobi_code.py b/frey2017/gurobi_code.py index af53a84af373af03ff6cf36e32cc53d7e81fc892..04cea17d3f90bc738f140b198880c530742d8d85 100644 --- a/frey2017/gurobi_code.py +++ b/frey2017/gurobi_code.py @@ -948,8 +948,7 @@ def main(): if args.solution_path: print(f"\nSaving solution to: {args.solution_path}") with open(args.solution_path, "w", encoding="utf-8") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2, default=str) else: print("\n" + json.dumps(solution, indent=2, default=str)) diff --git a/furini2016/gurobi_code.py b/furini2016/gurobi_code.py index c7d90e737f6318394f16ed4fcb3251e93bbfd065..0aca6c3a57de1f0bc7f0f40cdef745538521ffdb 100644 --- a/furini2016/gurobi_code.py +++ b/furini2016/gurobi_code.py @@ -354,8 +354,7 @@ def solve_g2kp(instance_path, solution_path, time_limit): } with open(solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Status: {sol_status}") diff --git a/furini2017/gurobi_code.py b/furini2017/gurobi_code.py index 0c8c805b89a1e394ee9b49418874133d8eb4a954..f724b9bcbadff5d0f1fdfe8b4e20d4f39c30db61 100644 --- a/furini2017/gurobi_code.py +++ b/furini2017/gurobi_code.py @@ -414,8 +414,7 @@ def main(): # Write solution with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Chromatic number (chi): {chi}") diff --git a/furini2019/gurobi_code.py b/furini2019/gurobi_code.py index dc8644f35c07d67d9125436d697c1ce1679df1cf..4490f1724636a261a8e745cabc2fecc1a4e37e81 100644 --- a/furini2019/gurobi_code.py +++ b/furini2019/gurobi_code.py @@ -97,8 +97,7 @@ def solve_max_clique(instance_path, solution_path, time_limit): } with open(solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Maximum clique size: {objective_value}") diff --git a/furini2021/gurobi_code.py b/furini2021/gurobi_code.py index 9de6ae3400f3597fbe5d336dfb19a9d470c9834b..cce1f8efbea05a77fd491c7b2e1e939d4a795e20 100644 --- a/furini2021/gurobi_code.py +++ b/furini2021/gurobi_code.py @@ -183,8 +183,7 @@ def solve_eicp(instance_path, solution_path, time_limit): "interdicted_edges": [list(e) for e in edges_sorted[:k]] } with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) return @@ -196,8 +195,7 @@ def solve_eicp(instance_path, solution_path, time_limit): if omega_G <= 1: result = {"objective_value": max(omega_G, 1), "interdicted_edges": []} with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) return @@ -205,8 +203,7 @@ def solve_eicp(instance_path, solution_path, time_limit): # Already minimum clique number with edges present result = {"objective_value": 2, "interdicted_edges": []} with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) return @@ -320,8 +317,7 @@ def solve_eicp(instance_path, solution_path, time_limit): } with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) diff --git a/gamache1999/gurobi_code.py b/gamache1999/gurobi_code.py index 24bf21efd4329f39aef5e1fb99c854908253ffc1..6b4b67daed205ce255250157fc1a9888f6bf448e 100644 --- a/gamache1999/gurobi_code.py +++ b/gamache1999/gurobi_code.py @@ -601,8 +601,7 @@ def main(): # Save solution with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2, default=str) print(f"\nSolution saved to: {args.solution_path}") diff --git a/gangammanavar2020/gurobi_code.py b/gangammanavar2020/gurobi_code.py index 7c9c7109dab4513b814c19d9439c8a7ae955949e..757a453ffda4b3b05ee35780b06cf16cb7f38aec 100644 --- a/gangammanavar2020/gurobi_code.py +++ b/gangammanavar2020/gurobi_code.py @@ -221,8 +221,7 @@ def main(): result = build_and_solve(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/garcia2011/gurobi_code.py b/garcia2011/gurobi_code.py index ff5ead8995ffca3449cda04e77eff1d0c52ce221..e592d82b7251f18ed7e9d3783bab0fdfc9ed2870 100644 --- a/garcia2011/gurobi_code.py +++ b/garcia2011/gurobi_code.py @@ -151,8 +151,7 @@ def solve_pmedian_cr(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/gruson2021/gurobi_code.py b/gruson2021/gurobi_code.py index ff46cd06ca64e41715d7b693738dfbb867471fd6..bd1f2cfd710b9bf5f1aca4396d798bca8658ad03 100644 --- a/gruson2021/gurobi_code.py +++ b/gruson2021/gurobi_code.py @@ -416,8 +416,7 @@ def main(): # Write solution with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/gschwind2021/gurobi_code.py b/gschwind2021/gurobi_code.py index fbe0627fd2fa24f88ba700d78bd159bb502a96f5..5fc3552d6746a5bb6440b073de81b82318b7060d 100644 --- a/gschwind2021/gurobi_code.py +++ b/gschwind2021/gurobi_code.py @@ -648,8 +648,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value: {obj_val}") diff --git a/gualandi2012/gurobi_code.py b/gualandi2012/gurobi_code.py index 6e9ad1a8efebd29f3316e5004d081a10cc0b42f3..a20f5aa21f1695211e62c7e5a2b14f7ad64b4bf6 100644 --- a/gualandi2012/gurobi_code.py +++ b/gualandi2012/gurobi_code.py @@ -233,8 +233,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/guo2021/gurobi_code.py b/guo2021/gurobi_code.py index 556a2a7588ae288edf909b4168ce2e026a2018ae..0052c1e861156e3b5e62136b5a08cd28af3decbc 100644 --- a/guo2021/gurobi_code.py +++ b/guo2021/gurobi_code.py @@ -290,8 +290,7 @@ def solve(instance_path, solution_path, time_limit): } with open(solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/hadjar2006/gurobi_code.py b/hadjar2006/gurobi_code.py index f2dc851fad3bd3c7b3446b1f65d12854a8c9d344..3760c4543a752ddc60c2a6b8d1a209ce7e69a337 100644 --- a/hadjar2006/gurobi_code.py +++ b/hadjar2006/gurobi_code.py @@ -261,8 +261,7 @@ def main(): print(f"{'='*60}") with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution saved to: {args.solution_path}") diff --git a/hassannayebi2016/gurobi_code.py b/hassannayebi2016/gurobi_code.py index c56716ce8d92f814a54e0e8cb17bf835f1d10eb5..57c4dd346839228e39a583f0c8ce8a592643c8c6 100644 --- a/hassannayebi2016/gurobi_code.py +++ b/hassannayebi2016/gurobi_code.py @@ -184,8 +184,7 @@ def main(): solution["AWT_minutes"] = None with open(args.solution_path, "w") as fh: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, fh, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/he2020/gurobi_code.py b/he2020/gurobi_code.py index e28da8cb7687a319f4efa4da2afdaa23552287dd..3cc3854acbedc1a93013b8962eb5a36ac1d6dd55 100644 --- a/he2020/gurobi_code.py +++ b/he2020/gurobi_code.py @@ -385,8 +385,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(serializable_solution, dict) and "objective_value" in serializable_solution and "runtime" not in serializable_solution: - serializable_solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + serializable_solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(serializable_solution, f, indent=2) print(f"\nSolution written to {args.solution_path}") diff --git a/hewitt2024/gurobi_code.py b/hewitt2024/gurobi_code.py index 3e3c4876de5f48e364a47fc5df0b2fb2c8330ade..d22cbfff461aff96bdd111f91599222603f72987 100644 --- a/hewitt2024/gurobi_code.py +++ b/hewitt2024/gurobi_code.py @@ -359,8 +359,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(output, dict) and "objective_value" in output and "runtime" not in output: - output["runtime"] = time.time() - _GUROBI_CODE_START_TIME + output["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(output, f, indent=2) print(f"Objective value: {obj_val}") diff --git a/hoffman1993/gurobi_code.py b/hoffman1993/gurobi_code.py index 76bd9b587e9dc6b566d0762f6f4c72aa54b168d7..deeb253ff185d3f7b19ea8b752b09b8bdd365e37 100644 --- a/hoffman1993/gurobi_code.py +++ b/hoffman1993/gurobi_code.py @@ -141,8 +141,7 @@ def solve_and_output(model, x, solution_path, num_cols): solution["runtime_seconds"] = model.Runtime with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Status: {solution['status']}") diff --git a/hosseinian2020/gurobi_code.py b/hosseinian2020/gurobi_code.py index 9e45128078903c7ee64e1d436d100d5485638173..ba9124fc282f57c2d3f28704db692429b83fe311 100644 --- a/hosseinian2020/gurobi_code.py +++ b/hosseinian2020/gurobi_code.py @@ -112,8 +112,7 @@ def solve_mewc(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value: {result['objective_value']}") diff --git a/huisman2005/gurobi_code.py b/huisman2005/gurobi_code.py index 8a3b1353178d48f7fe1acaee5bab02aea9127568..98a564e620d22b41eb3f603556a151fbcd2d02d2 100644 --- a/huisman2005/gurobi_code.py +++ b/huisman2005/gurobi_code.py @@ -515,8 +515,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2, default=str) print(f"Solution written to {args.solution_path}") diff --git a/ji2019/gurobi_code.py b/ji2019/gurobi_code.py index 38709eebd987a29d20f4e9dc37c6f0af669d57f0..7f2bc5c7118b2755b0a6ceb00c2819ea1846056d 100644 --- a/ji2019/gurobi_code.py +++ b/ji2019/gurobi_code.py @@ -614,8 +614,7 @@ def main(): result = build_and_solve_model(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) if result["objective_value"] is not None: diff --git a/juvin2023/gurobi_code.py b/juvin2023/gurobi_code.py index fb241b097daa8802cd97f07d553f592735a0797e..80e0e6496c55e665bb3f4e8d8ede838aa5918e60 100644 --- a/juvin2023/gurobi_code.py +++ b/juvin2023/gurobi_code.py @@ -321,8 +321,7 @@ def main(): result = solve_pfjssp(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/kang2021/gurobi_code.py b/kang2021/gurobi_code.py index 09bd28d49d5c5004e13610abb402018a84743680..98bbc280ddbf6395579a81c4e2b6c41fe9b19825 100644 --- a/kang2021/gurobi_code.py +++ b/kang2021/gurobi_code.py @@ -278,8 +278,7 @@ def main(): # Save solution with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution saved to {args.solution_path}") diff --git a/klose2005/gurobi_code.py b/klose2005/gurobi_code.py index 4a159ab5140c5615f0b7110a02a8e4087481893c..c2997b23c7bc17b9802452be8bffc89953dddf57 100644 --- a/klose2005/gurobi_code.py +++ b/klose2005/gurobi_code.py @@ -143,8 +143,7 @@ def solve_and_export(model, x, y, data, solution_path): result["solve_time"] = model.Runtime with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) return result diff --git a/knueven2020/gurobi_code.py b/knueven2020/gurobi_code.py index 3ffd31c7ac51365eaf23c6bc65d103bff0202ade..595b1cb6e909a944e05373e6f6d1e52ed74a6058 100644 --- a/knueven2020/gurobi_code.py +++ b/knueven2020/gurobi_code.py @@ -421,8 +421,7 @@ def main(): solution = extract_solution(model, u, v, w, p, pb, pl, delta, gen, G, T) with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) if solution["objective_value"] is not None: diff --git a/kobayashi2021/gurobi_code.py b/kobayashi2021/gurobi_code.py index 4104e775b3e8cb0b5a4768889cf3f418dce2c430..b5568f9c6e999e07f870fec016d9007b3924bafd 100644 --- a/kobayashi2021/gurobi_code.py +++ b/kobayashi2021/gurobi_code.py @@ -170,8 +170,7 @@ def build_and_solve(instance_path, solution_path, time_limit): print(f"Selected assets ({len(selected)}): {selected}") with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/kobeaga2024/gurobi_code.py b/kobeaga2024/gurobi_code.py index c986cf5d16e6ca5a180813732befdbca96fa860c..c049e0a76a6a8505669b541886c18b2fc4ed1aff 100644 --- a/kobeaga2024/gurobi_code.py +++ b/kobeaga2024/gurobi_code.py @@ -282,8 +282,7 @@ def main(): result = solve_op(instance, time_limit=args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) if result["objective_value"] is not None: diff --git a/kowalczyk2018/gurobi_code.py b/kowalczyk2018/gurobi_code.py index 9391e25688104b8500ea4f614e29655832e8f29a..f818d0726d76494e2258b2124e13ad420cc1d40b 100644 --- a/kowalczyk2018/gurobi_code.py +++ b/kowalczyk2018/gurobi_code.py @@ -224,8 +224,7 @@ def solve_wct(instance_path, solution_path, time_limit): "status_str": "NO_FEASIBLE_SCHEDULES" } with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print("No feasible schedules found.") return @@ -326,8 +325,7 @@ def solve_wct(instance_path, solution_path, time_limit): solution["machines"].append(machine_info) with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") print(f"Objective value: {obj_val}") @@ -338,8 +336,7 @@ def solve_wct(instance_path, solution_path, time_limit): "status_str": "NO_SOLUTION_FOUND" } with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print("No feasible solution found.") diff --git a/kowalczyk2024/gurobi_code.py b/kowalczyk2024/gurobi_code.py index 8f8fcc9170eb6c58dc8a982ec36b57586d0d825b..9f3bba732bb18d0e50bd77dcb0f83c7bd6d7e063 100644 --- a/kowalczyk2024/gurobi_code.py +++ b/kowalczyk2024/gurobi_code.py @@ -441,8 +441,7 @@ def main(): # Write solution with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/kress2019/gurobi_code.py b/kress2019/gurobi_code.py index bb2f99ac81973b96b3847ba17d291b3a1578feb7..2e88b9e35fc6a192ba1e7cb7f158353ef60d95c6 100644 --- a/kress2019/gurobi_code.py +++ b/kress2019/gurobi_code.py @@ -779,8 +779,7 @@ def main(): # Write solution with open(args.solution_path, "w") as f: - if isinstance(serializable_result, dict) and "objective_value" in serializable_result and "runtime" not in serializable_result: - serializable_result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + serializable_result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(serializable_result, f, indent=2) print(f"\nSolution written to: {args.solution_path}") diff --git a/kreter2018/gurobi_code.py b/kreter2018/gurobi_code.py index 071c187ebb02d8ffebf527d64dd1e4dabef2b03f..dcedb62df98298c5d24a3322f0b1781a6f5630ac 100644 --- a/kreter2018/gurobi_code.py +++ b/kreter2018/gurobi_code.py @@ -409,8 +409,7 @@ def main(): result = solve_racp(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) if result['objective_value'] is not None: diff --git a/lai2021/gurobi_code.py b/lai2021/gurobi_code.py index ac8080220acb04794d582ab5462acded61eeb64b..fef559a3efc415710f582afc42f5b1c83ffa9389 100644 --- a/lai2021/gurobi_code.py +++ b/lai2021/gurobi_code.py @@ -174,8 +174,7 @@ def main(): solution["groups"] = {str(g): sorted(verts) for g, verts in groups.items()} with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {objective_value}") diff --git a/laporte2003/gurobi_code.py b/laporte2003/gurobi_code.py index 27819107f7dee7a26d60eac1238a30d580dc1fe2..c54aab22676d05acd11be6d15f26d25fece56862 100644 --- a/laporte2003/gurobi_code.py +++ b/laporte2003/gurobi_code.py @@ -467,8 +467,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(output, dict) and "objective_value" in output and "runtime" not in output: - output["runtime"] = time.time() - _GUROBI_CODE_START_TIME + output["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(output, f, indent=2) print(f"\nSolution saved to: {args.solution_path}") diff --git a/lee1996/gurobi_code.py b/lee1996/gurobi_code.py index 010012c3479ac8a6ae834bd24b81f991dc0e0228..788b9ac7a4856abc88c3f7a64197e5c85d6c9765 100644 --- a/lee1996/gurobi_code.py +++ b/lee1996/gurobi_code.py @@ -471,8 +471,7 @@ def main(): solution["wall_clock_seconds"] = round(wall_end - wall_start, 3) with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"\nSolution written to: {args.solution_path}") diff --git a/legrain2020/gurobi_code.py b/legrain2020/gurobi_code.py index 8432d4c85bb12694167d80b355e6f6b2991eef10..f353a0a49d98d65d78f1ef1fdf288e40388b4d30 100644 --- a/legrain2020/gurobi_code.py +++ b/legrain2020/gurobi_code.py @@ -655,8 +655,7 @@ def build_and_solve(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/legrain2024/gurobi_code.py b/legrain2024/gurobi_code.py index 1d0d81b4c170263856cfed8ddc639b19c5a47e03..7968019f9464c6d4561cabb996d33e5f0c8eb575 100644 --- a/legrain2024/gurobi_code.py +++ b/legrain2024/gurobi_code.py @@ -761,8 +761,7 @@ def main(): solution = {"objective_value": None, "schedule": {}} with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/letelier2022/gurobi_code.py b/letelier2022/gurobi_code.py index 12b68f5e43436aa9cc9e83a8e270a99e26d4b740..d560dbf7434447e139052bf7e7a68c44e6c745a6 100644 --- a/letelier2022/gurobi_code.py +++ b/letelier2022/gurobi_code.py @@ -301,8 +301,7 @@ def main(): result = solve_bpptl(instance, time_limit=args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/levin2017/gurobi_code.py b/levin2017/gurobi_code.py index 9cd9f3c38c1f0c9cdc0f01154950b75a5b69ce3c..90ac19d6db2366d52f697e3eb26dff6481ac3aec 100644 --- a/levin2017/gurobi_code.py +++ b/levin2017/gurobi_code.py @@ -623,8 +623,7 @@ def main(): if sol_dir: os.makedirs(sol_dir, exist_ok=True) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status: {result['status']}") diff --git a/li2020/gurobi_code.py b/li2020/gurobi_code.py index 73d44b1aa999da139e04863e47613abf04b11665..7af74abbab42f044807960856c7883199aebbd77 100644 --- a/li2020/gurobi_code.py +++ b/li2020/gurobi_code.py @@ -447,8 +447,7 @@ def main(): result["status"] = "time_limit_no_solution" with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value: {result['objective_value']}") diff --git a/liao2020/gurobi_code.py b/liao2020/gurobi_code.py index 7e13500594fdb73ffa8abb11e4919c627771e9b1..58fc99ef7d50ea851d6651e5d03b2b3fec6b6ad3 100644 --- a/liao2020/gurobi_code.py +++ b/liao2020/gurobi_code.py @@ -652,8 +652,7 @@ def solve_drocs(instance_path, solution_path, time_limit, if solution_path is not None: with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) if not quiet: diff --git a/lozano2017/gurobi_code.py b/lozano2017/gurobi_code.py index 4c4667a605fd050aaf20e9bc84be432184d15090..7b835f8e999b8ccea101547fff6b7b2b87e6d625 100644 --- a/lozano2017/gurobi_code.py +++ b/lozano2017/gurobi_code.py @@ -347,8 +347,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) diff --git a/luo2017/gurobi_code.py b/luo2017/gurobi_code.py index 445cd90f708b1a11a068790c97c0dc1ee3b4f830..c860caea9cfa627a8e8090e12c3a8a66a8ee1beb 100644 --- a/luo2017/gurobi_code.py +++ b/luo2017/gurobi_code.py @@ -408,8 +408,7 @@ def main(): # Write solution with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2, default=str) print(f"Solution written to: {args.solution_path}") diff --git a/mansini2020/gurobi_code.py b/mansini2020/gurobi_code.py index a1c818c915f1c6463a910f6c6fac717ffeaf10b3..07b0612077ab905ac634516cf027a4de5a96b359 100644 --- a/mansini2020/gurobi_code.py +++ b/mansini2020/gurobi_code.py @@ -120,8 +120,7 @@ def solve_mmkp(instance_path, solution_path, time_limit): result["selected_items"] = [] with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/martello1999/gurobi_code.py b/martello1999/gurobi_code.py index ee235939b354ea8bc960554d145109ce8d1cd50a..3d418ff5b44cb4960099a57a442bd3eab029ccae 100644 --- a/martello1999/gurobi_code.py +++ b/martello1999/gurobi_code.py @@ -80,8 +80,7 @@ def solve_knapsack(instance_path, solution_path, time_limit): # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Objective value: {result['objective_value']}") diff --git a/martin-iradi2024/gurobi_code.py b/martin-iradi2024/gurobi_code.py index 542a247972b54a702ab1dd341604a3d606fdbe17..b274fb98cff2073f6d15100fa337d235dabce756 100644 --- a/martin-iradi2024/gurobi_code.py +++ b/martin-iradi2024/gurobi_code.py @@ -480,8 +480,7 @@ def main(): solution = build_and_solve(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/mehrotra1996/gurobi_code.py b/mehrotra1996/gurobi_code.py index c65d754d7fb1e60f6ae921f446df540e141e99a6..a278f59dff69b75dde6e9343fdfb6f8a0028d20d 100644 --- a/mehrotra1996/gurobi_code.py +++ b/mehrotra1996/gurobi_code.py @@ -401,8 +401,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to: {args.solution_path}") diff --git a/mingozzi1999/gurobi_code.py b/mingozzi1999/gurobi_code.py index 5771890065c01252bea62462b1076aabcfe36d10..efafb942a61449d4222c77e34f701f9344c12bc2 100644 --- a/mingozzi1999/gurobi_code.py +++ b/mingozzi1999/gurobi_code.py @@ -334,8 +334,7 @@ def main(): result = solve_vrpb(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution saved to {args.solution_path}") diff --git a/morrison2016/gurobi_code.py b/morrison2016/gurobi_code.py index 28e782d40e434b75cf4a051dc01c9a56be0123cf..467633fb40c648208a6a582e78b08a4424cf7d09 100644 --- a/morrison2016/gurobi_code.py +++ b/morrison2016/gurobi_code.py @@ -180,8 +180,7 @@ def solve(instance_path, solution_path, time_limit): solution["solve_time_seconds"] = round(model.Runtime, 4) with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/muter2010/gurobi_code.py b/muter2010/gurobi_code.py index 3161464b762c310ddab7b48b35a93b7871cea8ce..9138960915e3813cb72747f82dadfa875a39a4a0 100644 --- a/muter2010/gurobi_code.py +++ b/muter2010/gurobi_code.py @@ -946,8 +946,7 @@ def main(): # Write solution with open(args.solution_path, "w") as f: - if isinstance(output, dict) and "objective_value" in output and "runtime" not in output: - output["runtime"] = time.time() - _GUROBI_CODE_START_TIME + output["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(output, f, indent=2) print(f"\nSolution written to {args.solution_path}") print(f" Objective value: {result['objective_value']}") diff --git a/nagy2015/gurobi_code.py b/nagy2015/gurobi_code.py index 5b01ae419f9284da84f136c7ba2ef318c8ac56f6..4981164ca72f3041865a1f57a08a445145a5e2f7 100644 --- a/nagy2015/gurobi_code.py +++ b/nagy2015/gurobi_code.py @@ -494,8 +494,7 @@ def main(): result = solve_vrpddp(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution saved to {args.solution_path}") diff --git a/oliveira2020/gurobi_code.py b/oliveira2020/gurobi_code.py index 5d05a73ef39dda70c5bbc45eda345f6c4cec179d..7168315a94188f1c92e63bdd19769a2317a1c7b7 100644 --- a/oliveira2020/gurobi_code.py +++ b/oliveira2020/gurobi_code.py @@ -193,8 +193,7 @@ def solve(instance_path, solution_path, time_limit): result["optimality_gap"] = float(model.MIPGap) with open(solution_path, "w") as handle: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, handle, indent=2) return result diff --git a/ostrowski2012/gurobi_code.py b/ostrowski2012/gurobi_code.py index 73040588b3e54559fca52231d76e8ca741a68f37..c8328aa5a72c8fc5d473389d1acad67a81f4c379 100644 --- a/ostrowski2012/gurobi_code.py +++ b/ostrowski2012/gurobi_code.py @@ -492,8 +492,7 @@ def solve(instance_path, solution_path, time_limit): file=sys.stderr) with open(solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to: {solution_path}") diff --git a/ozturk2020/gurobi_code.py b/ozturk2020/gurobi_code.py index fe3f46497f48d999af2e0a4ed6cd0b94281cea9c..17960977155342c21f4d9f8414d8fbdde1ed6e2d 100644 --- a/ozturk2020/gurobi_code.py +++ b/ozturk2020/gurobi_code.py @@ -194,8 +194,7 @@ def solve(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) return result diff --git a/pecin2017/gurobi_code.py b/pecin2017/gurobi_code.py index 1188102dc5a94ce6450b71bb9c7b8f54243295ff..3a46cbe46aef16beb86f582d84d9257c1de49433 100644 --- a/pecin2017/gurobi_code.py +++ b/pecin2017/gurobi_code.py @@ -280,8 +280,7 @@ def main(): solution = solve(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/pedersen2024/gurobi_code.py b/pedersen2024/gurobi_code.py index bd755119d140d477c4f341577d62a2229461fa12..a1a2805c3194e3f0f8b3a7fc96f251bf7a0ef5ee 100644 --- a/pedersen2024/gurobi_code.py +++ b/pedersen2024/gurobi_code.py @@ -333,8 +333,7 @@ def main(): # Write solution with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/pessoa2021/gurobi_code.py b/pessoa2021/gurobi_code.py index b20a6606863df3cfc563a35a106a13b11a7de353..89da4c210773de021c134ebc1d7c0397aef62b12 100644 --- a/pessoa2021/gurobi_code.py +++ b/pessoa2021/gurobi_code.py @@ -298,8 +298,7 @@ def main(): solution = solve_rcvrp(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/pettersson2020/gurobi_code.py b/pettersson2020/gurobi_code.py index 68d86e8fceb0113d3fe336c2467ab3646aac0412..24eaa350c538bf9edf1fdd69d546ddac397c5164 100644 --- a/pettersson2020/gurobi_code.py +++ b/pettersson2020/gurobi_code.py @@ -257,8 +257,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Found {len(nd_solutions)} non-dominated solutions in {elapsed:.2f}s") diff --git a/pinnoi1997/gurobi_code.py b/pinnoi1997/gurobi_code.py index eb6024b6337c8c9dd0c01270829607d89c21263a..f170e786e885bb170d80c6c3b4fe70fd97ddfa30 100644 --- a/pinnoi1997/gurobi_code.py +++ b/pinnoi1997/gurobi_code.py @@ -257,8 +257,7 @@ def main(): result = solve_wsp(data, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/potthoff2010/gurobi_code.py b/potthoff2010/gurobi_code.py index bc611aafd02da6d1f87994b229a0326d8fcb028e..7b994b9128dfa7f0f7c0a5de0ff8793e688b85da 100644 --- a/potthoff2010/gurobi_code.py +++ b/potthoff2010/gurobi_code.py @@ -141,8 +141,7 @@ def main(): data = json.load(handle) result = solve(data, arguments.time_limit) with open(arguments.solution_path, "w") as handle: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, handle, indent=2) print( f"status={result['status']} objective={result['objective_value']} " diff --git a/rahimian2017/gurobi_code.py b/rahimian2017/gurobi_code.py index 3bad8bd8177a7fcdc2ba6ac4d5c394c2d4e38612..0fc075f0e7bfdccd50602a4d763a8be8a93d43dc 100644 --- a/rahimian2017/gurobi_code.py +++ b/rahimian2017/gurobi_code.py @@ -386,8 +386,7 @@ def main(): result = build_and_solve(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/rahmaniani2017/gurobi_code.py b/rahmaniani2017/gurobi_code.py index aeb94534b8303180d0623eb16d6c38f3f11f9787..d45ca1833016189eee12674d67515679cada4383 100644 --- a/rahmaniani2017/gurobi_code.py +++ b/rahmaniani2017/gurobi_code.py @@ -273,8 +273,7 @@ def main(): result = solve_uhlpma(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) if result['objective_value'] is not None: diff --git a/rahmaniani2018/gurobi_code.py b/rahmaniani2018/gurobi_code.py index cd6683901dd9591a9c18be696839a56612cecb24..c000505ed4bbc77ed917f4cd76775017d76198f8 100644 --- a/rahmaniani2018/gurobi_code.py +++ b/rahmaniani2018/gurobi_code.py @@ -880,8 +880,7 @@ def main(): result = build_and_solve(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to {args.solution_path}") diff --git a/rahmaniani2020/gurobi_code.py b/rahmaniani2020/gurobi_code.py index bb7af596bf9e3a7d103e8dce42834259c9c6cd5f..b378c795281baf06f7615a641ca20f7df5dad5ca 100644 --- a/rahmaniani2020/gurobi_code.py +++ b/rahmaniani2020/gurobi_code.py @@ -132,8 +132,7 @@ def main(): result["status"] = model.Status with open(args.solution_path, "w") as fh: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, fh, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/rahmaniani2022/gurobi_code.py b/rahmaniani2022/gurobi_code.py index 929d25f7c3e115b6eb27500b154b76a1e3460f1e..e0c59d91998c0c74c16174a87eaf6ac6eb28b44a 100644 --- a/rahmaniani2022/gurobi_code.py +++ b/rahmaniani2022/gurobi_code.py @@ -982,8 +982,7 @@ def main(): print(f"Objective value: {solution['objective_value']:.6f}") with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/reihaneh2019/gurobi_code.py b/reihaneh2019/gurobi_code.py index 64f2a2b0dfaafc7e16e05ca4e5c889a399076327..22e2feb09b34b7cbfbeed59bf3af337fe83016c8 100644 --- a/reihaneh2019/gurobi_code.py +++ b/reihaneh2019/gurobi_code.py @@ -312,8 +312,7 @@ def main(): solution = solve_vrdap(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/reinhardt2016/gurobi_code.py b/reinhardt2016/gurobi_code.py index 7f2e57b7606b3f33c6e62e22819b8bb27936e904..d71ada9c7dd06feeeb906fb4fbd8c2a1f07b4045 100644 --- a/reinhardt2016/gurobi_code.py +++ b/reinhardt2016/gurobi_code.py @@ -450,8 +450,7 @@ def main(): # Write solution with open(args.solution_path, "w") as f: - if isinstance(output, dict) and "objective_value" in output and "runtime" not in output: - output["runtime"] = time.time() - _GUROBI_CODE_START_TIME + output["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(output, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/ribeiro1994/gurobi_code.py b/ribeiro1994/gurobi_code.py index 77ee751ea60659849db07b6609925a967724bb78..50d38976d07389ad604c8685dbe0e6cbb94880b6 100644 --- a/ribeiro1994/gurobi_code.py +++ b/ribeiro1994/gurobi_code.py @@ -230,8 +230,7 @@ def main(): result = solve_mdvsp(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/riley2025/gurobi_code.py b/riley2025/gurobi_code.py index bf395c94d3eaf28211811e19cd46efd23b3a9a49..0086875c53529bd232e68ebbd35684e90b62e190 100644 --- a/riley2025/gurobi_code.py +++ b/riley2025/gurobi_code.py @@ -310,8 +310,7 @@ def main(): result['best_bound'] = model.ObjBound with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status: {result['status']}") diff --git a/roberti2015/gurobi_code.py b/roberti2015/gurobi_code.py index c0dffb7f8744b9a4b0dffe7828858fea5fc03b93..ab4f0eb8468d11c21975cf1a916eee46ae425096 100644 --- a/roberti2015/gurobi_code.py +++ b/roberti2015/gurobi_code.py @@ -149,8 +149,7 @@ def main(): solution = solve_fctp(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/roberti2018/gurobi_code.py b/roberti2018/gurobi_code.py index f78774c651107d5eb1e2debb47c8023cee3421b8..584faa8cab2c2101a1a8379bce4a0f1d0ea48fde 100644 --- a/roberti2018/gurobi_code.py +++ b/roberti2018/gurobi_code.py @@ -533,8 +533,7 @@ def solve_2e_cvrpgc(instance_path, solution_path, time_limit): # Write solution to file with open(solution_path, 'w') as f_out: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f_out, indent=2) print(f"Solution written to {solution_path}") diff --git a/roberti2021/gurobi_code.py b/roberti2021/gurobi_code.py index 21c1ec0595836e29efe9d89ea58126f68d1066cf..ef5efd559cb643f27483a5868cdad75cbfe62817 100644 --- a/roberti2021/gurobi_code.py +++ b/roberti2021/gurobi_code.py @@ -441,8 +441,7 @@ def main(): # Write solution to file with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to: {args.solution_path}") diff --git a/ropke2009/gurobi_code.py b/ropke2009/gurobi_code.py index eef1628219645dc440a535d40eba725eb87c50f9..416d0b68810a5d28545d487d18124f1147e8a15b 100644 --- a/ropke2009/gurobi_code.py +++ b/ropke2009/gurobi_code.py @@ -393,8 +393,7 @@ def main(): # Save solution with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution saved to: {args.solution_path}") diff --git a/roshanaei2017/gurobi_code.py b/roshanaei2017/gurobi_code.py index 6fda04877c5dfc7b061ecbf71a52e015add42e24..fb7aeed051b2e4c6ca31f92f3143ba16013e983b 100644 --- a/roshanaei2017/gurobi_code.py +++ b/roshanaei2017/gurobi_code.py @@ -669,8 +669,7 @@ def solve(instance_path: str, solution_path: str, time_limit: float) -> dict: result["num_optional_scheduled"] = 0 with open(solution_path, "w") as f_out: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f_out, indent=2) print(f"Status: {result['status_name']}") diff --git a/rostami2021/gurobi_code.py b/rostami2021/gurobi_code.py index 9a1ad9246b57e21e426e5495447c835bd8dc67c5..2dd9dbf714fd157a1149c3afefed0fb5a8cea671 100644 --- a/rostami2021/gurobi_code.py +++ b/rostami2021/gurobi_code.py @@ -296,8 +296,7 @@ def main(): solution['runtime'] = model.Runtime with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/rothenbacher2018/gurobi_code.py b/rothenbacher2018/gurobi_code.py index a373f8b0bd4d993d2245fd60c76bb1a59f3258c5..3f95f5ffe32ed64dc7a2fdd8c85457be8ecb70b4 100644 --- a/rothenbacher2018/gurobi_code.py +++ b/rothenbacher2018/gurobi_code.py @@ -861,8 +861,7 @@ def solve_ttrptw(instance_path, solution_path, time_limit): solution["routes"] = routes with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"\nStatus: {solution['status']}") diff --git a/rothenbacher2019/gurobi_code.py b/rothenbacher2019/gurobi_code.py index 91f8c2d84c213173a42da52f4855fa348242683f..376c2a6632472cd60c26a756aafe74c867adf416 100644 --- a/rothenbacher2019/gurobi_code.py +++ b/rothenbacher2019/gurobi_code.py @@ -418,8 +418,7 @@ def main(): print(f"Solve time: {solution['solve_time']:.2f}s") with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution saved to: {args.solution_path}") diff --git a/ruiz2007/gurobi_code.py b/ruiz2007/gurobi_code.py index 8da2c2df2cdbc942cb1cb27b1a7d7f6c1677271e..dcb5b4380e31636fb3099c2c371bd61c05eb4003 100644 --- a/ruiz2007/gurobi_code.py +++ b/ruiz2007/gurobi_code.py @@ -198,8 +198,7 @@ def solve_mnpfsp(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to {solution_path}") diff --git a/sadykov2013/gurobi_code.py b/sadykov2013/gurobi_code.py index 39b1624aa9d7614b3a7316b35277f17f221c2b8a..31e0c6de9a3c5278c3b56b3cf6bc9ba4161f877b 100644 --- a/sadykov2013/gurobi_code.py +++ b/sadykov2013/gurobi_code.py @@ -122,8 +122,7 @@ def solve_bppc(instance_path: str, solution_path: str, time_limit: float) -> Non # Write solution with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/salemi2022/gurobi_code.py b/salemi2022/gurobi_code.py index a5af652b478c970f6a96ddca6c3c71cdb3e7ff60..3cc7a2a4aedaaaa5ec763a5916c864fd0070a82c 100644 --- a/salemi2022/gurobi_code.py +++ b/salemi2022/gurobi_code.py @@ -266,8 +266,7 @@ def solve_and_save(model, instance, x, y, y_bar, q, p, p_bar, solution_path): ] with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) return result diff --git a/samarghandi2017/gurobi_code.py b/samarghandi2017/gurobi_code.py index 17e9f70900b79f66073543e21a5e0defc7eaa777..9e87ce8290eee6d92aba5615560fcc6b3a3718eb 100644 --- a/samarghandi2017/gurobi_code.py +++ b/samarghandi2017/gurobi_code.py @@ -357,8 +357,7 @@ def main(): result = solve(n, m, p, d, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status : {result['status']}") diff --git a/sansegundo2016/gurobi_code.py b/sansegundo2016/gurobi_code.py index ab8d4f925f41a15149e4a18d31d832b94403d588..8d2c737952c56801a59a57aa479dbae6e25e5615 100644 --- a/sansegundo2016/gurobi_code.py +++ b/sansegundo2016/gurobi_code.py @@ -100,8 +100,7 @@ def solve_max_clique(instance_path, solution_path, time_limit): } with open(solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {objective_value}") diff --git a/sansegundo2023/gurobi_code.py b/sansegundo2023/gurobi_code.py index c652b2cfe8dbd1e7d48df86a55f5161956d69736..b8ab59c55bf01aab1ddfa739222b59085f9e1122 100644 --- a/sansegundo2023/gurobi_code.py +++ b/sansegundo2023/gurobi_code.py @@ -238,8 +238,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) if obj_val is not None: diff --git a/savelsbergh1997/gurobi_code.py b/savelsbergh1997/gurobi_code.py index 0f0b6360c4cb4947d53b46d4df7c68f87bb329c6..5fe109667254e704212db30e295a83666508886d 100644 --- a/savelsbergh1997/gurobi_code.py +++ b/savelsbergh1997/gurobi_code.py @@ -132,8 +132,7 @@ def solve_gap(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/schwerdfeger2016/gurobi_code.py b/schwerdfeger2016/gurobi_code.py index d31c45538ee3e1bddd7ced66979a02257c61de8e..45bff40192bfb862ccf13ecdc9937138b0030d8c 100644 --- a/schwerdfeger2016/gurobi_code.py +++ b/schwerdfeger2016/gurobi_code.py @@ -170,8 +170,7 @@ def solve(instance_path, solution_path, time_limit): } with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Status: {solution['status']}") diff --git a/segundo2019/gurobi_code.py b/segundo2019/gurobi_code.py index 351fc6b8b188c039e2c5ad46b570dd05f6cf3a6d..e4fdedfe97835ad622864acc613005d824bee432 100644 --- a/segundo2019/gurobi_code.py +++ b/segundo2019/gurobi_code.py @@ -112,8 +112,7 @@ def solve_mewcp(instance_path: str, solution_path: str, time_limit: float) -> No # Write solution with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) status_map = { diff --git a/segundo2019b/gurobi_code.py b/segundo2019b/gurobi_code.py index 09d6931125a4012992ca7e56e4039a607c02d72b..4952f18d187b0f6fc3ff897e026da68bfedf0047 100644 --- a/segundo2019b/gurobi_code.py +++ b/segundo2019b/gurobi_code.py @@ -124,8 +124,7 @@ def main(): result = solve_mwcp(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status: {result['status_name']}") diff --git a/seker2021/gurobi_code.py b/seker2021/gurobi_code.py index ef46e7f124cbb556e563446d53dfdb8a9f2e471f..c7529de057de154b529f07d9ab49b70ab7e7eb79 100644 --- a/seker2021/gurobi_code.py +++ b/seker2021/gurobi_code.py @@ -128,8 +128,7 @@ def main(): result = solve(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) diff --git a/song2021/gurobi_code.py b/song2021/gurobi_code.py index 10937d396a76fab877b2d9714d1051eb819298b3..a415a98574efcfc332f3d9973c064c1785254f02 100644 --- a/song2021/gurobi_code.py +++ b/song2021/gurobi_code.py @@ -294,8 +294,7 @@ def solve_rlp(instance_path, solution_path, time_limit): # Write solution with open(solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"\nSolution written to {solution_path}") diff --git a/spliet2015/gurobi_code.py b/spliet2015/gurobi_code.py index fef08f5d8de72457e4f6fef758a36b04a2733116..3b43ed1edeb8c6023322a686aa285f9c035651d3 100644 --- a/spliet2015/gurobi_code.py +++ b/spliet2015/gurobi_code.py @@ -341,8 +341,7 @@ def main(): result = solve_twavrp(data, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/taninmis2022/gurobi_code.py b/taninmis2022/gurobi_code.py index 2e381b0d42ee20268d515be0b1fc093c7d758313..9773141418bd51d51dd488c595fc42f893e2917f 100644 --- a/taninmis2022/gurobi_code.py +++ b/taninmis2022/gurobi_code.py @@ -854,8 +854,7 @@ def main(): solution["instance_path"] = args.instance_path with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/tran2018/gurobi_code.py b/tran2018/gurobi_code.py index 4a2ae0986207d66e5f7c80e5564e08ed4ab56f08..48bfe9ea05792a93bdf425d816e68b88330f08e2 100644 --- a/tran2018/gurobi_code.py +++ b/tran2018/gurobi_code.py @@ -269,8 +269,7 @@ def main(): solution['gap'] = float('inf') with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/vidal2011/gurobi_code.py b/vidal2011/gurobi_code.py index 41fd362cbc067e94e8076a19f4ae3056abf86f16..b25161d8ff903256c2adac2b0e8ead7dc9419956 100644 --- a/vidal2011/gurobi_code.py +++ b/vidal2011/gurobi_code.py @@ -409,8 +409,7 @@ def main(): solution = build_and_solve(instance, args.time_limit) with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2, default=str) print(f"Solution written to {args.solution_path}") print(f"Objective value: {solution['objective_value']}") diff --git a/walteros2020/gurobi_code.py b/walteros2020/gurobi_code.py index 831f26fb6c5fe7c08724b779c615e3d0d3d09eb3..a768606b9f7473089e1761e482cc98cfcc949ba3 100644 --- a/walteros2020/gurobi_code.py +++ b/walteros2020/gurobi_code.py @@ -97,8 +97,7 @@ def solve(instance_path: str, solution_path: str, time_limit: int) -> None: } with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {objective_value}") diff --git a/wang2019/gurobi_code.py b/wang2019/gurobi_code.py index e57a633bbdb067c54ffcc8f800d4b8618ef70644..29a15ea5f6ba2240ae4205d19e648aecaef322b2 100644 --- a/wang2019/gurobi_code.py +++ b/wang2019/gurobi_code.py @@ -224,8 +224,7 @@ def main(): solution["status"] = "no_solution_found" with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/wang2025/gurobi_code.py b/wang2025/gurobi_code.py index f2b509226757ebb657c69b7d84e87d41ae74b425..4fd74a9b9a9e761f5757f42869fefc2d2133bd68 100644 --- a/wang2025/gurobi_code.py +++ b/wang2025/gurobi_code.py @@ -280,8 +280,7 @@ def main(): } with open(args.solution_path, "w") as fp: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, fp, indent=2) print(f"Objective value: {f_star}") diff --git a/wangk2020/gurobi_code.py b/wangk2020/gurobi_code.py index dbc4fcaf1ea6a7b6e366c126288d6710889cffbd..360aa91da035ea5672e926a24df0cd96995ee8a7 100644 --- a/wangk2020/gurobi_code.py +++ b/wangk2020/gurobi_code.py @@ -495,8 +495,7 @@ def main(): result["objective_value"] = None with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/wangy2020/gurobi_code.py b/wangy2020/gurobi_code.py index ddf0fe21065fc401ed3ff4944189aacb79ea234e..70513488e9f56895dcfa2c9be559006fb8447f78 100644 --- a/wangy2020/gurobi_code.py +++ b/wangy2020/gurobi_code.py @@ -192,8 +192,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {true_obj}") diff --git a/watermeyer2020/gurobi_code.py b/watermeyer2020/gurobi_code.py index 323290578213a906cf1af4c4de2c9359c4111be6..87d025fdefb686c895e91a5354d7ed08e61fbc21 100644 --- a/watermeyer2020/gurobi_code.py +++ b/watermeyer2020/gurobi_code.py @@ -392,8 +392,7 @@ def main(): } with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Status: {result['status_name']}") diff --git a/watermeyer2022/gurobi_code.py b/watermeyer2022/gurobi_code.py index 43a1c21d948eafba1586fc0ef90fd60ee696cfae..964245179bcc70d66dc4a62be326643785ce8d23 100644 --- a/watermeyer2022/gurobi_code.py +++ b/watermeyer2022/gurobi_code.py @@ -213,8 +213,7 @@ def solve(instance_path, solution_path, time_limit): result["status"] = "infeasible" with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/watermeyer2023/gurobi_code.py b/watermeyer2023/gurobi_code.py index 8eb1db198899767f2492359ca5e5bd72ab7b5ee3..c7834586b7ce2b2b38a4cef0c19afad012c7a9ca 100644 --- a/watermeyer2023/gurobi_code.py +++ b/watermeyer2023/gurobi_code.py @@ -339,8 +339,7 @@ def main(): result["instance_id"] = instance["instance_id"] with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/wei2020/gurobi_code.py b/wei2020/gurobi_code.py index e81b02b281f481823d015003460b3b20f74ea8b0..97dd8bca911ca5b58186698b9e4f67f5d2edcdba 100644 --- a/wei2020/gurobi_code.py +++ b/wei2020/gurobi_code.py @@ -186,8 +186,7 @@ def main(): solution["time_seconds"] = elapsed with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {solution['objective_value']}") diff --git a/wei2020b/gurobi_code.py b/wei2020b/gurobi_code.py index ddb0ff9befc550c34eb3a76d99e24ead9c79893b..4dbb9b5354df1776c0b9aaae8599f048c9f9474a 100644 --- a/wei2020b/gurobi_code.py +++ b/wei2020b/gurobi_code.py @@ -162,8 +162,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Objective value: {solution['objective_value']}") diff --git a/wu2018/gurobi_code.py b/wu2018/gurobi_code.py index 25be7b2519f73c6db5eeace362df130b87833633..b93f42a888b5899f79f45224841ff8973b1238fc 100644 --- a/wu2018/gurobi_code.py +++ b/wu2018/gurobi_code.py @@ -272,8 +272,7 @@ def solve_and_output(model, X, I, Y, J, T, M_j, args): solution["setups"] = {} with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/wu2022/gurobi_code.py b/wu2022/gurobi_code.py index 0f573187130afe7d307c5b099c742a72392dafed..85b84d0cf5fab6937411378d5c677207304c67e1 100644 --- a/wu2022/gurobi_code.py +++ b/wu2022/gurobi_code.py @@ -325,8 +325,7 @@ def main(): # Write solution with open(args.solution_path, 'w') as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/wu2023/gurobi_code.py b/wu2023/gurobi_code.py index 870e760fce6193d7a5e841bd27c99866b211521f..cbced7e324e148371e7d68c6ec68ff43f672e35f 100644 --- a/wu2023/gurobi_code.py +++ b/wu2023/gurobi_code.py @@ -302,8 +302,7 @@ def main(): } with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/xie2019/gurobi_code.py b/xie2019/gurobi_code.py index b9ca55bdea0d6db6e1ca08d71bc18f0521d5fc0c..34cc5ef56dcf5311f059c4a4c3d4092edf14af26 100644 --- a/xie2019/gurobi_code.py +++ b/xie2019/gurobi_code.py @@ -619,8 +619,7 @@ def main(): # Write solution with open(args.solution_path, 'w') as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/xu2024/gurobi_code.py b/xu2024/gurobi_code.py index 575559c2dd1b45742d003a3f07ffe6d55193d887..9fba0c5676a5bf818b5ffa82bddf9dd3949bffa7 100644 --- a/xu2024/gurobi_code.py +++ b/xu2024/gurobi_code.py @@ -65,8 +65,7 @@ def solve(instance_path: str, solution_path: str, time_limit: float) -> None: result["objective_value"] = None with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) diff --git a/yang2013/gurobi_code.py b/yang2013/gurobi_code.py index b367c17e63c851fb17c8e4066087f3282acead70..27a81b7cd7e869c10d82226334074fb42e92c579 100644 --- a/yang2013/gurobi_code.py +++ b/yang2013/gurobi_code.py @@ -106,8 +106,7 @@ def solve_qkp(instance_path: str, solution_path: str, time_limit: int) -> None: # Write solution with open(solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Status: {result['status']}") diff --git a/zetina2019/gurobi_code.py b/zetina2019/gurobi_code.py index 1ad1cefdbd10eaebc2c1f9b8f3f8a1cedbd0748d..8404201ad8979798aa5c3fe9a9349dd1475ddd92 100644 --- a/zetina2019/gurobi_code.py +++ b/zetina2019/gurobi_code.py @@ -152,8 +152,7 @@ def solve_mufnd(instance_path, solution_path, time_limit): solution["runtime"] = model.Runtime with open(solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {solution_path}") diff --git a/zetina2020/gurobi_code.py b/zetina2020/gurobi_code.py index 54b21dccf3c352cd3824b9e88991b684c32004f6..3f16258e22a16b3d8d6c147ada4ca1281d325b98 100644 --- a/zetina2020/gurobi_code.py +++ b/zetina2020/gurobi_code.py @@ -205,8 +205,7 @@ def main(): raise ValueError(f"Unknown problem type: {problem_type}") with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/zhang2025/gurobi_code.py b/zhang2025/gurobi_code.py index 560b373a325aebe7fffd9d14e3df96e7210d360b..6efe2075addddb1975ec49a0417069f8949521fa 100644 --- a/zhang2025/gurobi_code.py +++ b/zhang2025/gurobi_code.py @@ -102,8 +102,7 @@ def main(): solution = build_and_solve(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(solution, dict) and "objective_value" in solution and "runtime" not in solution: - solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME + solution["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(solution, f, indent=2) print(f"Solution written to {args.solution_path}") diff --git a/zohali2022/gurobi_code.py b/zohali2022/gurobi_code.py index 56eaf55d01e799e91c2d48534e0358952f50f0a6..a39938e758ae8c3c602392cbab11ec6b796769a6 100644 --- a/zohali2022/gurobi_code.py +++ b/zohali2022/gurobi_code.py @@ -655,8 +655,7 @@ def main(): result = solve(instance, args.time_limit) with open(args.solution_path, "w") as f: - if isinstance(result, dict) and "objective_value" in result and "runtime" not in result: - result["runtime"] = time.time() - _GUROBI_CODE_START_TIME + result["runtime"] = time.time() - _GUROBI_CODE_START_TIME json.dump(result, f, indent=2, default=str) if result["objective_value"] is not None: