- #1
Physicsdude13
- 6
- 0
Homework Statement
Hi, I have to do a project in Fortran based on solving a system. My professor mentioned one idea to me, I am trying to see if this idea is even feasible and some potential ways to progress through it before I submit a project proposal to do it.
The problem is based on the square packing problem.
So for example a user inputs the coordinates of a large rectangle. The program then generates 100 squares all of varying sizes, and maximizes the amount of surface area the rectangle can be covered with those random squares generated. The squares cannot overlap or go outside the boundaries. Also, for extra credit possibly to show this as a GUI.
Homework Equations
This is an introductory course, so I may not have learned all the tools to fortran I need yet. But can anyone give me an idea as to the degree of programming difficulty. I know most of the basics, like subroutines, functions, loops, conditionals, variables, input, output.
The Attempt at a Solution
I am pretty stumped as to an algorithm to solve this as well. So far I can only think of doing the following pseudo-code:
1.User inputs 3-5 coordinates (putting a maximum at a 5 sided shape)
2.Program randomizes a variable amount of squares of random sizes within a range (the amount of squares generated can be determined by user, that way to increase the amount of surface area covered you just generate more squares sort of like an approximation method for the surface area)
3.Potentially represent the squares generated as coordinates as well in array format?
From 3 on, I am stumped: Any feedback would be much appreciated. Thank you.