subroutine run_optimizer (hit_limit) use cesrv_struct use cesrv_interface use super_universe_com implicit none real(rp) merit0, a_lambda integer i, i_cyc logical, optional :: hit_limit logical finished, limited, at_limit ! call dmerit_calc ('reinit') call merit_calc(merit0) print *, 'Initial merit:', merit0 if (logic%engine == "FLETCHER-REEVES") then print *, ' Loop Merit Cycles_used Calls/Cycle' elseif (logic%engine == "LEVENBERG-MARQUARDT") then print *, ' Loop Merit A_lambda' endif logic%opt_running = .true. ! for minimal computations at_limit = .false. do i = 1, logic%opt_loops i_cyc = logic%opt_cycles logic%n_1dim_calls = 0 if (logic%engine == "FLETCHER-REEVES") then call fletcher_reeves(i, i_cyc, finished, super%u_(1)) call limit_calc (limited) call merit_calc(merit0) print '(i5, f14.3, 2i14)', i, merit0, i_cyc, logic%n_1dim_calls/i_cyc elseif (logic%engine == "LEVENBERG-MARQUARDT") then call marquardt(i, a_lambda, finished, super%u_(1), limited) call merit_calc(merit0) print '(i5, f14.3, 1pe10.2)', i, merit0, a_lambda else print *, 'ERROR: THIS ENGINE NOT YET IMPLIMENTED: ', logic%engine endif if (limited) at_limit = .true. if (finished) exit enddo logic%opt_running = .false. call merit_calc(merit0) if (present(hit_limit)) hit_limit = at_limit end subroutine