This dataset generator from the leftover problem is based in the work:
Bressan, G.M., da Silva, E.B., Pimenta-Zanon, M.H., da Silva Lizzi, E.A. (2022). Classification of Leftovers from the Stock Cutting Process. In: Pereira, A.I., Košir, A., Fernandes, F.P., Pacheco, M.F., Teixeira, J.P., Lopes, R.P. (eds) Optimization, Learning Algorithms and Applications. OL2A 2022. Communications in Computer and Information Science, vol 1754. Springer, Cham. https://doi.org/10.1007/978-3-031-23236-7_23
This project is licensed under the Apache-2.0 License
This project is build with the Python 3.10.2
You need to have installed the NumPy package. if you already have Python, you can install NumPy with:
conda install numpy or pip install numpy
If you already have Git, you can download this script with:
git clone https://github.com/ximiraxelo/leftoverproblem
To generate a dataset call the function generate_dataset()
objs, itens, demands = generate_dataset(n_itens, n_obj, l_types, L_types, d_types, l_min, l_max, L_min, L_max, d_min, d_max)
Inputs:
n_itens (int): the number of the itens per objectn_obj (int): the number of objectsl_types (int): the amount of types of sizes of the itensL_tpyes (int): the amount of types of sizes of the objectsd_types (int): the amount of types of the itens demandsl_min (int)andl_max (int): the minimum and maximum size of the itensL_min (int)andL_min (int): the minimum and maximum size of the objectsd_min (int)andd_max (int): the minimum and maximum of the itens demands
Outputs:
objs (list): a list withn_objslength that contains the objects sizesitens (list): a list with the shape (n_obs, n_itens) that contains the itens sizesdemands (list): a list with the shape (n_obs, n_itens) that contains the itens demands
You can use the parameters according to "The constrained compartmentalised knapsack problem, F. P. Marques and M. N. Arenales, 2007"
In this case you only need to specify n_itens, n_obj, l_types, L_types, d_types. See the example:
objs, itens, demands = generate_dataset(n_itens=20, n_obj=10, l_types=5, L_types=3, d_types=2)
The generated dataset can be saved in .npy files.
See more about .npy files in the NumPy documentation
To save a generated dataset call the function save_dataset()
save_dataset(objs, itens, demands, DATASET_PATH)
Inputs:
objs (list), itens (list), demands (list): the generated data from thegenerate_dataset()functionDATASET_PATH (str): the absolute path to save the.npyfiles
If you use this script in your work, please cite us