add starting point for mosis 2024 assignment
This commit is contained in:
parent
3404c782a9
commit
4b959bc98b
9 changed files with 441 additions and 0 deletions
56
assignment/plot_template.py
Normal file
56
assignment/plot_template.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
def make_plot_ships_script(priority:str, strategy:str, max_waits:list[float], gen_num:int):
|
||||
return (f"""
|
||||
### priority={priority}, strategy={strategy} ###
|
||||
|
||||
set terminal svg
|
||||
|
||||
# plot 1. x-axis: ships, y-axis: queuing duration of ship
|
||||
|
||||
set out 'plot_ships_{strategy}_{priority}.svg'
|
||||
set title "Queueing duration"
|
||||
set xlabel "Ship #"
|
||||
set ylabel "Seconds"
|
||||
#unset xlabel
|
||||
#unset xtics
|
||||
set key title "Max Wait"
|
||||
set key bottom center out
|
||||
set key horizontal
|
||||
|
||||
"""
|
||||
# + '\n'.join([
|
||||
# f"set style line {i+1} lw 4"
|
||||
# for i in range(len(max_waits))
|
||||
# ])
|
||||
+ f"""
|
||||
|
||||
# set yrange [0:90000]
|
||||
set xrange [0:{gen_num}]
|
||||
set style fill solid
|
||||
|
||||
plot 'output_{strategy}_{priority}.csv' \\\n """ + ", \\\n '' ".join([
|
||||
f"using 1:{i+1} title '{max_wait}' w boxes ls {i+1}"
|
||||
for i, max_wait in enumerate(max_waits)
|
||||
]))
|
||||
|
||||
def make_plot_box_script(priority:str, strategy:str, max_waits:list[float], gen_num:int):
|
||||
return (f"""
|
||||
|
||||
# plot 2. x-axis: max-wait parameter, y-axis: queueing durations of ships
|
||||
|
||||
set out 'plot_box_{strategy}_{priority}.svg'
|
||||
set style fill solid 0.25 border -1
|
||||
set style boxplot outliers pointtype 7
|
||||
set style data boxplot
|
||||
set key off
|
||||
|
||||
set xlabel "Max Wait"
|
||||
unset xrange
|
||||
unset yrange
|
||||
|
||||
set xtics (""" + ', '.join([ f"'{max_wait}' {i}"
|
||||
for i, max_wait in enumerate(max_waits)]) + f""")
|
||||
|
||||
plot 'output_{strategy}_{priority}.csv' \\\n """ + ", \\\n '' ".join([
|
||||
f"using ({i}):{i+2} title '{max_wait}'"
|
||||
for i, max_wait in enumerate(max_waits)
|
||||
]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue