Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nesting Algorithm

Status
Not open for further replies.

stnkyminky

Programmer
Joined
Oct 15, 2001
Messages
476
Location
US
I need help developing or would like a reference for developing a nesting algorithm. As it was explained to me the algorithm would do the following:

1. The user would provide a length of material needed.
2. The algorithm would then search current inventory and determine what could be used.
Ex. I need a 10' piece of A. I dont have a 10' piece of A in inventory but I do have a 20' what could be cut in two.

The result would be a reference to the 20' or a 10' piece that could be used.

Thanks for your help Scott
Programmer Analyst
<><
 
Why not run a SQL query like:

SELECT MaterialID
WHERE MaterialType = '2x4'
AND UnitOfMeasureType = 'Feet'
AND Length > 10
ORDER BY Length

The first record of this result set will get you the first piece of material that is longer than 10'. This is obviously not an optimal solution (Is it better to select a piece that is an even multiple of the length desired? Is it better to open the next case when looking for 5 of an item? What if they ask for a 14' piece and the max length available is 12'?).

Chip H.
 
If your accessing a Database and you have say a table like this:
[tt]
Material_Table
WoodType
WoodLength
Quantity
[/tt]
Then you could make your SQL statement like this.
[tt]
SELECT * FROM Material_Table WHERE WoodType = '2X4' AND WoodLength >= 10 AND Quantity > 0 ORDER BY WoodLength
[/tt]
This would get all the available woods that are 2X4's that have a quantity greater than 0 and that have a length greater than or equal to the length you want. It will also sort them in order of length. Craig, mailto:sander@cogeco.ca

&quot;Procrastination is the art of keeping up with yesterday.&quot;

I hope my post was helpful!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top