<jupyter_start><jupyter_text>W tym eksperymencie testowałem prosty labirynt.<jupyter_code>%%time
random_state(f"rng_states/experiment{EXPERIMENT_ID}.npy")

S = [0.7] * 70
d = len(S)
x_min = -np.pi
x_max = np.pi
T = 1

rectangle_lists = [[
    ((-2, -2), (5, -1)), ((-3, -2), (-2, 8)), ((-3, 8), (6, 9)), ((5, -2), (6, 8)),
    ((-2, 3), (4, 4)), ((3, 4), (4, 7))
]]
targets = [(2, 5)]
objective = dynamic_inverse_kinematics_objectives(S, targets, rectangle_lists)
n_constraints = len(rectangle_lists[0])

n = 2000
alpha_inf = 0.9
n_immigrants = 0
eta_c = 3.
eta_m = 15.
p_c = 0.9
p_m = 0.03
num_iterations_init = 600
num_iterations = 160

population_hist, score_hist = dynamic_IDEA(objective, n_constraints, T, x_min, x_max, d, n, alpha_inf, eta_c, eta_m, p_c, p_m,
                           num_iterations=num_iterations, num_iterations_init=num_iterations_init, n_immigrants=n_immigrants, log_interval=20)
TRIAL_ID = 1
np.savez(f"/tmp/histories/experiment{EXPERIMENT_ID}_{TRIAL_ID}", populations=population_hist, scores=score_hist)
feasible_populations = []
for populations, scores in zip(population_hist, score_hist):
    mask = scores[-1][:, 1] == 0.
    feasible_population = populations[-1][mask, :]
    best = np.argsort(scores[-1, mask, 0])[:10]
    feasible_populations.append(feasible_population[best])
    
draw_dynamic_solutions(feasible_populations, S, targets, rectangle_lists, np.arange(T), 
                       nrows=1, ncols=1, figsize=(12, 12), xlim=(-5, 8), ylim=(-2, 10), squeeze=False)
infeasible_populations = []
for populations, scores in zip(population_hist, score_hist):
    mask = scores[-1][:, 1] == 0.
    infeasible_population = populations[-1][~mask, :]
    infeasible_populations.append(infeasible_population[::sum(~mask) // 10])
    
draw_dynamic_solutions(infeasible_populations, S, targets, rectangle_lists, np.arange(T), 
                       nrows=1, ncols=1, figsize=(12, 12), xlim=(-5, 8), ylim=(-2, 10), squeeze=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1635725037631711, 'fraction_numerical': 0.04616156547917712, 'mean_word_length': 4.554317548746518, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '467280', 'license': 'MIT', 'n_tokens_mistral': 859, 'n_tokens_neox': 772, 'n_words': 154, 'path': 'Experiment7.ipynb', 'repo_name': 'JaworWr/Dynamic-inverse-kinematics', 'size': '1993'}