<s> from __future__ import division , print_function , absolute_import <EOL> import numpy as np <EOL> from numpy import abs , sum , sin , cos , pi , exp , arange , prod , sqrt <EOL> from . go_benchmark import Benchmark <EOL> class XinSheYang01 ( Benchmark ) : <EOL> r"""<STR_LIT>""" <EOL> def __init__ ( self , dimensions = <NUM_LIT:2> ) : <EOL> Benchmark . __init__ ( self , dimensions ) <EOL> self . _bounds = zip ( [ - <NUM_LIT> ] * self . N , [ <NUM_LIT> ] * self . N ) <EOL> self . custom_bounds = ( [ - <NUM_LIT:2> , <NUM_LIT:2> ] , [ - <NUM_LIT:2> , <NUM_LIT:2> ] ) <EOL> self . global_optimum = [ [ <NUM_LIT:0> for _ in range ( self . N ) ] ] <EOL> self . fglob = <NUM_LIT:0.0> <EOL> self . change_dimensionality = True <EOL> def fun ( self , x , * args ) : <EOL> self . nfev += <NUM_LIT:1> <EOL> i = arange ( <NUM_LIT:1.0> , self . N + <NUM_LIT:1.0> ) <EOL> return sum ( np . random . random ( self . N ) * ( abs ( x ) ** i ) ) <EOL> class XinSheYang02 ( Benchmark ) : <EOL> r"""<STR_LIT>""" <EOL> def __init__ ( self , dimensions = <NUM_LIT:2> ) : <EOL> Benchmark . __init__ ( self , dimensions ) <EOL> self . _bounds = zip ( [ - <NUM_LIT:2> * pi ] * self . N , <EOL> [ <NUM_LIT:2> * pi ] * self . N ) <EOL> self . global_optimum = [ [ <NUM_LIT:0> for _ in range ( self . N ) ] ] <EOL> self . fglob = <NUM_LIT:0.0> <EOL> self . change_dimensionality = True <EOL> def fun ( self , x , * args ) : <EOL> self . nfev += <NUM_LIT:1> <EOL> return sum ( abs ( x ) ) * exp ( - sum ( sin ( x ** <NUM_LIT> ) ) ) <EOL> class XinSheYang03 ( Benchmark ) : <EOL> r"""<STR_LIT>""" <EOL> def __init__ ( self , dimensions = <NUM_LIT:2> ) : <EOL> Benchmark . __init__ ( self , dimensions ) <EOL> self . _bounds = zip ( [ - <NUM_LIT> ] * self . N , [ <NUM_LIT> ] * self . N ) <EOL> self . global_optimum = [ [ <NUM_LIT:0> for _ in range ( self . N ) ] ] <EOL> self . fglob = - <NUM_LIT:1.0> <EOL> self . change_dimensionality = True <EOL> def fun ( self , x , * args ) : <EOL> self . nfev += <NUM_LIT:1> <EOL> beta , m = <NUM_LIT> , <NUM_LIT> <EOL> u = sum ( ( x / beta ) ** ( <NUM_LIT:2> * m ) ) <EOL> v = sum ( x ** <NUM_LIT:2> ) <EOL> w = prod ( cos ( x ) ** <NUM_LIT:2> ) <EOL> return exp ( - u ) - <NUM_LIT:2> * exp ( - v ) * w <EOL> class XinSheYang04 ( Benchmark ) : <EOL> r"""<STR_LIT>""" <EOL> def __init__ ( self , dimensions = <NUM_LIT:2> ) : <EOL> Benchmark . __init__ ( self , dimensions ) <EOL> self . _bounds = zip ( [ - <NUM_LIT> ] * self . N , [ <NUM_LIT> ] * self . N ) <EOL> self . global_optimum = [ [ <NUM_LIT:0> for _ in range ( self . N ) ] ] <EOL> self . fglob = - <NUM_LIT:1.0> <EOL> self . change_dimensionality = True <EOL> def fun ( self , x , * args ) : <EOL> self . nfev += <NUM_LIT:1> <EOL> u = sum ( sin ( x ) ** <NUM_LIT:2> ) <EOL> v = sum ( x ** <NUM_LIT:2> ) <EOL> w = sum ( sin ( sqrt ( abs ( x ) ) ) ** <NUM_LIT:2> ) <EOL> return ( u - exp ( - v ) ) * exp ( - w ) <EOL> class Xor ( Benchmark ) : <EOL> r"""<STR_LIT>""" <EOL> def __init__ ( self , dimensions = <NUM_LIT:9> ) : <EOL> Benchmark . __init__ ( self , dimensions ) <EOL> self . _bounds = zip ( [ - <NUM_LIT:1.0> ] * self . N , [ <NUM_LIT:1.0> ] * self . N ) <EOL> self . global_optimum = [ [ <NUM_LIT:1.0> , - <NUM_LIT:1.0> , <NUM_LIT:1.0> , <EOL> - <NUM_LIT:1.0> , - <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT:1.0> , - <NUM_LIT:1.0> , <NUM_LIT> ] ] <EOL> self . fglob = <NUM_LIT> <EOL> def fun ( self , x , * args ) : <EOL> self . nfev += <NUM_LIT:1> <EOL> F11 = x [ <NUM_LIT:6> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:0> ] - x [ <NUM_LIT:1> ] - x [ <NUM_LIT:4> ] ) ) <EOL> F12 = x [ <NUM_LIT:7> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:2> ] - x [ <NUM_LIT:3> ] - x [ <NUM_LIT:5> ] ) ) <EOL> F1 = ( <NUM_LIT:1.0> + exp ( - F11 - F12 - x [ <NUM_LIT:8> ] ) ) ** ( - <NUM_LIT:2> ) <EOL> F21 = x [ <NUM_LIT:6> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:4> ] ) ) <EOL> F22 = x [ <NUM_LIT:7> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:5> ] ) ) <EOL> F2 = ( <NUM_LIT:1.0> + exp ( - F21 - F22 - x [ <NUM_LIT:8> ] ) ) ** ( - <NUM_LIT:2> ) <EOL> F31 = x [ <NUM_LIT:6> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:0> ] - x [ <NUM_LIT:4> ] ) ) <EOL> F32 = x [ <NUM_LIT:7> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:2> ] - x [ <NUM_LIT:5> ] ) ) <EOL> F3 = ( <NUM_LIT:1.0> - ( <NUM_LIT:1.0> + exp ( - F31 - F32 - x [ <NUM_LIT:8> ] ) ) ** ( - <NUM_LIT:1> ) ) ** <NUM_LIT:2> <EOL> F41 = x [ <NUM_LIT:6> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:1> ] - x [ <NUM_LIT:4> ] ) ) <EOL> F42 = x [ <NUM_LIT:7> ] / ( <NUM_LIT:1.0> + exp ( - x [ <NUM_LIT:3> ] - x [ <NUM_LIT:5> ] ) ) <EOL> F4 = ( <NUM_LIT:1.0> - ( <NUM_LIT:1.0> + exp ( - F41 - F42 - x [ <NUM_LIT:8> ] ) ) ** ( - <NUM_LIT:1> ) ) ** <NUM_LIT:2> <EOL> return F1 + F2 + F3 + F4 </s>
