-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from LucasAlegre/morld
MORL/D
- Loading branch information
Showing
23 changed files
with
1,268 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,7 @@ wandb/ | |
|
||
# Pycharm | ||
.idea/ | ||
.DS_Store | ||
**/.DS_Store | ||
|
||
# Saved weights | ||
weights/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# MORL/D | ||
|
||
Multi-Objective Reinforcement Learning based on Decomposition. The idea of this framework is to decompose the multi-objective problem into a set of single-objective problems. The single-objective problems are then solved by a single-objective RL algorithm (or something close). There are multiple tricks which can be applied to improve the sample efficiency when compared to just sequentially solving each single-objective RL problem. | ||
|
||
See the paper [Multi-Objective Reinforcement Learning based on Decomposition](https://arxiv.org/abs/2311.12495) for more details. | ||
|
||
|
||
```{eval-rst} | ||
.. autoclass:: morl_baselines.multi_policy.morld.morld.MORLD | ||
:members: | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import mo_gymnasium as mo_gym | ||
import numpy as np | ||
import torch # noqa: F401 | ||
|
||
from morl_baselines.multi_policy.morld.morld import MORLD | ||
|
||
|
||
def main(): | ||
gamma = 0.99 | ||
|
||
env = mo_gym.make("mo-halfcheetah-v4") | ||
eval_env = mo_gym.make("mo-halfcheetah-v4") | ||
|
||
algo = MORLD( | ||
env=env, | ||
exchange_every=int(5e4), | ||
pop_size=6, | ||
policy_name="MOSAC", | ||
scalarization_method="ws", | ||
evaluation_mode="ser", | ||
gamma=gamma, | ||
log=False, | ||
neighborhood_size=1, | ||
update_passes=10, | ||
shared_buffer=True, | ||
sharing_mechanism=[], | ||
weight_adaptation_method="PSA", | ||
seed=0, | ||
) | ||
|
||
algo.train( | ||
eval_env=eval_env, | ||
total_timesteps=int(3e6) + 1, | ||
ref_point=np.array([-100.0, -100.0]), | ||
known_pareto_front=None, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import mo_gymnasium as mo_gym | ||
import numpy as np | ||
import torch # noqa: F401 | ||
|
||
from morl_baselines.multi_policy.morld.morld import MORLD | ||
|
||
|
||
def main(): | ||
gamma = 0.99 | ||
|
||
env = mo_gym.make("mo-hopper-v4") | ||
eval_env = mo_gym.make("mo-hopper-v4") | ||
|
||
algo = MORLD( | ||
env=env, | ||
exchange_every=int(5e4), | ||
pop_size=6, | ||
policy_name="MOSAC", | ||
scalarization_method="ws", | ||
evaluation_mode="ser", | ||
gamma=gamma, | ||
log=True, | ||
neighborhood_size=1, | ||
update_passes=10, | ||
shared_buffer=True, | ||
sharing_mechanism=[], | ||
weight_adaptation_method=None, | ||
seed=0, | ||
) | ||
|
||
algo.train( | ||
eval_env=eval_env, | ||
total_timesteps=int(8e6) + 1, | ||
ref_point=np.array([-100.0, -100.0, -100.0]), | ||
known_pareto_front=None, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.