Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ttc18
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stgroup
ttc18
Commits
19d365bf
Commit
19d365bf
authored
6 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
initial version of plot
parent
af1298fd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
jastadd-mquat-benchmark/results/.gitignore
+1
-0
1 addition, 0 deletions
jastadd-mquat-benchmark/results/.gitignore
jastadd-mquat-benchmark/results/plot.py
+109
-0
109 additions, 0 deletions
jastadd-mquat-benchmark/results/plot.py
with
110 additions
and
0 deletions
jastadd-mquat-benchmark/results/.gitignore
+
1
−
0
View file @
19d365bf
*
*
!.gitignore
!.gitignore
!jastadd-mquat-plots.ipynb
!jastadd-mquat-plots.ipynb
!plot.py
!vis_scenarios.ipynb
!vis_scenarios.ipynb
!to-html.sh
!to-html.sh
!fr
!fr
This diff is collapsed.
Click to expand it.
jastadd-mquat-benchmark/results/plot.py
0 → 100644
+
109
−
0
View file @
19d365bf
import
os
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
pandas
as
pd
from
matplotlib
import
colors
as
mcolors
# constants
bar_width
=
0.2
solver_names
=
[
'
ilp-direct
'
,
'
simple
'
]
patterns
=
[
'
❌
'
,
'
✔
'
]
colors
=
[
c
[
4
:]
for
c
in
(
sorted
(
mcolors
.
TABLEAU_COLORS
.
keys
()))
if
'
dark
'
+
c
[
4
:]
in
mcolors
.
CSS4_COLORS
]
colors
.
reverse
()
def
to_label
(
name
):
if
'
-
'
in
name
:
tokens
=
name
.
split
(
'
-
'
)
return
'
{} ({})
'
.
format
(
tokens
[
0
].
upper
(),
tokens
[
1
].
title
())
else
:
return
name
.
title
()
def
load
(
name
,
show_head
=
False
):
data
=
pd
.
read_csv
(
name
)
data
[
'
tool
'
]
=
data
.
name
.
astype
(
str
)
data
[
'
Gen
'
]
=
(
data
.
Gen
.
astype
(
int
)
>
0
)
*
data
.
Gen
.
astype
(
int
)
data
[
'
total
'
]
=
data
.
Gen
.
astype
(
int
)
+
data
.
Solved
.
astype
(
int
)
if
show_head
:
data
.
head
()
return
data
def
load_scenario_file
(
name
,
show_head
=
False
):
for
filename
in
os
.
listdir
(
"
scenarios
"
):
if
filename
.
endswith
(
name
):
return
load
(
"
scenarios/
"
+
filename
,
show_head
)
def
plot_range
(
names
,
labels
,
ax
):
# constants
# colors = plt.get_cmap("rainbow")
# colors = list(mcolors.to_rgba_array(color))
N
=
len
(
solver_names
)
width
=
0.05
ind
=
np
.
arange
(
N
)
barpos
=
[]
for
i
in
range
(
len
(
names
)):
barpos
+=
list
((
ind
+
i
*
(
N
+
0.5
))
*
width
)
labelpos
=
[]
for
i
in
range
(
len
(
names
)):
labelpos
+=
[(
0.5
+
i
*
(
N
+
0.5
))
*
width
]
for
(
name
,
i
)
in
zip
(
names
,
range
(
len
(
names
))):
# load data
data
=
load_scenario_file
(
name
)
means
=
data
.
total
rect
=
ax
.
bar
((
ind
+
i
*
(
N
+
0.5
))
*
width
,
means
,
width
=
width
,
color
=
colors
)
for
r
,
isValid
,
color
in
zip
(
rect
,
data
.
Valid
,
colors
):
ax
.
text
(
r
.
get_x
()
+
r
.
get_width
()
/
2
,
max
(
5
,
r
.
get_y
()
+
r
.
get_height
()),
patterns
[
isValid
],
fontname
=
'
symbola
'
,
fontsize
=
16
,
ha
=
'
center
'
,
va
=
'
bottom
'
,
color
=
'
black
'
)
ax
.
text
(
r
.
get_x
()
+
r
.
get_width
()
/
2
,
max
(
5
,
r
.
get_y
()
+
r
.
get_height
()),
'
%d
'
%
int
(
r
.
get_height
()),
fontsize
=
10
,
ha
=
'
center
'
,
va
=
'
bottom
'
,
color
=
'
black
'
)
ax
.
set_xticks
(
labelpos
)
ax
.
set_xticklabels
(
labels
)
# ax.legend(rect, [to_label(n) for n in solver_names])
ax
.
set_yticks
([
1
,
1000
,
1000000
])
def
create_grid
():
variants
=
(
2
,
4
)
requests
=
(
1
,
2
,
3
)
depth
=
(
1
,
2
,
3
)
resources
=
[
15
,
30
]
fig
,
axs
=
plt
.
subplots
(
len
(
variants
),
len
(
requests
),
figsize
=
(
12
,
12
),
subplot_kw
=
dict
(
yscale
=
"
log
"
))
for
v
,
i
in
zip
(
variants
,
range
(
len
(
variants
))):
for
q
,
j
in
zip
(
requests
,
range
(
len
(
requests
))):
plot_range
([
'
size_v%d_q%d_d%d_r15.csv
'
%
(
v
,
q
,
d
)
for
d
in
depth
],
[
'
depth = %d
'
%
d
for
d
in
depth
],
axs
[
i
,
j
])
for
i
in
range
(
len
(
variants
)):
axs
[
i
][
-
1
].
set_ylabel
(
'
Implementation
\n
Variants =
'
+
str
(
variants
[
i
]),
rotation
=
0
)
axs
[
i
][
-
1
].
yaxis
.
set_label_coords
(
1.2
,
0.5
)
for
i
in
range
(
len
(
requests
)):
axs
[
0
][
i
].
set_xlabel
(
'
Requests =
'
+
str
(
requests
[
i
]),
rotation
=
0
)
axs
[
0
][
i
].
xaxis
.
set_label_coords
(
0.5
,
1.05
)
fig
.
patch
.
set_facecolor
(
'
w
'
)
plt
.
show
()
create_grid
()
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