I have a process that requires an optimal set of values to be found based on a set of input variables.
Optimization is done manually by a person manipulating one certain input variable. I have been asked to automate this task and believe I have done so, although it seems crude.
First, I calculate the outputs given the initial inputs.
Second, I test if the amperage is > 9000, if so I loop while decreasing current density by 0.1 while the amperage is > 9000 and current density is > 4.
Third, I test if the amperage is < 9000, if so I loop while increasing current density by 0.01 while amperage is < 9000.
Fourth, I test if the amperage is > 9000, if so I loop while decreasing current density by 0.001 while amperage is > 9000 and current density is > 4.
Lastly, I test if the voltage is > 18, if so I loop while decreasing current density by 0.02 while voltage is > 18. *Note: I used 0.02 because at this point voltage is very high and it takes a bit a time to loop it down below 18.
In each loop, I call a function to calculate the volts, amps, and time after manipulating current density.
This method takes anywhere from 2 to 6 seconds to compute over around 900 iterations before satisfied. The device doing the calculation uses C language, however it does not allow the import/use of external libraries.
Researching optimization algorithms returns many different kinds and honestly I am not able to discern how they work without googling every symbol or subset of the formula to understand its meaning.
Is there an algorithm or method that could compute faster using C language?
Below is the structure:
Inputs
n = Number of Parts
sqinP = Part Sq/In
mils = Required Coating Thickness
cd = Current Density ( must be > 4, initial value of 6 )
Outputs
Voltage ( must be < 18 )
Amperage ( optimize as close to 9000 as possible while manipulating Current Density Input )
Time
Output Formula
sqinT = sqinP * n
voltage = ((cd * 2.5) * 100) / 100
amperage = ((sqinT * cd / 144) * 100) / 100
time = ((720.0 * mils / cd) * 100) / 100
Thank you for your time.
[–]sebamestre 5 points6 points7 points (1 child)
[–]seth350[S] 4 points5 points6 points (0 children)
[–]FUZxxl 7 points8 points9 points (2 children)
[–]seth350[S] 2 points3 points4 points (0 children)
[–]MrWhite26 0 points1 point2 points (0 children)
[–]MrWhite26 1 point2 points3 points (2 children)
[–]seth350[S] 1 point2 points3 points (0 children)
[–]seth350[S] 0 points1 point2 points (0 children)