mirror of
https://git.cs.ou.nl/joshua.moerman/mealy-decompose.git
synced 2025-04-29 17:57:44 +02:00
added some command line options
This commit is contained in:
parent
9dc32ddc11
commit
99bb42b47e
1 changed files with 16 additions and 8 deletions
|
@ -3,9 +3,23 @@ from pysat.card import CardEnc
|
|||
from pysat.formula import IDPool
|
||||
from pysat.formula import CNF
|
||||
|
||||
import argparse
|
||||
|
||||
### Gebruik:
|
||||
# Stap 1: pip3 install python-sat
|
||||
# Stap 2: python3 decompose_fsm.py
|
||||
# Stap 2: python3 decompose_fsm.py -h
|
||||
|
||||
parser = argparse.ArgumentParser(description="Decomposes a FSM into smaller components by remapping its outputs. Uses a SAT solver.")
|
||||
parser.add_argument('-c', '--components', type=int, default=2, help='number of components')
|
||||
parser.add_argument('-n', '--total-size', type=int, help='total number of states of the components')
|
||||
args = parser.parse_args()
|
||||
|
||||
# als de de total_size te laag is => UNSAT => duurt lang
|
||||
c = args.components
|
||||
total_size = args.total_size
|
||||
|
||||
assert c >= 1 # c = 1 is zinloos, maar zou moeten werken
|
||||
assert total_size >= c # elk component heeft tenminste 1 state
|
||||
|
||||
|
||||
###################################
|
||||
|
@ -41,16 +55,10 @@ def print_table(cell, rs, cs):
|
|||
|
||||
################
|
||||
# Voorbeeld data
|
||||
N = 8 # fsm heeft 2N states
|
||||
N = 8
|
||||
machine = rick_koenders_machine(N)
|
||||
|
||||
states = [(n, b) for n in range(N) for b in [0, 1]]
|
||||
|
||||
# We zoeken 2 componenten met gezamelijke grootte 6 (minder dan 8)
|
||||
# als de de total_size te laag is => UNSAT => duurt lang
|
||||
c = 2
|
||||
total_size = 10
|
||||
|
||||
|
||||
########################
|
||||
# Encodering naar logica
|
||||
|
|
Loading…
Add table
Reference in a new issue