Commit 8348db5c authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[cmd] cli: solutions_search: black + refactor options

parent f1f067c5
......@@ -345,59 +345,102 @@ def main():
global parser
parser = argparse.ArgumentParser(description=__doc__)
# Default log level: debug
parser.add_argument('-vv', '--verbose', nargs='?', default='info')
parser.add_argument("-vv", "--verbose", nargs="?", default="info")
# Subparsers
subparsers = parser.add_subparsers(title='subcommands', dest="subcommand")
subparsers = parser.add_subparsers(title="subcommands", dest="subcommand")
# PS: nargs='?' = optional
# PS:
# nargs='?': optional
# Default actions: https://docs.python.org/dev/library/argparse.html#action
## Solutions-search commands ###############################################
# subparser: Compute macs
# steps = 10
# steps = 7
# final_prop = "P"
# start_prop = None
# inv_prop = None
parser_input_file = subparsers.add_parser(
'solutions_search',
parser_search = subparsers.add_parser(
"solutions_search",
help=solutions_search.__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser_input_file.add_argument('model_file',
help="Cadbiom model (.bcx file).")
# Get final_property alone OR an input_file containing multiple properties
group = parser_input_file.add_mutually_exclusive_group(required=True)
group.add_argument('final_prop', nargs='?',
help="Final property that will occur at the end of the simulation.")
group.add_argument('--input_file', action=ReadableFile, nargs='?',
help="Replace 'final_prop' argument by a file with 1 logical formula"
"per line. This allows the software to launch 1 process per formula.")
parser_input_file.add_argument('--output', action=ReadableDir, nargs='?',
default='result/', help="Output directory.")
# default: False
parser_input_file.add_argument('--combinations', action='store_true',
help="If input_file is set, we can compute the combinations of the "
"formulas indicated on each line")
parser_input_file.add_argument('--steps', type=int, nargs='?', default=7,
help="Maximum of allowed steps to find macs")
parser_input_file.add_argument('--limit', type=int, nargs='?', default=400,
help="Limit the number of solutions.")
# https://docs.python.org/dev/library/argparse.html#action
# all_macs to False by default
#parser_input_file.add_argument('--all_macs', action='store_true',
## I/O
input_output_group = parser_search.add_argument_group(title="I/O")
input_output_group.add_argument("model_file", help="Cadbiom model (.bcx file).")
input_output_group.add_argument(
"--output",
action=ReadableDir,
nargs="?",
default="result/",
help="Output directory.",
)
## Settings
tune_group = parser_search.add_argument_group(title="Search settings")
tune_group.add_argument(
"--steps",
type=int,
nargs="?",
default=7,
help="Maximum of allowed steps to find macs",
)
tune_group.add_argument(
"--limit",
type=int,
nargs="?",
default=400,
help="Limit the number of solutions.",
)
# all_macs: False by default
# parser_search.add_argument('--all_macs', action='store_true',
# help="Solver will try to search all macs from 0 to the maximum of "
# "allowed steps.")
# continue to False by default
parser_input_file.add_argument('--continue', action='store_true',
# continue: False by default
tune_group.add_argument(
"--continue",
action="store_true",
help="Resume previous computations; if there is a mac file from a "
"previous work, last frontier places/boundaries will be reloaded.")
parser_input_file.add_argument('--start_prop', nargs='?', default=None,
"previous work, last frontier places/boundaries will be reloaded.",
)
## Properties
properties_group = parser_search.add_argument_group(title="Model checking")
# Get final_property alone OR an input_file containing multiple properties
group = properties_group.add_mutually_exclusive_group(required=True)
group.add_argument(
"final_prop",
nargs="?",
help="Final property that will occur at the end of the simulation.",
)
group.add_argument(
"--input_file",
action=ReadableFile,
nargs="?",
help="Replace 'final_prop' argument by a file with 1 logical formula "
"per line. This allows the software to launch 1 process per formula.",
)
# combinations: False by default
properties_group.add_argument(
"--combinations",
action="store_true",
help="If input_file is set, we can compute the combinations of the "
"formulas indicated on each line.",
)
properties_group.add_argument(
"--start_prop",
nargs="?",
default=None,
help="Property that will be part of the initial state of the model. "
"In concrete terms, some entities can be activated by this "
"mechanism without modifying the model.")
parser_input_file.add_argument('--inv_prop', nargs='?', default=None,
"In concrete terms, some entities can be activated by this "
"mechanism without modifying the model.",
)
properties_group.add_argument(
"--inv_prop",
nargs="?",
default=None,
help="Invariant property that will always occur during the simulation. "
"The given logical formula will be checked at each step of the simulation.")
"The given logical formula will be checked at each step of the simulation.",
)
parser_input_file.set_defaults(func=solutions_search)
parser_search.set_defaults(func=solutions_search)
## Solutions-related commands ##############################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment