Kursusindhold
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
Understand the Goals
Analyze the program's objectives and refer to the video for guidance and inspiration;Locate the Excel File
Identify the file containing data about bins and industry grades for palettes;Import the Data
Use a library like Pandas to load the Excel file, extracting data on bins and industry grading standards;Generate Bin Combinations
Create all possible combinations of bins for grouping them into palettes, as demonstrated in the last chapter;Evaluate Each Combination
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;
Identify the Best Combination
Once the optimal combination is determined, extract the corresponding bin tags using row indices;Export Results
Save the final results, including the best combination and associated details, back to an Excel file;Quality Control
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;
Iterate and Refine
Design your program with a modular approach for better organization;
Adjust and test your implementation iteratively to ensure accuracy and reliability.
Data Importing
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;
Generate Combinations
Instead of using
Generate_Combinations_MMS_M
from chapter 3, use theperms
function to generate permutations directly;
Identifying Bin Tags
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;
Handling Dimensions and Indices
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;
Divide and Conquer Approach
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;
Verification
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;
Test Specific Permutations
If results are correct for one permutation but an optimal combination isn't found, limit the
for
loop to test a specific permutation, such asfor 32280:32280
orfor 16640:16640
. This allows you to check performance on drastically different combinations;
Troubleshooting
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.
Tak for dine kommentarer!