Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
schedgen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Pour rappel, le service sera inaccessible ce lundi 05/05/25 midi pour raison de mise à jour.
Show more breadcrumbs
veriT
schedgen
Commits
d2dd4984
Commit
d2dd4984
authored
3 years ago
by
Hans-Jörg
Browse files
Options
Downloads
Patches
Plain Diff
Add query tool
parent
ce7565f7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
schedgen/schedgen-query.py
+146
-0
146 additions, 0 deletions
schedgen/schedgen-query.py
setup.py
+2
-1
2 additions, 1 deletion
setup.py
with
148 additions
and
1 deletion
schedgen/schedgen-query.py
0 → 100755
+
146
−
0
View file @
d2dd4984
#!/usr/bin/env python3
import
argparse
from
schedgen.opt.schedule
import
read_from_file
from
schedgen.parsers.gridtpt
import
GridTPT
from
schedgen.parsers.csvresult
import
CSVResult
from
schedgen.opt.helper
import
file_or_dir_path
,
new_file_path
,
file_path
args_parser
=
argparse
.
ArgumentParser
(
description
=
"
Prints some performance data of a schedule.
"
)
args_parser
.
add_argument
(
"
-d
"
,
"
--data
"
,
metavar
=
"
DIR
"
,
required
=
True
,
dest
=
"
data
"
,
help
=
"
Location of experimental data. A folder if the GridTPT parser is selected, a CSV file if the CSV parser is selected.
"
,
type
=
file_or_dir_path
,
)
args_parser
.
add_argument
(
"
-c
"
,
"
--csv
"
,
dest
=
"
csv
"
,
action
=
"
store_true
"
,
help
=
"
Use CSV instead of the GridTPT parser to read data.
"
,
)
args_parser
.
add_argument
(
"
-l
"
,
"
--logics
"
,
dest
=
"
logics
"
,
metavar
=
"
L
"
,
nargs
=
"
*
"
,
default
=
[
"
all
"
],
type
=
str
,
help
=
"
The logics to consider.
'
all
'
for all logics.
"
,
)
args_parser
.
add_argument
(
"
-t
"
,
"
--time
"
,
dest
=
"
time
"
,
metavar
=
"
T
"
,
default
=
float
(
"
inf
"
),
type
=
float
,
help
=
"
Total time available to the schedule in seconds.
"
,
)
args_parser
.
add_argument
(
"
-q
"
,
"
--query
"
,
dest
=
"
query
"
,
metavar
=
"
QUERY
"
,
default
=
"
all
"
,
type
=
str
,
help
=
"
Either: schedule, best, unsolved, compare.
"
,
)
args_parser
.
add_argument
(
metavar
=
"
FILE
"
,
dest
=
"
schedule
"
,
help
=
"
Pre-schedule to simulate.
"
,
type
=
file_path
,
)
def
clip_inf
(
max
):
return
lambda
x
:
max
if
x
==
float
(
"
inf
"
)
else
x
if
__name__
==
"
__main__
"
:
args
=
args_parser
.
parse_args
()
logics
=
args
.
logics
timeout
=
args
.
time
if
not
args
.
csv
:
experiments
=
list
(
args
.
data
.
glob
(
"
**/*.txt
"
))
if
"
all
"
in
logics
:
filter
=
None
else
:
filter
=
logics
if
args
.
csv
:
r
=
CSVResult
(
args
.
data
,
filter
)
else
:
r
=
GridTPT
(
args
.
data
,
filter
)
exps
=
r
.
frame
.
copy
()
pre_schedule
=
None
pre_schedule
=
read_from_file
(
args
.
schedule
)
# Find a unique names
sc
=
"
solved
"
while
sc
in
exps
.
columns
:
sc
=
sc
+
"
_
"
scb
=
"
solved-best
"
while
scb
in
exps
.
columns
:
scb
=
scb
+
"
_
"
exps
[
sc
]
=
float
(
"
inf
"
)
exps
[
scb
]
=
float
(
"
inf
"
)
time
=
0.0
# Some pandas magic to calculated the simulated things
for
strategy_time
,
strategy
in
pre_schedule
:
solved
=
(
exps
[
strategy
]).
loc
[(
exps
[
strategy
])
<=
strategy_time
]
solving_time
=
solved
.
clip
(
0.0
)
+
time
solving_time
.
name
=
sc
time
=
time
+
strategy_time
update_idx
=
exps
.
loc
[
exps
[
sc
]
==
float
(
"
inf
"
)].
index
.
intersection
(
solved
.
index
)
exps
.
update
(
solving_time
.
loc
[
update_idx
])
exps
[
sc
].
loc
[
exps
[
sc
]
>
timeout
]
=
float
(
"
inf
"
)
solved_best
=
exps
.
min
(
axis
=
1
)
solved_best
.
loc
[
solved_best
>
timeout
]
=
float
(
"
inf
"
)
# help="Either: schedule, best, compare-best, compare-all.",
if
args
.
query
in
[
"
all
"
,
"
schedule
"
]:
if
args
.
query
==
"
all
"
:
print
(
"
Benchmarks solved by the schedule:
"
)
print
(
exps
[
sc
].
to_string
())
if
args
.
query
in
[
"
all
"
,
"
best
"
]:
if
args
.
query
==
"
all
"
:
print
(
"
\n
Benchmarks solved by the theoretical best solver:
"
)
print
(
solved_best
.
to_string
())
if
args
.
query
in
[
"
all
"
,
"
unsolved
"
]:
if
args
.
query
==
"
all
"
:
print
(
"
\n
Benchmarks not solved by the schedule:
"
)
for
i
in
list
(
exps
[
sc
].
loc
[
exps
[
sc
]
==
float
(
"
inf
"
)].
index
):
print
(
i
)
if
args
.
query
in
[
"
all
"
,
"
compare
"
]:
if
args
.
query
==
"
all
"
:
print
(
"
\n
Benchmarks solved by the theoretical best solver, but not by the schedule:
"
)
ls
=
list
(
exps
[
sc
].
loc
[
exps
[
sc
]
==
float
(
"
inf
"
)].
loc
[
solved_best
<
float
(
"
inf
"
)].
index
)
for
i
in
ls
:
print
(
i
)
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
1
View file @
d2dd4984
...
...
@@ -35,7 +35,8 @@ setup(
"
schedgen/schedgen-optimize.py
"
,
"
schedgen/schedgen-finalize.py
"
,
"
schedgen/schedgen-simulate.py
"
,
"
schedgen/schedgen-visualize.py
"
"
schedgen/schedgen-visualize.py
"
,
"
schedgen/schedgen-query.py
"
],
license
=
"
BSD 3-Clause License
"
,
classifiers
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment