A gifts distribution optimizer based on linear programing using PULP and the GLPK solver for our Analysis and Synthesis of Algorithms class. It determines the number of gift requests made by childern around the world that can be fulfilled this Christmas given constraints in the toy factories.
- Each factory produces a single type of toy and has a maximum stock limit.
- Each country has a minimum number of gifts that must be delivered.
- There are limits on the total exports from the factories in each country.
- Each child can request multiple toys but will receive at most one.
-
The first line contains three integers: the number of factories
n, the number of countriesm, and the number of childrent. -
The next
nlines each contain three integers: the factory IDi, the country IDjwhere the factory is located, and the maximum stockf_max_iof the factory. -
The next
mlines each contain three integers: the country IDj, the maximum export limitp_max_j, and the minimum number of giftsp_min_jto be delivered in that country. -
The next
tlines each contain the child IDk, the country IDjwhere the child lives, and the IDs of the factories from which the child requests toys.
3 2 3 1 1 1 2 1 1 3 2 1 1 2 1 2 2 1 1 1 2 3 2 1 2 1 3 2 1
python ./src/main.py < input_file.txtpython -m pytest ./tests/test_public.py