tourcalc package

tourcalc.cal_cat(age_select, dis_select)[source]

calculation of weight categories

Parameters

age_select

selected age divisions [list]

dis_select

selected disciplines [list]

tourcalc.calculate_fight_time(dict_inp, final, bronze_final, ms_mode)[source]

calculate the fight time

Parameters

dict_inp

contains the number of athletes per category [dict]

tatami

number of competition areas [int]

final

does the event have a final block [bool]

ms_mode

add an extra fight for bronze[bool]

tourcalc.descition_matrix(cat_time_dict, av_time, tatami, break_t, breaktime, breaklength)[source]

to find the best solution based on penalty and weighting of the results

Parameters

cat_time_dict

dictionary with categories and time of each category [dict]

av_time

reference time for average tatami [float] (sec)

tatami

number of tatamis [int]

break_t

type of the break that is used [individual, block, no break]

breaktime

time when the break should happen [dateime]

breaklength

length of the break [datetime]

tourcalc.distr_cat_alg(jobs, av_time, cur_per, cur_pen_time, tatami, break_t, breaktime, breaklength)[source]

Run the algorithm. Create List of dictionaries with, where each discipline has its own dictionary. And fill it with the existing categories. Sort each dictionary by size (longest competitions in beginning of list)

Parameters

jobs

dict of categories that need to be distributed (dict)

av_time

reference time for average tatami (float [s])

cur_per

current order of disciplines [list]

DIS_CHA_TIME

penalty time for changing a discipline [fload [s]]

DIS_CHA

indicate change of discipline [str]

tatami

number of tatamis [int]

break_type

“block” ; “Individual” [str]

breaktime

time when the break should happen [dateime]

breaklength

length of the break [datetime]

tourcalc.getdata(eventid, user, password)[source]

give they key and get the dict

tourcalc.heatmap(data, row_labels, col_labels, str_title)[source]

Create a heat map from a numpy array and two lists of labels. - HELPER FUNCTION DRAW

Parameters

data

A 2D pandas data frame array of shape (N = row_labels, M = col_labels). [df]

row_labels

A list or array of length N with the labels for the rows. [list]

col_labels

A list or array of length M with the labels for the columns. [list]

str_title

A string that contains the tittle [string]

tourcalc.minloadtatami(loads)[source]

Find the tatami with the minimum load. Break the tie of tatamis having same load on first come first serve basis.

Parameters

loads

list of loads [float]

tourcalc.plot_schedule_time(scheduled_jobs_i, cat_time_dict_i, start_time_i, date_i, final_time, final_start_time, bfinal_type, bfinal_time, final_tat, bfinal_tat)[source]

plots a schedule horizontal

Parameters

scheduled_jobs

a list of lists of all categories per tatami [[str]]

cat_time_dict

a dict that maps the strings in “scheduled_jobs” to times [dict]

start_time

the start time of the day [datetime]

date

The date of the current day [datetime]

tourcalc.read_in_file(fname)[source]
Read in file
  • HELPER FUNCTION TO READ IN THE CSV FILE

Parameters

fname

name of the tournament [str]

tourcalc.write_tour_file(tour_name, df, i_tatami, days, final, start_time, date, break_t)[source]

create a new tournament file

Parameters

tour_name

name of the tournament [str]

cat_par

dict that links the category to a number of participants [dict (string -> int)]

cat_dict_day

dict that links the category to a day [dict (string -> int)]

i_tatami

number of tatamis [int]

days

number of days [int]

final

does the event have a final block [bool]

start_time

time when the event should happen [dateime]

date

date of the first day of the event [dateime]

break_t

type of the break that is used [individual, block, no break]

Submodules