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
fba3172a
Commit
fba3172a
authored
May 18, 2020
by
msurl
Browse files
added cli
parent
9568428e
Changes
1
Show whitespace changes
Inline
Side-by-side
python/conda package/k_hop_dominating_set_gurobi/k_hop_dominating_set_gurobi/cli.py
View file @
fba3172a
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
from
k_hop_dominating_set_gurobi
import
__version__
from
k_hop_dominating_set_gurobi
import
__version__
from
k_hop_dominating_set_gurobi
import
k_hop_dom_set
from
k_hop_dominating_set_gurobi
import
lp_to_nx_graph
def
cli
(
args
=
None
):
def
cli
(
args
=
None
):
p
=
ArgumentParser
(
p
=
ArgumentParser
(
...
@@ -12,11 +14,30 @@ def cli(args=None):
...
@@ -12,11 +14,30 @@ def cli(args=None):
help
=
'Show the conda-prefix-replacement version number and exit.'
,
help
=
'Show the conda-prefix-replacement version number and exit.'
,
version
=
"k_hop_dominating_set_gurobi %s"
%
__version__
,
version
=
"k_hop_dominating_set_gurobi %s"
%
__version__
,
)
)
p
.
add_argument
(
'-k'
,
'--k'
,
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"
)
args
=
p
.
parse_args
(
args
)
args
=
p
.
parse_args
(
args
)
# do something with the args
# do something with the args
print
(
"CLI template - fix me up!"
)
# print("CLI template - fix me up!")
G
=
lp_to_nx_graph
.
read
(
args
.
graph
)
ds
=
k_hop_dom_set
.
RootedConnectecKHopDominatingSet
(
G
,
args
.
k
)
ds
.
solve_and_draw
(
iterations
=
args
.
iterations
)
# No return value means no error.
# No return value means no error.
# Return a value of 1 or higher to signify an error.
# Return a value of 1 or higher to signify an error.
...
...
Write
Preview
Markdown
is supported
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