Know the rules The Paceline Forum Builder's Spotlight


Go Back   The Paceline Forum > General Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 12-12-2017, 03:53 PM
Mikej Mikej is offline
Senior Member
 
Join Date: Nov 2004
Posts: 3,949
OT: excel spreadsheet guru's -

So lets say I am trying add up already determined lengths of pipes that all need to equal up to the same length total.
Ex. I have a 21ft long room, and a stack of 10 pipes to choose from that are 10'11", 9'1", 13" and 18'1" 12' and 6'9". I need to fit a 12" pipe between any two of these other longer pipes to + or minus 3" and fit within the up to 21' 3" or as little as 20'9" long room. Is there a formula anybody could point me to?? This would happen with a heck off a lot of other pipes, too. Thanks if anybody can relate.

Last edited by Mikej; 12-12-2017 at 03:55 PM.
Reply With Quote
  #2  
Old 12-12-2017, 05:14 PM
yngpunk yngpunk is offline
Senior Member
 
Join Date: Oct 2009
Posts: 1,144
Quote:
Originally Posted by Mikej View Post
So lets say I am trying add up already determined lengths of pipes that all need to equal up to the same length total.
Ex. I have a 21ft long room, and a stack of 10 pipes to choose from that are 10'11", 9'1", 13" and 18'1" 12' and 6'9". I need to fit a 12" pipe between any two of these other longer pipes to + or minus 3" and fit within the up to 21' 3" or as little as 20'9" long room. Is there a formula anybody could point me to?? This would happen with a heck off a lot of other pipes, too. Thanks if anybody can relate.
Sounds like the "Solver" would work
Reply With Quote
  #3  
Old 12-12-2017, 05:20 PM
Chief's Avatar
Chief Chief is offline
Senior Member
 
Join Date: Dec 2003
Location: San Antonio, TX
Posts: 719
Let x and y be the lengths of two pipes such that
x+y+1=/<21.25 or equivalently x+y=/<20.25 and x+y=/>19.75. In the x-y plane the values of x and y satisfying these inequalities is defined by the trapezoidal area bounded by the two limiting right triangles defined by the = sign in the above inequalities. One can select a value for x and the inequalities yield the corresponding range of lengths y satisfying the inequalities; i.e.,
19.75-x=/<y=/<20.25-x

I hope that I haven't done someone's homework.
__________________
Chief

One does what one does best.

"Life is like a bicycle.
To Keep your balance you must keep moving."
A. Einstein, Feb. 5, 1930

Last edited by Chief; 12-13-2017 at 08:56 AM.
Reply With Quote
  #4  
Old 12-12-2017, 05:26 PM
Jaybee Jaybee is offline
Senior Member
 
Join Date: Mar 2015
Location: 303
Posts: 4,311
Solver is probably the way to go, though I don't have a ton of experience with it.

If not, you will be stuck with a long string of "SUM" and "IF" functions for every possible combination of pipe lengths. Probably long enough to bog down Excel, which doesn't seem to like more than 8-10 functions in a single formula.
Reply With Quote
  #5  
Old 12-12-2017, 05:49 PM
MattTuck's Avatar
MattTuck MattTuck is offline
Classics Fan
 
Join Date: May 2008
Location: Grantham, NH
Posts: 12,265
It sounds like this is a practical question, but I cannot think of a real life application of it. Can you give me more info on the situation?

Also, how many pipes do you have, and what are the lengths of all the pipes that you have? or will you not know them until later, and want to figure out how best to deal with each new batch.

I think you might be able to do it with solver.

Though, you could probably also do it as a linear optimization. Since you're probably trying to minimize waste.

Give us a bit more detail SOunds like a fun puzzle.
__________________
And we have just one world, But we live in different ones
Reply With Quote
  #6  
Old 12-12-2017, 06:15 PM
54ny77 54ny77 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 12,988
get the turbo encapsulator add-on for excel. then hit f9.
Reply With Quote
  #7  
Old 12-12-2017, 06:23 PM
MattTuck's Avatar
MattTuck MattTuck is offline
Classics Fan
 
Join Date: May 2008
Location: Grantham, NH
Posts: 12,265
The more I think about this, the less I think Excel is the right application to solve this, but I am waiting on more details.
__________________
And we have just one world, But we live in different ones
Reply With Quote
  #8  
Old 12-12-2017, 06:26 PM
Mikej Mikej is offline
Senior Member
 
Join Date: Nov 2004
Posts: 3,949
Quote:
Originally Posted by MattTuck View Post
The more I think about this, the less I think Excel is the right application to solve this, but I am waiting on more details.
It’s exactly as described - but 300 pipes of different lengths. Same room size.
Reply With Quote
  #9  
Old 12-12-2017, 06:45 PM
MattTuck's Avatar
MattTuck MattTuck is offline
Classics Fan
 
Join Date: May 2008
Location: Grantham, NH
Posts: 12,265
Are you trying to maximize the number of combinations that fall in the desired range?

What is the shortest and longest pipe in the mix? Or will you not know that ahead of time?

Is there replacement? (ie. is this a theoretical question of how many combinations can be formed with the given list of lengths) OR once a pipe has been used, it is no longer in the mix to be used again?

If there isn't replacement (ie. once a pipe is used, it is no longer available), is the goal to find the maximum number of combinations that add to the desired range, or are you just happy to find a bunch of combinations that work?

This number of possible combinations with 300 pipes seems very very high to me. Like, a huge number.... like bigger than a private bitcoin address.
__________________
And we have just one world, But we live in different ones
Reply With Quote
  #10  
Old 12-12-2017, 07:03 PM
Bob Ross's Avatar
Bob Ross Bob Ross is online now
Registered (ab)User
 
Join Date: Apr 2007
Location: Tucson AZ
Posts: 4,474
Quote:
Originally Posted by 54ny77 View Post
get the turbo encapsulator add-on for excel. then hit f9.
I have no idea what that sentence means -- or whether it is even a serious response, or just a sarcastic joke -- but I swear the next time anybody asks me a question I'm going to use that as my answer!
Reply With Quote
  #11  
Old 12-12-2017, 07:19 PM
tourmalet tourmalet is offline
Senior Member
 
Join Date: May 2016
Location: Massachusetts
Posts: 111
This is called the bin-packing problem (in one dimension), as it is analogous to the problem of packing full a bin of a given size with a subset of given packages of known size. It can be solved using the built-in Excel Solver.

There is ample information online on both the problem and how to implement it in Excel.
Reply With Quote
  #12  
Old 12-12-2017, 08:36 PM
ORMojo ORMojo is offline
Senior Member
 
Join Date: May 2010
Posts: 2,428
Quote:
Originally Posted by tourmalet View Post
This is called the bin-packing problem (in one dimension), as it is analogous to the problem of packing full a bin of a given size with a subset of given packages of known size. It can be solved using the built-in Excel Solver.

There is ample information online on both the problem and how to implement it in Excel.
Darn - from the moment I read the OP, this was my response, and then I scroll down the page to find it already offered!
Reply With Quote
  #13  
Old 12-12-2017, 10:19 PM
559Rando's Avatar
559Rando 559Rando is offline
Daniel
 
Join Date: Mar 2012
Location: Behind the Orange Curtain
Posts: 1,475
There are probably many ways to do this, but I'd make good use of the MOD function here and maybe build a recursive function to do the math on array of pipe lengths.
__________________
http://thebicyclewizards.com/

Last edited by 559Rando; 12-13-2017 at 07:29 AM. Reason: Autocorrect
Reply With Quote
  #14  
Old 12-12-2017, 10:25 PM
Louis Louis is online now
Boeuf Chaîne
 
Join Date: Dec 2003
Location: St. Louis MO
Posts: 25,463
Shouldn't be hard using the Excel Solver.

You can either create equations defining what you want in the spreadsheet and boil it all down to the value of a given cell, or you can insert some "Constraints" directly into the Solver and go from there. I'd probably use a mix of both, with the pipe lengths in the sheet and create equations there and constraints in the Solver.

Good Luck
Attached Images
File Type: jpg Snap33.jpg (39.5 KB, 136 views)
Reply With Quote
  #15  
Old 12-13-2017, 06:58 AM
Mikej Mikej is offline
Senior Member
 
Join Date: Nov 2004
Posts: 3,949
Thanks for the replies -
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:23 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.