Monday, July 25, 2011

Floor Mats and Haskell

This is a problem that I'd like to solve in Haskell.

The other day I went to Clark's Rubber to purchase some carpet vinyl. I'm also interested in mats for doing rolls and handstands on a danceFloorArea.

There are two sizes:

smallMatLength = (600mm)
smallMatArea = smallMatLength^2
smallMatUnitPrice = $30

largeMatLength = (1000mm ^2)
largeMatArea = largeMatLength^2
largeMatUnitPrice = $50

I have a danceFloorArea in mind:

danceFloorWidth = 2200mm
danceFloorLength = 3200mm
danceFloorArea = danceFloorWidth * danceFloorLength

I want to cover as much danceFloorArea as possible for the lowest possible price, i.e. I want the highest possible possible danceFloorArea/[small/large]MatUnitPrice ratio:

Should I use smallMats, largeMats, or a combination of both?

1) How do I calculate (danceFloorArea / smallMatArea) without a remainder?
2) How I calculate (danceFloorArea / largeMatArea) without a remainder?
3) How do I calculate danceFloorCoverage = (a * smallMatArea) + (b * largeMatArea) without a remainder OR with the smallest possible remainder

Other questions, I guess...

1) How many smallMats can I fit into the area?
2) How much would (1) cost?
3) How much of the area would I cover?
4) How many largeMats can I fit into the area?
5) How much would (4) cost?
6) How much of the area would I cover?

No comments:

Post a Comment