Course Content
Matlab Basics
Matlab Basics
Application: Logistics Problem
Continuing what you learned from the last chapter, here you'll learn how to help a distributor that's trying to optimize how they combine their products into shipments. You'll put everything you've learned into action, and pick up a bunch of new details along the way.
Task
Analyze the program's objectives and refer to the video for guidance and inspiration.
Identify the file containing data about bins and industry grades for palettes.
Use a library like Pandas to load the Excel file, extracting data on bins and industry grading standards.
Create all possible combinations of bins for grouping them into palettes, as demonstrated in the last chapter.
For every possible bin combination:
- Analyze each palette: compute average properties (e.g., tensile strength and percent defects) for the bins in each palette;
- Grade and price palettes: assign grades and calculate prices based on the averages and industry standards from the Excel file;
- Compare sales prices: track the best combination by comparing the total sales price of the current combination with previous results.
Once the optimal combination is determined, extract the corresponding bin tags using row indices.
Save the final results, including the best combination and associated details, back to an Excel file.
- Cross-check the program's output with the results shown in the video, ensuring the optimal price matches;
- Validate palette properties against industry standards using spreadsheet calculations.
- Design your program with a modular approach for better organization;
- Adjust and test your implementation iteratively to ensure accuracy and reliability.
- Bin properties: import as a matrix containing properties such as weight, tensile strength, and percent defects;
- Bin tags: import as a separate matrix;
- Industry grade standards: import as a matrix containing minimal tensile strength, maximum percent defects, and price per palette of 3 bins (7500 lbs);
- Industry grade names: import as a cell array.
Instead of using Generate_Combinations_MMS_M
from chapter 3, use the perms
function to generate permutations directly.
- Bin tags are recorded as indices that indicate the row positions in the original data. Convert these indices into bin tags using the row indices from the bin tags matrix;
- Ensure that the row indices are correctly matched between the bin tags and the original data.
- 2D matrices: these are used for importing and exporting data to and from Excel. Make sure to reference the correct rows and columns;
- 3D matrices: the
palette_permutations
matrix contains all possible bin combinations folded into a 3D matrix; - Each row represents a specific combination of bins into palettes;
- Each column represents the index of a specific bin;
- The third dimension (1, 2, 3) corresponds to different palettes.
- Limit the
for
loop to a single iteration (e.g.,for 1:1
) to finish the rest of the program and output initial results; - Focus on getting the program to output bin tags, palette grades, and the optimal price to Excel one at a time. You can comment out parts of the code to focus on specific aspects.
- Manually verify the average properties of each palette to ensure they are correctly calculated and graded, as well as the total price of the palette combination;
- If issues arise, use these verifications to diagnose problems within the
for
loop.
If results are correct for one permutation but an optimal combination isn't found, limit the for
loop to test a specific permutation, such as for 32280:32280
or for 16640:16640
. This allows you to check performance on drastically different combinations.
If the issue persists after verifying different permutations, there may be a problem with the logic that selects the best permutation from the evaluated iterations. Check the video to compare your results and ensure accuracy.
Thanks for your feedback!