How to use check_origin method in ATX

Best Python code snippet using ATX

rotated_shifted_functions_test.py

Source:rotated_shifted_functions_test.py Github

copy

Full Screen

1import numpy as np2from rotated_shifted_functions import *3from test_cases import BenchmarkTest, _load_shift_vector4# rotated shifted sphere5BenchmarkTest.check_origin(sphere,6 end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)7print("")8# rotated shifted cigar9BenchmarkTest.check_origin(cigar,10 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)11print("")12# rotated shifted discus13BenchmarkTest.check_origin(discus,14 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)15print("")16# rotated shifted cigar_discus17BenchmarkTest.check_origin(cigar_discus,18 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)19print("")20# rotated shifted ellipsoid21BenchmarkTest.check_origin(ellipsoid,22 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)23print("")24# rotated shifted different_powers25BenchmarkTest.check_origin(different_powers,26 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)27print("")28# rotated shifted parabolic_ridge29BenchmarkTest.check_origin(parabolic_ridge,30 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)31print("")32# rotated shifted sharp_ridge33BenchmarkTest.check_origin(sharp_ridge,34 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)35print("")36# rotated shifted schwefel1237BenchmarkTest.check_origin(schwefel12,38 end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)39print("")40# rotated shifted schwefel22141BenchmarkTest.check_origin(schwefel221,42 end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)43print("")44# rotated shifted rosenbrock45for i in [2, 10, 100, 1000]:46 x = np.zeros((i,)) - 147 generate_shift_vector(rosenbrock, x.size, -5, 5)48 generate_rotation_matrix(rosenbrock, i)49 print(rosenbrock(x + _load_shift_vector(rosenbrock, x)))50# 1.051# 9.052# 99.053# 999.054# rotated shifted griewank55BenchmarkTest.check_origin(griewank,56 end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)57print("")58# rotated shifted ackley59BenchmarkTest.check_origin(ackley,60 end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)61print("")62# rotated shifted rastrigin63BenchmarkTest.check_origin(rastrigin,64 end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)65print("")66# rotated shifted scaled_rastrigin67BenchmarkTest.check_origin(scaled_rastrigin,68 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)69print("")70# rotated shifted skew_rastrigin71BenchmarkTest.check_origin(skew_rastrigin,72 end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)73print("")74# rotated shifted schaffer75BenchmarkTest.check_origin(schaffer,76 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)77print("")78# rotated shifted bohachevsky79BenchmarkTest.check_origin(bohachevsky,80 start_from=2, end_with=1000, n_samples=10, is_shifted=True, is_rotated=True)...

Full Screen

Full Screen

rotated_functions_test.py

Source:rotated_functions_test.py Github

copy

Full Screen

