<s> '''<STR_LIT>''' <EOL> import setup_logger <EOL> import unittest <EOL> import numpy as np <EOL> from robo . task . synthetic_functions . branin import Branin <EOL> class TestTaskBranin ( unittest . TestCase ) : <EOL> def test_branin ( self ) : <EOL> branin = Branin ( ) <EOL> n_points = <NUM_LIT:10> <EOL> X = np . random . rand ( n_points , branin . n_dims ) <EOL> X [ : , <NUM_LIT:0> ] = X [ : , <NUM_LIT:0> ] . dot ( branin . X_upper [ <NUM_LIT:0> ] - branin . X_lower [ <NUM_LIT:0> ] ) + branin . X_lower [ <NUM_LIT:0> ] <EOL> X [ : , <NUM_LIT:1> ] = X [ : , <NUM_LIT:1> ] . dot ( branin . X_upper [ <NUM_LIT:1> ] - branin . X_lower [ <NUM_LIT:1> ] ) + branin . X_lower [ <NUM_LIT:1> ] <EOL> y = branin . evaluate ( X ) <EOL> assert len ( y . shape ) == <NUM_LIT:2> <EOL> assert y . shape [ <NUM_LIT:0> ] == n_points <EOL> assert y . shape [ <NUM_LIT:1> ] == <NUM_LIT:1> <EOL> X = np . array ( [ np . random . rand ( branin . n_dims ) ] ) <EOL> X [ : , <NUM_LIT:0> ] = X [ : , <NUM_LIT:0> ] . dot ( branin . X_upper [ <NUM_LIT:0> ] - branin . X_lower [ <NUM_LIT:0> ] ) + branin . X_lower [ <NUM_LIT:0> ] <EOL> X [ : , <NUM_LIT:1> ] = X [ : , <NUM_LIT:1> ] . dot ( branin . X_upper [ <NUM_LIT:1> ] - branin . X_lower [ <NUM_LIT:1> ] ) + branin . X_lower [ <NUM_LIT:1> ] <EOL> y = branin . evaluate ( X ) <EOL> assert y . shape [ <NUM_LIT:0> ] == <NUM_LIT:1> <EOL> X = branin . opt <EOL> y = branin . evaluate ( X ) <EOL> assert np . all ( np . round ( y , <NUM_LIT:6> ) == np . array ( [ branin . fopt ] ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
