Visuals Generator
Gantt-Chart Generator
Note
The Gantt-Chart only works for comparably small problem sizes such as 6x6. For much larger problem sizes, the Gantt-Chart will be too large to be displayed using the matplotlib package.
This file provides functions to visualize the current states of a scheduling problems as gantt charts. Moreover, the generated gantt chart figures can be saved (e.g. as gif).
- class visuals_generator.gantt_chart.GanttChartPlotter
Bases:
object
This class provides functions to visualize the current states of a scheduling problems as gantt charts and save them as image or gif.
- classmethod get_gantt_chart_image(tasks: List[Task], show_image: bool = False, return_image: bool = True, quality_dpi: int = 100, overall_makespan: Optional[int] = None, overall_num_machines: Optional[int] = None, overall_task_position_list: Optional[List[int]] = None) <module 'PIL.Image' from '/home/docs/checkouts/readthedocs.org/user_builds/schlably/envs/latest/lib/python3.10/site-packages/PIL/Image.py'>
Can be used to visualize the current state of a scheduling problem as a gantt chart. Note that the figure becomes too large with large processing times and numbers of tasks.
- Parameters
tasks – List of tasks (instance) to be visualized
show_image – True, if the generated image is to be visualized
return_image – True if the generated image is to be returned
quality_dpi – dpi of the generated image
overall_makespan – Makespan of the scheduling problem. Can be None
overall_num_machines – Number of machines available in the scheduling problem. Can be None
overall_task_position_list – Task position in original list. Can be None
- Returns
Gantt chart image
- static save_gantt_chart_image(gantt_chart: Image, save_path_dir: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/schlably/checkouts/latest/src/visuals'), filename: str = 'gantt_chart', file_type: str = 'png') Path
Saves the input image
- Parameters
gantt_chart – Gantt chart image
save_path_dir – Relative path where the image is to be saved
filename – Name under the image is to be saved
file_type – Suffix with the image is to be saved
- Returns
Path of the saved image
- classmethod get_gantt_chart_image_and_save(tasks: List[Task], show_image: bool = False, quality_dpi: int = 100, overall_makespan: Optional[int] = None, overall_num_machines: Optional[int] = None, overall_task_position_list: Optional[List[int]] = None, save_path_dir: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/schlably/checkouts/latest/src/visuals'), filename: str = 'gantt_chart', file_type: str = 'png') Path
Initializes the creation and saving of a gantt chart image
- Parameters
tasks – List of tasks (instance) to be visualized
show_image – True, if the generated image is to be visualized
quality_dpi – dpi of the generated image
overall_makespan – Makespan of the scheduling problem. Can be None
overall_num_machines – Number of machines available in the scheduling problem. Can be None
overall_task_position_list – Task position in original list. Can be None
save_path_dir – Relative path where the image is to be saved
filename – Name under the image is to be saved
file_type – Suffix with the image is to be saved
- Returns
Path of the saved image
- classmethod get_gantt_chart_gif_and_save(tasks: List[Task], save_path_dir: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/schlably/checkouts/latest/src/visuals'), filename: str = 'gantt_chart', save_intermediate_images: bool = False, quality_dpi: int = 80) Path
Can be used to generate and save a gif of a gantt chart
- Parameters
tasks – List of tasks (instance) to be visualized
save_path_dir – Relative path where the gif is to be saved
filename – Name under the gif is to be saved
save_intermediate_images – True if the intermediate images of the gif creation should be saved
quality_dpi – dpi of the generated image
- Returns
Path of the saved image