#*****************************************************************************80 # ## sa_test tests sa. # # Licensing: # # Copyright 2016 James P. Howard, II # # The computer code and data files on this web page are distributed under # https://opensource.org/licenses/BSD-2-Clause, the BSD-2-Clause license. # # Modified: # # 18 March 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "sa_test\n" ) cat ( " ", version$version.string, "\n" ) cat ( " sa seeks the minimum of a function using simulated annealing.\n" ) cat ( "\n" ) source ( "/home/burkardt/public_html/r_src/sa/sa.R" ) f <- function ( x ) { value = x^6 - 4.0 * x^5 - 7.0 * x^4 + 22.0 * x^3 + 24.0 * x^2 + 2 return ( value ) } x <- c ( 0.0 ) x <- sa ( f, x ) cat ( " sa(polynomial, 0) = ", x, " f(x) = ", f(x), "\n" ) x <- c ( 0.0 ) x <- sa ( f, x ) cat ( " sa(polynomial, 0) = ", x, " f(x) = ", f(x), "\n" ) # # Terminate. # cat ( "\n" ) cat ( "sa_test\n" ) cat ( " Normal end of execution.\n" ) cat ( date ( ), "\n" ) quit ( )