Skip to content

Commit

Permalink
Improved calculation of remaining time to solve
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomSerg committed Jun 5, 2024
1 parent 2e045c1 commit 64588d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xcsp3/executable/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ def run_helper(args:Args):

# ------------------------------ Parse instance ------------------------------ #

start = time.time()
parse_start = time.time()
parser = ParserXCSP3(args.benchpath)
print_comment(f"took {(time.time() - start):.4f} seconds to parse XCSP3 model [{args.benchname}]")
print_comment(f"took {(time.time() - parse_start):.4f} seconds to parse XCSP3 model [{args.benchname}]")

# -------------------------- Configure XCSP3 parser callbacks -------------------------- #
start = time.time()
Expand Down Expand Up @@ -566,7 +566,7 @@ def run_helper(args:Args):
print_comment(f"took {tc.time:.4f} seconds to transfer model to {args.solver}")

# Solve model
time_limit = args.time_limit - tc.time - args.time_buffer if args.time_limit is not None else None
time_limit = args.time_limit - (time.time() - parse_start) - args.time_buffer if args.time_limit is not None else None

# If not time left
if time_limit is not None and time_limit <= 0:
Expand Down

0 comments on commit 64588d2

Please sign in to comment.