Skip to content

evoloshchuk/production-facility-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solution

The solution has 2 modes of producing bouquets and 2 simple strategies for assembling bouquets.

Modes
  • 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).
Strategies

Strategy defines 2 important choices:

  1. How to select a design to be produced?
  2. 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.

Installation

docker-compose up app

Usage

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

Test

docker-compose run --rm app bundle exec rspec

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages