def two_agents_without_interaction_common_playground_123(params): strt_pnt_A = '16' strt_pnt_B = '23' end_pnt_A = '23' end_pnt_B = '16' P = md.get_meshgrid_points(params) x, y, z = get_xyz(P) # Topology T, S = md.get_simple_topology_for_regular_grid(params, P) # rewards R_A = {end_pnt_A: 100} R_B = {end_pnt_B: 100} mdp_challenge_A = {'S': S, 'R': R_A, 'T': T, 'P': P} mdp_challenge_B = {'S': S, 'R': R_B, 'T': T, 'P': P} dict_mdp_A = md.start_mdp(params, mdp_challenge_A) dict_mdp_B = md.start_mdp(params, mdp_challenge_B) optimal_traj_A = md.get_deterministic_trajectory(strt_pnt_A, dict_mdp_A, steps=20) optimal_traj_B = md.get_deterministic_trajectory(strt_pnt_B, dict_mdp_B, steps=20) interpolated_points_A, points_A = md.get_result_trajectories_mdp( params, optimal_traj_A, P) interpolated_points_B, points_B = md.get_result_trajectories_mdp( params, optimal_traj_B, P) path_A = interpolated_points_A['quadratic'] path_B = interpolated_points_B['quadratic'] return path_A, path_B
def only_mdp(params): strt_pnt = '16' P = md.get_meshgrid_points(params) x, y, z = get_xyz(P) # Topology T, S = md.get_simple_topology_for_regular_grid(params, P) # rewards R = {'23': 100} mdp_challenge = {'S': S, 'R': R, 'T': T, 'P': P} dict_mdp = md.start_mdp(params, mdp_challenge) reach_set = md.reach_n_steps(strt_pnt, mdp_challenge, dict_mdp, params, steps=10) optimal_traj = md.get_deterministic_trajectory(strt_pnt, dict_mdp, steps=20) print_info(dict_mdp, optimal_traj) plot_topology(x, y, dict_mdp) plot_arrows_path(x, y, optimal_traj) scatter_value_function(x, y, np.array(dict_mdp['U']), dict_mdp, R) plt_show()
import manifold_plotter as mp import md_pro as md import matplotlib.pyplot as plt mygrid = { "x_grid": 5, "y_grid": 4, "x_min": -10, "x_max": 10, "y_min": -7.5, "y_max": 7.5 } # points P = md.get_meshgrid_points(**mygrid) # plot the nodes mp.plot_patches(P) plt.show()