Hello,
I am in my second year of my Software Engineering BSc and was set this problem over the summer by one of my lecturers to either solve yourself or find out how to do it if you can't, so here I am

..
The problem I have been presented with is to create a program where the user can enter what cargo they wish to load into a container, it's size (i.e. width, length, height), and how many of that type of cargo there is. The user can then specify the size of the container they wish to put this cargo into. The application must then calculate if it is possible to fit all this cargo inside the container and if it fits, how to stack the cargo inside the container.
Now I have been doing this in C++ using QT as a frontend gui for the visualizing the whole thing as well as entering the data however there are so many variables that are in play that writing an function that does this successfully is prooving to be quite difficult and was wondering if anyone could give me any tips on how to solve this problem..
This is what I have so far:
I started by creating two structures to hold both the Container Details and the Details of each bit of cargo:
Code:
struct CargoDetails { //Structure to hold container details
std::string ContainerName;
double Width, Height, Length, Weight;
int NumAmount;
} AddedCargo[100];
struct ContainerDetails { //Structure to hold container details
std::string ContainerName;
double Width, Height, Length, Weight;
}SelectedContainer; My idea was to store how the containers are stacked in a multi-dimentional arrayed integer inside a structure which would represent the width, length and height of the boxes stacked inside the container i.e:
Code:
struct ContainerVisualStore {
int StackOrganization[100][100];
}ContainerStackLevel[100]; Basically: ContainerStackLevel[ContainerLevel][LengthSlotOfContainer][WidthSlotOfContainer] , so ContainerStackLevel[0][0][0] would be the cargo on the first level of the container at the very back corner of the container..
I can show what I've got so far on request, however it's fairly complex and may take quite a bit of explaining, so I wanted to see if anyone can see any obvious way of achiving this before I post the main function which doesn't work properly yet. I also run a function beforehand that simply calculates the volume of all the cargo and the volume inside the container to check if the containers will fit in volume however obviously this does not necessarily mean that all the cargo will fit and does not allow the calculation and viewing of how you would stack all the cargo..
Does anyone have any tips they could give me as any would be of great help!
Many Thanks
DoctorZeus