|
-
Aug 21st, 2008, 03:56 AM
#1
Thread Starter
Hyperactive Member
Algorithm Logic Help...
Hi, I need to make a class for calculating the most efficient use of lengths of steel, there may be many different lengths to cut the bars into and each length may have a different quantity.
The goal is to minimize the size of the offcuts and reduce the amount of lengths needed..
E.g :
Material = 50mm wide * 10mm thick @ 6000mm long
400pcs Cut @ 1092mm
400pcs Cut @ 910mm
I have created a class which can calculate the lengths required for a individual item but I am stumped at how to go about finding the most efficient use of lengths. The class I have created is the following...
Code:
Public Class Cut
Private dblLength As Double 'Length of material
Private dblCutLength As Double 'Length to cut at
Private intQTY As Integer 'Quantity to cut
Sub New(ByVal TotalLength As Double, ByVal CutLength As Double, ByVal QTY As Integer)
dblLength = TotalLength
dblCutLength = CutLength
intQTY = QTY
End Sub
Public Property Length() As Double
Get
Return dblLength
End Get
Set(ByVal value As Double)
dblLength = value
End Set
End Property
Public Property CutLength() As Double
Get
Return dblCutLength
End Get
Set(ByVal value As Double)
dblCutLength = value
End Set
End Property
Public Property QTY() As Integer
Get
Return intQTY
End Get
Set(ByVal value As Integer)
intQTY = value
End Set
End Property
''' <summary>
''' Calculates the total cuts of CutLength available in Length
''' </summary>
Public Function CutsPerLength() As Integer
Return Math.Floor(CInt(Length / CutLength))
End Function
''' <summary>
''' Calculates and returns the total offcut after the maximum cuts of CutLength have been made in Length
''' </summary>
Public Function OffCut() As Double
Return (((Length / CutLength) - Math.Floor(Length / CutLength)) * CutLength)
End Function
''' <summary>
''' Calculates and returns the total Lengths required to acheive the quantity desired
''' </summary>
Public Function LengthsRequired() As Integer
Return Math.Ceiling(QTY / CutsPerLength())
End Function
End Class
Now the next part is to create a class which will have a list of Cut and determine optimum number of each cut length which can be cut off a length to maximize steel efficiency, is some cases there may be several different lengths to cut off one bar, in other cases there may be only one length to cut the bar into, I also need a list of next best alternatives as in some cases the inconvenience of having to make too many seperate cuts will out weigh the benifits of saving some money on the cost of a few extra bars of steel...
Thanks in advance...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|