Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 807aa53
  • /
  • plot_benchmark_offline.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:f57838dbe3a96e0a0e5dede31dd7f419a0666d24
directory badge
swh:1:dir:807aa53e6b969289a57f1450acca35121f9a2220

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
plot_benchmark_offline.py
__author__ = 'yuwenhao'

import gym
import sys, os, time

import joblib
import numpy as np

import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import json

np.random.seed(1)

if __name__ == '__main__':
    # setup for walker walking
    plot_setup = [
        [['ppo_DartWalker3d-v1101_energy04_vel1_1s_mirror4_velrew3_ab4_anklesprint100_5_rotpen0_rew05xinit_stagedcurriculum4s75s34ratio'], 'ECL + MSL'],
        #[['ppo_DartWalker3d-v199_energy04_vel1_1s_mirrorreal4_velrew3_ab4_asinput_damping5_torque1x_anklesprint100_5_rotpen01_rew01xinit_1kassistance', 'ppo_curriculum_150eachit_vel1_runningavg3_e04_DartWalker3d-v1_99_0.8_0.6_2500'], 'Learner-Centered CL + MSL'],
        [['ppo_DartWalker3d-v195_energy04_vel1_1s_mirror0_ab4_velrew3_damping5_anklesprint100_5_rotpen0_rew01xinit_stagedcurriculum4s75s34ratio'], 'ECL'],
        [['ppo_DartWalker3d-v198_energy04_vel1_1s_mirrorreal4_velrew3_ab4_asinput_damping5_torque1x_anklesprint100_5_rotpen01_rew01xinit'], 'MSL'],
        [['ppo_DartWalker3d-v196_energy04_vel1_1s_mirror4_velrew3_ab4_asinput_damping5_torque1x_anklesprint100_5_rotpen01_rew01xinit'], 'PPO'],
        #[['ppo_DartWalker3d-v1107_energy01_vel1_1s_mirror0_velrew3_asinput_damping5_torque1x_anklesprint0_ab4_rotpen0_rew01xinit_nocurriculum_baseline'], 'PPO high torque']
    ]

    # setup for walker running
    '''plot_setup = [
        [['ppo_DartWalker3d-v1106_energy03_vel5_3s_mirror4_velrew3_damping5_anklesprint100_ab7_rotpen0_rew01xinit_stagedcurriculum4s75s12ratio_07rewthres'], 'ECL + MSL'],
        [['ppo_DartWalker3d-v194_energy03_vel5_3s_mirror0_velrew3_damping7_anklesprint100_5_rotpen0_rew01xinit_stagedcurriculum4s75s34ratio'], 'ECL'],
        [['ppo_DartWalker3d-v197_energy03_vel5_3s_mirror4_velrew3_asinput_damping5_ab7_torque1x_anklesprint100_5_rotpen01_rew01xinit'], 'MSL'],
        [['ppo_DartWalker3d-v1100_energy03_vel5_3s_mirror0_velrew3_asinput_damping5_ab7_torque1x_anklesprint100_5_rotpen01_rew01xinit'], 'PPO']
    ]'''

    # setup for humanoid walking
    '''plot_setup = [
        [['ppo_DartHumanWalker-v1377_energy03_vel15_15s_mirror4_velrew3_ab5_norotpen_dofpen11508_rew05xinit_thigh160_50springankle_stagedcurriculum_075reduce_07rewthres_2kassist'], 'ECL + MSL'],
        [['ppo_DartHumanWalker-v1379_energy03_vel15_15s_mirror0_velrew3_ab5_norotpen_dofpen11508_rew05xinit_thigh160_50springankle_stagedcurriculum_075reduce_07rewthres_2kassist'], 'ECL'],
        [['ppo_DartHumanWalker-v1384_energy03_vel15_1s_mirror4_velrew3_dofpenxyz11515_rew05xinit_ab6_thigh160waist150shoulder100_damping5_50springankle_nocurriculum_baseline'], 'MSL'],
        [['ppo_DartHumanWalker-v1385_energy03_vel15_1s_mirror0_velrew3_dofpenxyz11515_rew05xinit_ab6_thigh160waist150shoulder100_damping5_50springankle_nocurriculum_baseline'], 'PPO']
    ]'''

    # setup for humanoid running
    '''plot_setup = [
        [['ppo_DartHumanWalker-v1395_energy015_vel5_3s_mirror4_velrew3_dofpenxyz11508_rew05xinit_ab7_thigh160waist150shoulder100_damping5_50springankle_stagedcurriculum_075reduce_07rewthres_1p2termination_2kassist'], 'ECL + MSL'],
        [['ppo_DartHumanWalker-v1380_energy015_vel5_3s_mirror0_velrew4_dofpenxyz11508_rew05xinit_ab9_thigh160waist150shoulder100_damping5_50springankle_stagedcurriculum_075reduce_07rewthres_2kassist',
          'ppo_DartHumanWalker-v1380_energy015_vel5_3s_mirror0_velrew4_dofpenxyz11508_rew05xinit_ab9_thigh160waist150shoulder100_damping5_50springankle_stagedcurriculum_075reduce_07rewthres_2kassist_cont',
          'ppo_DartHumanWalker-v1380_energy015_vel5_3s_mirror0_velrew3_dofpenxyz11508_rew05xinit_ab9_thigh160waist150shoulder100_damping5_50springankle_stagedcurriculum_075reduce_07rewthres_1p2termination_2kassist_contcont'], 'ECL'],
        [['ppo_DartHumanWalker-v1382_energy15_vel5_3s_mirror4_up03fwd03ltl15_spinepen1yaw001_thighyawpen005_velrewavg4_2s_dcon1_damping2kneethigh_thigh160knee100waist150_shoulder100_dqpen0_anklespring50_velrew05xinit_ab9_baseline'], 'MSL'],
        [['ppo_DartHumanWalker-v1383_energy15_vel5_3s_mirror0_up03fwd03ltl15_spinepen1yaw001_thighyawpen005_velrewavg4_2s_dcon1_damping2kneethigh_thigh160knee100waist150_shoulder100_dqpen0_anklespring50_velrew05xinit_ab9_baseline'], 'PPO']
    ]'''



    all_data = []
    legend_names = []
    for i, one_trial in enumerate(plot_setup):
        legend_names.append(one_trial[1])
        trial_names = one_trial[0]
        one_data = []
        for i, name in enumerate(trial_names):
            filepath = 'data/' + name
            if os.path.exists(filepath):
                with open(filepath+'/progress.json') as data_file:
                    data = data_file.readlines()
                for line in data:
                    pline = json.loads(line.strip())
                    one_data.append(pline['EpRewMean'])
        all_data.append(one_data)

    colors = ['g','r','b','c','y']
    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1)

    for sp in range(len(all_data)):
        ax.plot(all_data[sp], colors[sp], linewidth=2, label=legend_names[sp])
    plt.legend()

    plt.title('Simp Biped walking', fontsize=14)

    plt.xlabel("Iteration", fontsize=14)
    plt.ylabel("Average Return", fontsize=14)

    for tick in ax.xaxis.get_major_ticks():
        tick.label.set_fontsize(13)
    for tick in ax.yaxis.get_major_ticks():
        tick.label.set_fontsize(13)

    plt.show()









back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API