Closed Thread
Results 1 to 60 of 60

Optomize raw material

  1. #1
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Optomize raw material

    Hello,

    I am looking for a spreadsheet which will divide and ultilise 3 different raw material lengths in to several pallet wood requirements based on monthly production.

    Currently doing this manually which is an absolute nightmare and very time consuming.

    For example my raw materials (all in mm) are 4800, 3600 and 3000. From these lengths I will produce around 10 different raw material per length. 16x75,16x95,16x120,18x75 and so on.

    There are 27 different products on order (as it stands) I am looking for a formula/spreadsheet which will optomize the best cutting plan to divide up the raw materials available.

    Any help would be greatly appreciated.
    Attached Files Attached Files
    Last edited by BenjaminElias; 08-15-2022 at 04:56 AM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Optomize raw material

    I suggest you amend the linked names in K6 etc as they use inappropriate language re file names.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    The data in K6, L6 etc is the total volume of raw material per month per size. Columns C, D and E are the products I need to cover from the raw material. For example C4, D4 and E4 would be 16x75x845.

    The raw material can be changed to cover the negatives though for example 22x100's are interchangeable with 18x120's, 16x95's are interchangeable with 18x75's.

    Essentialy I am looking for a calculator which will optomize the lengths/products on order from the raw materials available.

    Hope I am explaining this OK? If you need more information let me know.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Optomize raw material

    You mis-understood my post: please look at the formula in K6 [and many others] and see the file name "**** YOU PALLET.xlsx" !

  5. #5
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    Ah ok, all the formulas are in the same worbook in different tabs. I haven't shared the other tabs on here as they contain sensitive information.

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    What John referred to is forum rule 9 :

    9. Abusive language or insults will not be tolerated.
    Alf

  7. #7
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    Oh sorry am such an idiot! I?ll update that and change the name.

  8. #8
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    No problem easy to do after workinig with a problem and not manage to sort it out. Myself I tend to get really anoyed and this will sometimes influence the naming of the file.

    Looken at your problem in the other thread. Complicated as you need to consider total size both length and width. Depending on the size it could also be rotated 90 degrees.

    I've seen a freebie a Turkish program for packing a container, will see if I could find it and post in your other thread. Perhaps that could be of help.

    Alf

  9. #9
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    Updated the workbook.

    What do you mean by rotate 90 degrees?

  10. #10
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Since pieces cut has both length and width i.e. they are two dimensional but to maximize use of cutting stock you will cut these parallel with stock length and perhaps also parallel to the stock width.

    On the other hand since you are cutting wood you probably would cut along the fiber in the wood for maximum strength so this problem may never arise,

    rotated.jpg

    Alf
    Last edited by Alf; 08-15-2022 at 06:34 AM.

  11. #11
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    I've set up a solver model for one case based on the raw data in cell S2. Since T, W are the same for this case I've only modeled for length and used numbers from orders column as the number of pieces that shall
    be produced.

    The Excel solver had some problem with the model saying it was not linear so I had to run the GRG nonlinear engine. I also tested the OpenSolver model a freebie made by the University of Auckland NZ. Their model had no
    problem with linearity.

    Included excess production as wastage. the only thing I have not modeled is thickness of cut. Could be a problem as in some cases thee are no wastage.

    The bad about this method are it requires a rebuild of the model when you change cut size as one tries to set up all possible combinations of cuts.

    As you uploaded file is not that easy to understand I think an explanation of the different values the how and why would be of help.

    Alf
    Attached Files Attached Files
    Last edited by Alf; 08-16-2022 at 11:55 PM.

  12. #12
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    Really appreciate the help Alf thank you.

    I'm not sure I understand how you got the results?

    To explain it better, columns C, D and E are all the products that are on order for this month for example row 4 product would be 16x75x845. This product can only be produced from the same dimensions of raw material, 16x75x4800, 16x75x3600 or 16x75x3000.

    Column G is the volume of pallet still to be produced.

    Column H is the current stock

    Column I is the volume of orders. Columns G, H and I are all in M3, column J converts the volume in to number of packs.

    What I am looking for is to optomize the best possible product mix out of the raw material available to me.

    Columns K-S is the volume of boards we will produce, dimensions can be altered to aplly to what pallet wood is on order.

    If you need me to explain anything else just let me know. Thank you.

  13. #13
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Just a short intro on how I made the model.

    First I tested a number of combinations of the different lengths to find combinations that added up to 4800. This is the time consuming part. Having got this setup I then build the solver model. Solver the excel add-in is not installed by default when Excel is in stalled.

    https://support.microsoft.com/en-us/...c-e24772f078ca

    To see the different combination just add 1 to every cell in range M13:M28. So a 1 in M13 will produce 2 pieces with a length of 2400 with a 0 waste, M14 will produce 1 of length 2400 and 2 of length 1200 also with 0 waste.

    To run the model add the demand in cells F31:K31, clear range M13:M28, click on the "Data" tab and click "Solver" -> "Solve" button. Solver will chew on the number for some time and the result window will pop up and then click OK. That's all.

    The solver settings are: "Set Objective" This is what one wish to achieve. In this case set to minimum as I wish to minimize total wastage.

    Then "By changing cells" : the cells solver can change to reach the goal minimum wastage.

    "Subject to the Constraint" : this tells solver how it can do to reach minimum wastage

    1 The solver production must be equal to or greater than demand, range F31:K31. 2 The values in range M13:M28 must be integers

    I'll have a go of your file again with your last info and see if I can improve my solver model or decide if solver is the tool you need.

    Alf
    Last edited by Alf; 08-16-2022 at 09:24 AM.

  14. #14
    Valued Forum Contributor Hydraulics's Avatar
    Join Date
    07-15-2018
    Location
    Udine - Italy
    MS-Off Ver
    Office 365
    Posts
    373

    Re: Optomize raw material

    Quote Originally Posted by Alf View Post
    The Excel solver had some problem with the model saying it was not linear so I had to run the GRG nonlinear engine. I also tested the OpenSolver model a freebie made by the University of Auckland NZ. Their model had no
    problem with linearity.
    Hi Alf,

    Solver is right, and OpenSolver is wrong (we know that the linearity check cannot be trusted).

    The model is non linear because of the IF in column L. However, we don't need it, because we can calculate the waste per bar for a given configuration, and then it will be added to cell N29 only when used.

    The best result for me is 4780. Excel does find this minimum easily, but then spends a huge amount of time looking for other combinations.

    HTH,

    Francesco
    Attached Files Attached Files
    Aim high or don't even try.
    ---------------------------------
    If your question has been answered, don't forget to mark the thread as SOLVED.
    If you find an answer helpful, click on the star icon at the bottom of the post.

  15. #15
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    [QUOTE I'll have a go of your file again with your last info and see if I can improve my solver model or decide if solver is the tool you need.

    Alf[/QUOTE]

    That's great Alf thank you so much for your help. I feel it's getting close to what I need.

    Do I need to set up a new solver for each size or can I change the sizes in the solver you sent?

  16. #16
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Do I need to set up a new solver for each size or can I change the sizes in the solver you sent?
    This solver model is build for minimizing the waste when producing 6 different cuts 2400, 1200, 1140, 1000, 945 and 845. You can change the number of different cuts or remove some by changing the numbers in the range F31:K31 or remove the production of a cut by entering 0 in the appropriate cell.

    What you can't do is adding a new cut say 1800, then you have to rebuild the model to the new yield structure you will get by adding a new cut. This is the downside of this kind of model.

    Hi Fancesco:

    I do like to keep my models as tidy as possible that's why I use the If statement but this is not the reason Excel solver tells the model is not linear. If you choose the excess production as target cell Solver has no problem and accept the model as linear or you could chose the total waste from bars again excel has no problem with linearity but if I combine the sum of "total waste from bars + excess production" then solver complains about linearity.

    This is a setup I've used a number of times in excel 2010 (the If part and the sum of waste from bars and excess production) and excel2010 did not have any problem with it but excel 2019 seems to have it.

    In this case it was faulty formulas in range L14:L28, this has now been corrected in the uploaded file post 11. Strange I removed image in this post but it still shows????

    Alf
    Attached Images Attached Images
    Last edited by Alf; 08-17-2022 at 12:03 AM. Reason: Wrong formulas in post 10

  17. #17
    Valued Forum Contributor Hydraulics's Avatar
    Join Date
    07-15-2018
    Location
    Udine - Italy
    MS-Off Ver
    Office 365
    Posts
    373

    Re: Optomize raw material

    Quote Originally Posted by Alf View Post
    If you choose the excess production as target cell Solver has no problem and accept the model as linear or you could chose the total waste from bars again excel has no problem with linearity but if I combine the sum of "total waste from bars + excess production" then solver complains about linearity.
    Hi Alf,

    I cannot replicate this behavior on my PC. When I remove the IFs, Solver has no problem using Simplex LP (the problem is indeed linear) on total waste + overproduction. However, I can spot some problematic cells in your workbook: see for instance L18, which should be 255. I assume that the value in M18 has been changed in the last iteration of OpenSolver, and not updated because of the IF. This may (or may not) return a true optimal result.

    HTH,

    Francesco

  18. #18
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Hi Francesco

    How right you are. In cell L18 the formula for waste is "=IF(M17=0;0" this should of course be "=IF(M18=0;0" and fixing that L18 becomes 255. Checking all formulas I found 2 more errors where reference was set to the wrong M value.

    The result total waste goes up to 4780 on both results (excel solver and OpenSolver) and now I can run excel solver in "Simplex mode" using total waste cell G37 as "Objective cell" without any complaints about setup not linear with the IF statement in cells L14:L28.

    Going to update the file I downloaded in post 11 with the updated and corrected version and have a go at running this file on my wife's laptop as she has Office 365 installed on hers. Will be interesting to see if her Office version complains about linearity.

    Alf

  19. #19
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    Hi Alf,

    Apologies I should of mentioned before, we only have the capability of cutting 5 products out.

  20. #20
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Digging through older posts I finally found this old post.
    https://www.excelforum.com/excel-for...ator-help.html
    Check out the file uploaded by Hydraulics post 9 where he uses the MMULT function entered as array function to find the optimal cutting pattern with different stock lengths to minimize losses.

    This seems a much easier method instead of manually setting up a cutting pattern as I did. So ask him if you could have a guided tour through his setup. Myself I would not mine a more thoroughly explanation on the how and the way.

    Alf
    Last edited by Alf; 08-17-2022 at 06:36 AM.

  21. #21
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    Alf,

    How did you get the solver to accept "integer" as a constraint?

    I get the following message;Screenshot 2022-08-17 122822.png

  22. #22
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Strange check that the range M14:M28 is formatted as numbers. In my uploaded file they are but if you copy the values from sheet "Pallet Dump" I column the numbers there are formatted as "Text"

    numbers_as_text.jpg

    Another possible error is defining this range as "Integer" before you define them but then you get a different error message telling you can only set cells to change as Integer,

    Alf
    Last edited by Alf; 08-17-2022 at 04:00 PM.

  23. #23
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    There is another way of setting up solver. In this case solver is run in a loop using VBA.

    The good: The format is free, that is you just enter the lengths and lets solver figure out the optimal cutting.

    The bad: This technique may produce a suboptimal solution because every time solver finds an optimal solution these pieces are removed and the that gives solver a lesser chance to find the next good/optimal solution equal to the previous one in wastage.

    To use this model a reference to solver must set in Visual Basic. Developers tab -> Visual Basic icon -> Tools -> References and tick box "Solver". Click OK and close Visual Basic Window.

    Then run macro "SolverLoop"

    Macro clears old data except "Demand" and "Stock Length" upgrade these when needed. Model is build for 10 different cuts but can easily be expanded.

    The result shows the suboptimal effect still the total wastage is the same as I got in the previous uploaded file. Also the last piece of wastage is 3660 so big that it can be used later on.

    The theoretical need for stock lengths are 31.0047 i.e. one needs 32 stock boards but from the last one only 2 cm so the loop result is not to far off.

    As I said before the input of lengths is free, smallest to biggest or mixed small, big, small, small, big.

    Just for comparison reasons I also tested with "OpenSolver" and got the same result, the macro for "OpenSolver" will need an installation of "OpenSolver" as well as a reference set to it in Visual Basic, but you do not really need it so you can delete the "OpenSolver" sheet and the "OpenSolver" macro.

    Alf
    Attached Files Attached Files
    Last edited by Alf; 08-18-2022 at 05:37 AM.

  24. #24
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    Alf,

    Thanks very much for all your help this looks really good and is exactly what I am looking for.

    Appreciate you spending time on this, thanks agin.

  25. #25
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    You are welcome and thanks for feedback

    Yes this is a very easy model to work with as both cut length and stock length is so easily updated. Still there are always the risk of getting a suboptimal result so I would recommend to calculate the theoretical minimum wastage to get an indication of the theoretical number of stock lengths used and the minimum wastage.

    If the different cut lengths are rather similar in length then the risk for a suboptimal result is much smaller.

    Alf

    Ps If you feel this has solved your problem could you please mark this thread "Solved". Go to your first post, click on "Thread Tools" dropdown and click "Solved"

  26. #26
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    @Alf,
    i give you 150 possible combinations with the 3 raw lengths 4800, 3600 and 3000.
    I suppose, if you use the Top-50 in your model instead of just your length of 4800, you can achieve a better result ???
    And work with integer or that'll take to much time ?

    I have a loss of 580 mm (cut off after 180 seconds)

    Schermafbeelding 2022-08-19 005412.jpg
    Attached Files Attached Files
    Last edited by bsalv; 08-18-2022 at 06:58 PM.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  27. #27
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    The solution to find all combinations with VBA.
    The way solver should work with VBA isn't finished yet
    Attached Files Attached Files

  28. #28
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Hi bsalv

    Thanks for your uploaded new model. Really a most impressive setup. The best of it I think is the macro that finds all the possible combinations. .

    I timed the solution macro and almost immediately it got a stabile "Incumbent" of 580 so I changed the cutoff time to 5 second and still got the same result as you with your setting of 30 sec.

    I also tested the uploaded file in post 26 using the OpenSolver

    OpenSolver.jpg

    Keep up the good work and I can hardly wait until you finished you last part of your work integrating solver with VBA.

    Alf

  29. #29
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    thanks,

    that part, i have no experience with it, it keeps giving errors, so if you know better ...
    There were 150 combinations, but i think all combinations with a waste of for example >400 can also be deleted or 'll that give no advantage in calculating ?

    I was also thinking to allow the model to produce extra items and keep them in stock for next week.
    That was that extra orange line "valided waste" where that waste had a weight of 10% of the effective waste. (then the equation 'd be ">=" instead of "=")
    But it didn't use that method in this example,
    Perhaps if there were only 2-3 worse combinations in the initial setup then Solver 'll use this ????

    Which one is better ? Solver or OpenSolver ?
    Last edited by bsalv; 08-19-2022 at 06:34 AM.

  30. #30
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    i hope this one is Okay.
    It's important for the combinations that the smallest length is in C2 to fill a certain cut with the max possible of that smallest length.
    For the others lengths the sequence isn't important, but adviceable best ascending (not obliged).
    I have no experience with the SolverOptions ....

    Please Login or Register  to view this content.
    in the example in the attachment, just a small problem with at waste of 20 mm and 1 length of 1000 mm that can be used next week, so it gets a penalty of 10% = 100 mm. Together the waste is 120 mm.
    Attached Files Attached Files

  31. #31
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Hi again

    Having tested both files I at the moment prefer the one in post 27. The only problem with that one is that solver even if it find a solution almost at once is "unsure" if there don't exists a better solution and keep on testing long after it's needed. I see you have set stop time to 30 seconds. I tested with 15 and that was also OK. Then again stop time will depend on complexity of problem so with 30 second it will be fine in most cases.

    The file in post 30 has an error in the "Solve It" macro. The target cell is set as G2 but in the last version G2 contains text so this should be I2. But this is the only error I found. Still there are some problems as I can't run solver as a stand alone on the data so I must spend more time on it. Hopefully I find things that can explain this behavior during the weekend.

    Alf

  32. #32
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    There seems to be some problems with setting on the range solver should work on on the uploaded file in post 30. Not sure really what happens but I'm still on the hunt.

    Alf

  33. #33
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    I also worked further with #27, added a loop to calculate ad random 10 possible demands of lengths.
    5 of 20 questions were solved within a fraction of a second, the other 15 were until the limit of 30 seconds, but if you watch the statusbar, there was no progress made in those last 29 seconds, bizarre, perhaps you have to give him 3 minutes, but is it worth it ? The losses vary between 1,000-6,000 (column AC)
    Is OpenSolver better ?
    When those 30 seconds are finished, you get a popup, i can't let disappear. Is it possible ?
    Attached Files Attached Files

  34. #34
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Is OpenSolver better ?
    No both seems to suffer from the same problem i.e. finding a solution very fast but then looping trying to find a better one. Result raw stock used same in both cases as well as "Total waste", (I removed the part about next weeks production)

    I also did the runs with only 4800 as raw. Result are most impressing. The production required has a total length of 146.420 m. The solver result are 31 raw of 4.800 m plus a waste of 2.380 m. So what solver used must be "=31*4.800 - 2.380"
    and this gives a result of 146.420 so solver found in this case the theoretical used raw stock for the required production.

    Well one can't always hit the target so well but it's pleasant to have this happen.

    When those 30 seconds are finished, you get a popup, i can't let disappear. Is it possible ?
    . I really don't know, don't think so.

    Alf

  35. #35
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Tested last upload, seems better i.e. this runs OpenSolver in a matter of seconds and gives same result as Excel solver.

    Command to run OpenSolver
    Please Login or Register  to view this content.
    Must set a reference to OpenSolver in Visual Basic first. Modified part of you macro:

    Please Login or Register  to view this content.
    This can be modified a bit as well:
    Please Login or Register  to view this content.
    Alf

  36. #36
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    those 1-10 is the range of numbers you can choose to fill the green range J5:U5, with those numbers, solver find very easy a solution.Change that range to 10-100, meaning that you want for every length at least 10 to 100 units, then solver can't find it anymore in 1-2-3. That's a little bit logic, the that almost infinite loop triggers me.

    Where can o download OpenSolver, because he isn't in my references.

    Most of the macro was done with the recorder, so that one normally adds a lot of rubbish, that are the parts you deleted !
    Last edited by bsalv; 08-19-2022 at 03:31 PM.

  37. #37
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Please Login or Register  to view this content.
    Yes the typical helpfulness of Microsoft either you want it or not!!

    OpenSolver info and where to download:

    https://opensolver.org/

    You could try downloading 2.9.4_Beta_AdvancedWin this contains both linear and non-linear engines. It integrates nicely with excel and is also capable of reading excel's solver macros. I prefer to build my models for the excel solver and let OpenSolver read and run them.

    Can't remember if OpenSolver understands the "All Different" settings and it can't run "Evolutiotionary" settings.

    Alf

  38. #38
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    INSTALLED and ready to go : amazing !!! what a speed.
    In contrary with what i said a few hours ago, the random question with lots of lengths (100-10.000) are easier to solve then when the choice is between 1-10), even twice the time !!! (2 seconds instead of <1s)
    And i also suggested to reduce the number of possible combinations (now approx. 150) to the one's with a waste < 400 (=approx 80 = half) but 15% of the solutions use at least 1 cut with a waste >400, surprising !!!
    Average Waste = 0,75%
    i'm convinced of this tool !!!
    attachment with the OpenSolver in the macro
    Attached Files Attached Files
    Last edited by bsalv; 08-19-2022 at 06:35 PM.

  39. #39
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Yes OpenSolver is really a speed monster and it's not limited by the 200 constraint imposed on the excel solver. So far I've mainly worked with the linear engine and have hardly any experience with the non-linear engines found in xlam file.

    Still there are cases were I find the excel solver simplex engine gives a better solution than the OpenSolve's. But that could also be an effect of my model building skill.

    A limit setting on maximum waste is a good idea in my opinion.

    I'm off to Gothenburg in two hours time so I'll study and test you last upload during the weekend.

    Hopefully the OP is still reading this thread because you solution is a much better one that the one I gave him.

    Alf

  40. #40
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    OP's last activity here on the site was #24, so send him a PM as reminder ???

  41. #41
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    latest version, in the cooperation with Alf, you can now choose between the Solver and the OpenSolver in I1.

    Problem now, after some changings, Solver doesn't solve anymore and the solution is 0 waste with input. Great Solution !??
    If i modified to avoid that, it wasn't a liniair question anymore OpenSolver had no problems
    Attached Files Attached Files

  42. #42
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    isn't the waste columns G*H - I4 and now it doesn't work anymore, but i have to leave now ...
    Attached Files Attached Files

  43. #43
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    now optimizing the used length instead of the waste (but that's almost the same)
    A little variant 'd be if you know the price per unit to find the cheapest solution, which is perhaps different of the solution with the smallest waste.
    Attached Files Attached Files
    Last edited by bsalv; 08-21-2022 at 02:53 PM.

  44. #44
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Hi bsalv

    Testes file in post 41 and tried a run of excel solver on it's own. Problem is just the artificial imitation of excel solver max 200 constraint

    toomany.jpg

    So excel solver quits and this result is interpreted as zero value.

    Alf
    Last edited by Alf; 08-21-2022 at 03:06 PM.

  45. #45
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    in post #43, i reduced the number of cuts to 150 with
    Please Login or Register  to view this content.
    without checking of in every column there was at least 1 number, that's for later.
    So that number can be 200 ? And for OpenSolver, also 200 ?
    Last edited by bsalv; 08-21-2022 at 03:26 PM.

  46. #46
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    In the last file post 43 the numbers of combinations are 159 so solver as a stand alone has no problem solving it aside from time. But I have problem with the i so I had to define it as integer but the macro stops at line Set dict = CreateObject("scripting.dictionary")
    Saying it can't find project or library. Rather strange as I'm sure you have used it before and then it was no problem this macro.

    It seems to me now that OpenSolver is the best choice on account of the artificial set limit of 200 constraints or there must be a check of rows and if more than say 185 a recommendation could pop up.

    I'm really impressed with all the time and effort you have spent so far in solving this problem.

    Regards

    Alf
    Last edited by Alf; 08-21-2022 at 03:38 PM.

  47. #47
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    i think you have "option explicit" as first line in that module.
    It's now a couple of years, i don't use that anymore, and i'm satisfied to do so. So if necessary you can add those variables or delete option explicit
    You can add your changes if you want to, or if you want to change the layout, do it.
    It's a common project.
    Attached Files Attached Files

  48. #48
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    So that number can be 200 ? And for OpenSolver, also 200 ?
    Excel solver max 200 constraint so number of lines can be misgiving. For the OpenSolver "COIN-OR CBC" optimization engine for linear problems the information given is:

    No artificial limits on the size of problem you can solve, have as many variables and constraints as your computer memory allows (but be aware that large problems can be slow to solve)
    Will have a go at your last uploaded file later on, just now a small dog is eagerly waiting for her morning walk in the hope of seeing rabbits she may frighten!!

    Alf

  49. #49
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Back to excel after dog having chased two rabbits and seriously frighten 10 doves. The last upload works without any problems on my PC both with the excel solver linear engine and with the "COIN-OR CBC" OpenSolver linear engine.

    I think the cutoff on 200 lines make sense because the waste for line 200 is 570 and these high or higher waste numbers will probably never be used.

    In cell E74 there is a formula "=COUNTA(Wanted_Quantities)". This I assume is to count the number of cuts required. In an earlier upload there was a macro "Loop10" this I have not tested as you said it was only for excel 2021 - 365 and I only have excel 2019.

    Conclusion a most impressive building with all the bells and whistles one can wish for

    Thanks again for time spent and all your efforts to buil this model. Let's hope the OP also will appreciate it.

    Regards

    Alf
    Last edited by Alf; 08-22-2022 at 02:06 AM.

  50. #50
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    E74 is deleted, it had no use.
    Line 8, frequency of occurence is important, because if you ask a quantity in row 6 and Excel deleted all the cuts with that length because they all ended after the 200th combination, then there 'll be no solution. See column R now, but there is no problem because there is no actual length associated with that column.

    The macro to make all the combinations runs now for 30 seconds creating the first half within 5 seconds and the remaing in the last 5 seconds, perhaps that macro can use a speedup. (look at the statusbar at the bottom left while the macro is running. May be i do that one later, because now, i'm a little bit fed up with this topic
    Attached Files Attached Files

  51. #51
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    Amen to that! As this have been like a never ending story but thanks to your efforts has finally been brought to a happy end.

    Alf

  52. #52
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    then you find it, if you don't look anymore, a quicker method to make all the combinations
    Attached Files Attached Files
    Last edited by bsalv; 08-26-2022 at 06:10 PM.

  53. #53
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    a quicker method to make all the combinations
    Yes the speed of the last upload for finding all combinations is truly amazing. Now I'm going to spend quite a bit of time analyzing your "List All Combinations" macro to see how it works.

    Alf

  54. #54
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    @Alf, i added comments to the macro, so it'll bee easier for you to understand.
    While doing so, i also so a way to eliminate half of the useless permutations.
    Now, there are still 17.000 loops madein 2.4 sec to find only 270 matches, so progress is still possible ... .
    Attached Files Attached Files

  55. #55
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    the final solution for all possible permutations
    Attached Files Attached Files

  56. #56
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Optomize raw material

    You really amaze me. Another solution I almost start feeling bad taking so much of your time but as always I'm extremely grateful for all your efforts!!

    Regards

    Alf

  57. #57
    Registered User
    Join Date
    08-11-2022
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Optomize raw material

    The solver won't work for me, I get the following message. Is there something I need to add to excel?

    Screenshot 2022-08-30 160156.png

  58. #58
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Optomize raw material

    If you look in the references (Extra>References) of the VBA-editor, do you see "MISSING" items there ?
    Which solver did you select the Solver or the OpenSolver ?
    If you have choosen 1 of them, then you need that reference in Extra>References selected !
    Is that okay ?
    Attached Images Attached Images
    Last edited by bsalv; 08-31-2022 at 02:15 AM.

  59. #59
    Registered User
    Join Date
    02-23-2023
    Location
    uk
    MS-Off Ver
    365
    Posts
    9

    Re: Optomize raw material

    Hi there,
    I know there is been long time for this topic. But i am wondering about can we modify this VBA code for same raw size and using step by step approach. I mean obtaining min waste from first raw than select second raw and optain min waste, is possible? I dont want to see all combination. i want to go obtaining min waste for each raw. I want to create a plan to minimize waste from the first stock, then move on to the second stock to create a minimum waste plan for it. Continue this process for the third stock and so on. This way, the cuts that result in the most waste will be addressed last.

  60. #60
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,908

    Re: Optomize raw material

    Administrative Note:

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to INDEX(MATCH a material if it contains only that material
    By JulianS96 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 12-01-2021, 12:27 PM
  2. [SOLVED] Calculate Material Release - Bill of Material
    By mgoh in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-17-2021, 06:40 AM
  3. Replies: 4
    Last Post: 01-23-2014, 02:05 PM
  4. reading material
    By mark-gabb in forum Excel General
    Replies: 0
    Last Post: 05-23-2013, 01:40 AM
  5. [SOLVED] Separate 'Material' equal 'Material' different
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2012, 09:16 PM
  6. Material:help
    By SI in forum Excel General
    Replies: 1
    Last Post: 02-08-2006, 03:25 PM
  7. making one material list from mulitple vendor material lists
    By In the beginning in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-07-2005, 11:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1