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

Lambda Rewards #123

Open
AntoinePrv opened this issue Jan 28, 2021 · 0 comments
Open

Lambda Rewards #123

AntoinePrv opened this issue Jan 28, 2021 · 0 comments
Labels
new/reward 🌟 Ecole reward function

Comments

@AntoinePrv
Copy link
Member

AntoinePrv commented Jan 28, 2021

Describe the problem or improvement suggested

Many simple reward functions have the following pattern

class SomeReward {

    void before_reset(...) {
        metric = 0;
    }

    double extract(...) {
        auto new_value = SCIPsomething(...);
        auto diff = new_value - metric;
        metric = new_value;
        return diff;
    }

private:
    type metric = 0;
};

Which get redundant and could be automated.

Describe the solution you would like

A LambdaDiffReward function that automates the following, where the type of metric is computed from the return type of SCIPsomething.

Describe alternatives you have considered

Interestingly, when we have SomeReward, we can get back to SCIPsomething by using reward.cumsum().
In Numpy, there is also a np.diff that does the opposite of np.cumsum, i.e. compute the finite difference.

Perhaps, we could have a LambdaReward that does not compute differences and simply return the output

class LambdaReward {

    double extract(...) { return SCIPsomething(...); }

};

As well as a reward.diff() that build the difference.

Additional context

We should be consistent on whether reward functions compute finite differences or not.
Using .cumsum() .diff() we can easily switch from one to the other.

@AntoinePrv AntoinePrv added the type/enhancement 🚀 New feature or request label Jan 28, 2021
@AntoinePrv AntoinePrv added new/reward 🌟 Ecole reward function and removed type/enhancement 🚀 New feature or request labels Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new/reward 🌟 Ecole reward function
Projects
None yet
Development

No branches or pull requests

1 participant