1from rotated_functions import *2from test_cases import BenchmarkTest3# rotated sphere4BenchmarkTest.check_origin(sphere,5 end_with=1000, n_samples=10, is_rotated=True)6print("")7# rotated cigar8BenchmarkTest.check_origin(cigar,9 start_from=2, end_with=1000, n_samples=10, is_rotated=True)10print("")11# rotated discus12BenchmarkTest.check_origin(discus,13 start_from=2, end_with=1000, n_samples=10, is_rotated=True)14print("")15# rotated cigar_discus16BenchmarkTest.check_origin(cigar_discus,17 start_from=2, end_with=1000, n_samples=10, is_rotated=True)18print("")19# rotated ellipsoid20BenchmarkTest.check_origin(ellipsoid,21 start_from=2, end_with=1000, n_samples=10, is_rotated=True)22print("")23# rotated different_powers24BenchmarkTest.check_origin(different_powers,25 start_from=2, end_with=1000, n_samples=10, is_rotated=True)26print("")27# rotated different_powers_beyer28BenchmarkTest.check_origin(different_powers_beyer,29 start_from=2, end_with=1000, n_samples=10, is_rotated=True)30print("")31# rotated parabolic_ridge32BenchmarkTest.check_origin(parabolic_ridge,33 start_from=2, end_with=1000, n_samples=10, is_rotated=True)34print("")35# rotated sharp_ridge36BenchmarkTest.check_origin(sharp_ridge,37 start_from=2, end_with=1000, n_samples=10, is_rotated=True)38print("")39# rotated schwefel1240BenchmarkTest.check_origin(schwefel12,41 end_with=1000, n_samples=10, is_rotated=True)42print("")43# rotated schwefel22144BenchmarkTest.check_origin(schwefel221,45 end_with=1000, n_samples=10, is_rotated=True)46print("")47# rotated rosenbrock48for i in [2, 10, 100, 1000]:49 generate_rotation_matrix(rosenbrock, i)50 print(rosenbrock([0 for _ in range(i)]))51# 1.052# 9.053# 99.054# 999.055# rotated griewank56BenchmarkTest.check_origin(griewank,57 end_with=1000, n_samples=10, is_rotated=True)58print("")59# rotated ackley60BenchmarkTest.check_origin(ackley,61 end_with=1000, n_samples=10, is_rotated=True)62print("")63# rotated rastrigin64BenchmarkTest.check_origin(rastrigin,65 end_with=1000, n_samples=10, is_rotated=True)66print("")67# rotated scaled_rastrigin68BenchmarkTest.check_origin(scaled_rastrigin,69 start_from=2, end_with=1000, n_samples=10, is_rotated=True)70print("")71# rotated skew_rastrigin72BenchmarkTest.check_origin(skew_rastrigin,73 end_with=1000, n_samples=10, is_rotated=True)74print("")75# rotated schaffer76BenchmarkTest.check_origin(schaffer,77 start_from=2, end_with=1000, n_samples=10, is_rotated=True)78print("")79# rotated bohachevsky80BenchmarkTest.check_origin(bohachevsky,81 start_from=2, end_with=1000, n_samples=10, is_rotated=True)...

Full Screen

Full Screen

1868 파핑파핑 지뢰찾기.py

Source:1868 파핑파핑 지뢰찾기.py Github

copy

Full Screen

1# 0 인 지점 우선으로 찍어봐야한다2def find_zero_preprocess(N, origin, check_origin):3 start_point = []4 for i in range(N):5 for j in range(N):6 if origin[i][j]=='.':7 num_mine = check_8(i,j,N)8 if not num_mine:9 start_point.append((i,j))10 origin[i][j] = num_mine11 else:12 check_origin[i][j] = True13 return start_point14dr = [-1,-1,0,1,1,1,0,-1]15dc = [0,1,1,1,0,-1,-1,-1]16def check_8(r,c,N):17 mine = 018 for d in range(8):19 nr = r + dr[d]20 nc = c + dc[d]21 if not (0 <= nr < N and 0 <= nc < N): continue22 if origin[nr][nc] == '*':23 mine += 124 return mine25def expand(origin, check_origin, N, r, c):26 start=[(r,c)]27 check_origin[r][c] = True28 while start:29 next = []30 for r,c, in start:31 for d in range(8):32 nr = r + dr[d]33 nc = c + dc[d]34 if not (0 <= nr < N and 0 <= nc < N): continue35 if check_origin[nr][nc]: continue36 check_origin[nr][nc] = True37 value = origin[nr][nc]38 if value == 0:39 next.append((nr,nc))40 start = next41T = int(input())42for tc in range(1,1+T):43 N = int(input())44 origin = [list(input()) for _ in range(N)]45 check_origin = [[False]*N for _ in range(N)]46 start_point = find_zero_preprocess(N, origin, check_origin)47 ans = 048 for r,c, in start_point:49 if check_origin[r][c]:continue50 expand(origin, check_origin, N, r, c)51 ans += 152 for i in range(N):53 for j in range(N):54 if not check_origin[i][j]:55 ans += 1...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ATX automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful