================= Optimization Function B =========================== --------------------- DESCRIPTION ---------------------- This program tracks the number of execuation of certain function and counts the times it been execuated so it can be minimized or maximized later. Function: N-2 SIGMA i=1 {sin(xi * xi+1 + cos(xi-1 - xi))} N: defined as a global variable -------------------------------------------------------- ---------------- INPUT / OUTPUT ------------------------ --------------------- INPUT ------------------------ Reads from standrad in as follows: i1 i2 i3 vectorfileformat i1 i2 i3 vectorfileformat i1 i2 i3 vectorfileformat ... ... ... -------------------- OUTPUT ------------------------ ============= input: (0, 0, 0 vectorFileFormat) ===================== f(x0, x1, x2, x3 ) = #.# Duration of f = #.# seconds Df(x0, x1, x2, x3 ) = vectorFileFormat Duration of Df = #.# seconds DDf(x0, x1, x2, x3 ) = matrixFileFormat Duration of DDf = #.# seconds ============= input: (1, 1, 1 vectorFileFormat) ===================== f counter = # Df counter = # DDf counter = # ================================== . . . . . ================================== ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ EXAMPLE INPUT ++++++++++++ 0 0 0 3 1.2 3.4 4.5 1 1 1 3 5.2434 1.452345 6.23452 0 0 1 3 5.2434 6.23452 9.2435 0 1 0 3 1.452345 6.23452 9.2435 1 0 0 3 5.2434 1.452345 6.23452 1 1 1 3 5.2434 6.23452 9.2435 ++++++++++++++ EXAMPLE OUTPUT ++++++++++++ ================================= f(1.2 , 3.4 , 4.5 ) = 0.839555 Duration of f = 2.86102e-06 seconds Df(1.2 , 3.4 , 4.5 ) = 3 -0.439235 -2.0055 -1.84713 Duration of Df = 9.53674e-07 seconds DDf(1.2 , 3.4 , 4.5 ) = 3 3 -0.868507 -2.18599 -2.30784 -2.18599 -11.7605 -11.0806 -2.30784 -11.0806 -9.70526 Duration of DDf = 3.8147e-06 seconds ================================= ================================= f counter = 1 Df counter = 1 DDf counter = 1 ================================= ================================= f(5.2434 , 6.23452 , 9.2435 ) = 0.998372 Duration of f = 9.53674e-07 seconds Df(5.2434 , 6.23452 , 9.2435 ) = 3 -0.0477236 -0.479543 -0.355629 Duration of Df = 1.90735e-06 seconds DDf counter = 1 ================================= ================================= f(1.45235 , 6.23452 , 9.2435 ) = 0.912701 Duration of f = 0 seconds Df counter = 2 DDf(1.45235 , 6.23452 , 9.2435 ) = 3 3 -0.936756 9.35277 5.6764 9.35277 -95.752 -57.8656 5.6764 -57.8656 -35.476 Duration of DDf = 3.09944e-06 seconds ================================= ================================= f counter = 3 Df(5.2434 , 1.45235 , 6.23452 ) = 3 -0.237888 -2.21452 -0.571294 Duration of Df = 1.19209e-06 seconds DDf(5.2434 , 1.45235 , 6.23452 ) = 3 3 -0.649524 -2.8169 -0.807512 -2.8169 -29.4524 -7.91058 -0.807512 -7.91058 -1.93926 Duration of DDf = 2.86102e-06 seconds ================================= ================================= f counter = 3 Df counter = 3 DDf counter = 3 ================================= ++++++++++++++++++++++++++++++++++++++++++ =====================================================================