1
Fork 0
mirror of https://github.com/Jaxan/satuio.git synced 2025-04-27 22:57:45 +02:00

minor tweaks in the output

This commit is contained in:
Joshua Moerman 2022-01-19 14:04:32 +01:00
parent 921a261c47
commit 5c06069bc7

View file

@ -41,6 +41,7 @@ parser = ArgumentParser()
parser.add_argument('filename', help='File of the mealy machine (dot format)') parser.add_argument('filename', help='File of the mealy machine (dot format)')
parser.add_argument('length', help='Length of the ADS', type=int) parser.add_argument('length', help='Length of the ADS', type=int)
parser.add_argument('-v', '--verbose', help="Show more output", action='store_true') parser.add_argument('-v', '--verbose', help="Show more output", action='store_true')
parser.add_argument('--show-differences', help="Show even more output", action='store_true')
parser.add_argument('--solver', help='Which solver to use (default g3)', default='g3') parser.add_argument('--solver', help='Which solver to use (default g3)', default='g3')
parser.add_argument('--states', help='For which states to compute an ADS', nargs='+') parser.add_argument('--states', help='For which states to compute an ADS', nargs='+')
args = parser.parse_args() args = parser.parse_args()
@ -163,6 +164,8 @@ for s in tqdm(states, desc="CNF paths"):
next_set = set() next_set = set()
# Now we will encode differences in outputs (and equal inputs, as
# long as there is no difference).
for s in tqdm(states, desc="CNF diffs"): for s in tqdm(states, desc="CNF diffs"):
for t in states: for t in states:
# We skip s == t, since those state are equivalent. # We skip s == t, since those state are equivalent.
@ -243,7 +246,7 @@ if solution:
console.print('! words:') console.print('! words:')
for s in states: for s in states:
console.print('for', s, end=': ', style='bold black') console.print(s.rjust(max_state_length, ' '), end=': ', style='bold black')
# We print the word # We print the word
for i in range(length): for i in range(length):
@ -258,7 +261,7 @@ if solution:
if args.verbose: if args.verbose:
console.print('! paths') console.print('! paths')
for s in states: for s in states:
console.print(s.rjust(max_state_length, ' '), ' ==> ', end=' ', style='bold black') console.print(s.rjust(max_state_length, ' '), end=': ', style='bold black')
for i in range(length): for i in range(length):
for t in all_states: for t in all_states:
if svar(s, i, t) in truth: if svar(s, i, t) in truth:
@ -274,6 +277,7 @@ if solution:
console.print('') console.print('')
if args.show_differences:
console.print('! differences') console.print('! differences')
for s in states: for s in states:
for t in states: for t in states:
@ -300,3 +304,10 @@ else:
start = start_total start = start_total
print('') print('')
measure_time("Done with total time") measure_time("Done with total time")
# TODO: we know that dvar(s, t, i) is an equivalence relation for
# each i. Do we help the solver when asserting that? Or will that
# make the solving slower?
# TODO: prune the tree in the end. (Some states will have shorter
# words than others.)