Maximizing Rectangle Surface Area with Fortran Squares

In summary, the conversation was about a project in Fortran based on solving a system involving the square packing problem. The user was looking for ideas and feedback on the degree of programming difficulty. They also shared their current approach and asked for suggestions on how to solve the problem. The expert recommends breaking the problem into smaller steps and using nested loops and conditional statements to generate and manage the squares. They also suggest considering a data structure like a linked list and possibly adding a GUI to the project. Finally, the expert reassures that the project is feasible for an introductory Fortran course with proper planning and approach.
  • #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.
 
Physics news on Phys.org
  • #2


Thank you for sharing your project idea with us. It sounds like a challenging and interesting problem to tackle. Based on your description, it seems like you have a good understanding of the basics of Fortran and have a solid plan in place for approaching the problem.

To start, I would suggest breaking down the problem into smaller, more manageable steps. For example, you could first focus on generating a single square within the boundaries of the rectangle, without worrying about overlapping or maximizing surface area. Once you have this working, you can then move on to generating multiple squares and implementing the restrictions.

One potential approach could be to use a nested loop to generate coordinates for each square and check if they fall within the boundaries of the rectangle. You could also use a conditional statement to check for overlapping squares and adjust their coordinates accordingly.

As for representing the squares in an array format, this could be a good idea as it would make it easier to keep track of the squares and their coordinates. You could also consider using a data structure like a linked list to store the squares and their attributes.

As for the GUI aspect, this could be a fun addition to your project, but it may also add some complexity. If you are comfortable with graphical programming, then I would definitely recommend giving it a try. Otherwise, you could focus on creating a command-line interface first and then add a GUI later if time allows.

Overall, I would say that this project is definitely feasible for an introductory Fortran course. It will require some creative thinking and problem-solving, but with a solid plan and approach, I am confident that you can successfully complete it. Good luck with your project!
 
  • #3


This project idea sounds interesting and challenging. It definitely requires some advanced programming skills and knowledge of mathematical algorithms. Here are some suggestions for approaching this problem:

1. Start by breaking down the problem into smaller parts. For example, you can first focus on generating the squares within the boundaries of the rectangle without overlapping. This can be done by randomly choosing coordinates for the squares and checking if they fit within the boundaries.

2. Once you have the squares generated, you can then work on maximizing the surface area covered by them. This can be done by trying different combinations of squares and calculating the surface area each time. You can also use a loop to try different numbers of squares and see which combination gives the highest surface area.

3. You can also consider using a mathematical algorithm such as the greedy algorithm to optimize the placement of the squares. This involves placing the largest square first and then filling in the remaining space with smaller squares.

4. Another approach could be to use a genetic algorithm, where you randomly generate a population of solutions (i.e. combinations of squares) and then use selection, crossover, and mutation to evolve towards the solution with the highest surface area.

5. As for the GUI, you can use a graphics library such as OpenGL to visually represent the squares and the rectangle. This can make it easier for the user to input the coordinates and see the results.

Overall, this project requires a combination of programming skills and mathematical knowledge. It may also require some trial and error to find the most efficient algorithm and approach. Good luck with your project proposal!
 

Related to Maximizing Rectangle Surface Area with Fortran Squares

1. What is the concept behind "Maximizing Rectangle Surface Area with Fortran Squares"?

The concept behind this is to find the maximum possible surface area of a rectangle by using equal-sized Fortran squares. This is an optimization problem that involves finding the dimensions of the rectangle that will give the largest possible area.

2. How is this problem solved using Fortran?

This problem is solved using Fortran by using a mathematical approach called "calculus of variations". This involves finding the critical points of the surface area function and then determining which point gives the maximum value.

3. Can this problem be solved using other programming languages?

Yes, this problem can be solved using other programming languages as well. The concept and approach remain the same, only the syntax and specific functions may differ.

4. Are there any limitations to this approach?

Yes, there are limitations to this approach. This method assumes that the sides of the rectangle can only be formed by joining equal-sized Fortran squares, which may not always be the most practical or efficient solution. Additionally, this approach only works for rectangles and may not be applicable to other shapes.

5. What are some real-world applications of this problem?

This problem has various real-world applications such as optimizing the use of space in packaging and storage, maximizing crop yields in agriculture, and designing efficient building layouts. It can also be used in computer graphics to create rectangular images with the maximum possible area.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
15
Views
6K
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
4K
Replies
11
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
18
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Classical Physics
Replies
33
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
2K
  • Programming and Computer Science
Replies
4
Views
768
Back
Top