Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How exactly should target_cost be set? #12

Open
hanhanlixianji opened this issue Dec 12, 2024 · 1 comment
Open

How exactly should target_cost be set? #12

hanhanlixianji opened this issue Dec 12, 2024 · 1 comment

Comments

@hanhanlixianji
Copy link

In the README, you mentioned:
"Set target cost by using env.set_target_cost(target_cost) function, where target_cost is the undiscounted sum of costs of an episode."
Here, target_cost is the "undiscounted sum of costs of an episode."

Then you also said:
"You can use the env.get_normalized_score(return, cost_return) function to compute a normalized reward and cost for an episode, where returns and cost_returns are the undiscounted sum of rewards and costs respectively of an episode."
Here, cost_returns is also the "undiscounted sum of costs of an episode."

However, I found in the source code dsrl.offline_env.py at line 185:

normalized_cost = (cost + self.epsilon) / (self.target_cost + self.epsilon)

Here, cost is cost_return, and according to your description in the README, the result of this should be 1. However, this is clearly not correct.

@hanhanlixianji
Copy link
Author

In the README, you mentioned: "Set target cost by using env.set_target_cost(target_cost) function, where target_cost is the undiscounted sum of costs of an episode." Here, target_cost is the "undiscounted sum of costs of an episode."

Then you also said: "You can use the env.get_normalized_score(return, cost_return) function to compute a normalized reward and cost for an episode, where returns and cost_returns are the undiscounted sum of rewards and costs respectively of an episode." Here, cost_returns is also the "undiscounted sum of costs of an episode."

However, I found in the source code dsrl.offline_env.py at line 185:

normalized_cost = (cost + self.epsilon) / (self.target_cost + self.epsilon)

Here, cost is cost_return, and according to your description in the README, the result of this should be 1. However, this is clearly not correct.

Also, could you please explain the detailed calculation process of the normalized cost? Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant