The solution has 2 modes of producing bouquets and 2 simple strategies for assembling bouquets.
- Without storage capacity restriction - to start producing bouquets as soon as possible.
- With storage capacity restriction - to start producing bouquets only when storage is full (which allows for a more sophisticated strategies to assemble bouquets).
Strategy defines 2 important choices:
- How to select a design to be produced?
- How to select the additional (not fixed) flowers for a bouquet?
Available strategies:
- Greedy - to select the smallest possible design and take the first suitable flowers as additional.
- Rational - to select the design with the minimum additional (not fixed) flowers needed and takes the prevalent suitable flowers as additional.
docker-compose up app
cat input.txt | docker-compose run --rm app bundle exec ruby app.rb greedy
cat input.txt | docker-compose run --rm app bundle exec ruby app.rb greedy 256
cat input.txt | docker-compose run --rm app bundle exec ruby app.rb rational
cat input.txt | docker-compose run --rm app bundle exec ruby app.rb rational 256
or
echo -ne "AL1a1\n\naL\n" | docker-compose run --rm app bundle exec ruby app.rb greedy
echo -ne "AL1a1\n\naL\n" | docker-compose run --rm app bundle exec ruby app.rb greedy 256
echo -ne "AL1a1\n\naL\n" | docker-compose run --rm app bundle exec ruby app.rb rational 256
echo -ne "AL1a1\n\naL\n" | docker-compose run --rm app bundle exec ruby app.rb rational 256
docker-compose run --rm app bundle exec rspec