Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
general
albi
Bachelor Mario Surlemont
Commits
ce6da17b
Commit
ce6da17b
authored
Jun 07, 2020
by
msurl
Browse files
added optional argument to choose type of constraints to use
parent
37315340
Changes
1
Hide whitespace changes
Inline
Side-by-side
python/conda package/k_hop_dominating_set_gurobi/k_hop_dominating_set_gurobi/cli.py
View file @
ce6da17b
...
...
@@ -19,24 +19,22 @@ def cli(args=None):
help
=
'parameter k of the k hop dominating set'
,
type
=
int
)
# p.add_argument(
# '-i', '--iterations',
# help='maximum number of iterations',
# const = float("inf"),
# type = float
# )
p
.
add_argument
(
'-g'
,
'--graph'
,
help
=
"input graph as .lp file"
)
p
.
add_argument
(
'-mtz'
,
action
=
'store_true'
,
help
=
'use Miller-Tucker-Zemlin constraints to ensure connectivity (default is a lazy approach using vertex separators)'
)
args
=
p
.
parse_args
(
args
)
# do something with the args
# print("CLI template - fix me up!")
G
=
lp_to_nx_graph
.
read
(
args
.
graph
)
ds
=
k_hop_dom_set
.
RootedConnectecKHopDominatingSet
(
G
,
args
.
k
)
if
args
.
mtz
:
ds
=
k_hop_dom_set
.
RootedConnectecKHopDominatingSet
(
G
,
args
.
k
,
constraints
=
k_hop_dom_set
.
ConnectivityConstraint
.
MILLER_TUCKER_ZEMLIN
)
else
:
ds
=
k_hop_dom_set
.
RootedConnectecKHopDominatingSet
(
G
,
args
.
k
)
# ds.solve_and_draw(iterations = args.iterations)
ds
.
solve_and_draw
()
# No return value means no error.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment