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

Pass action masker as input to CollectObservations #3389

Merged
merged 4 commits into from
Feb 10, 2020

Conversation

vincentpierre
Copy link
Contributor

I am rather unsure about the doubling of the CollectObservation methods (and the copy pasta that comes along)
Need to edit the documentation and the migrating doc once we agree we want to do this

I am rather unsure about the doubling of the CollectObservation methods (and the copy pasta that comes along)
Need to edit the documentation and the migrating doc once we agree we want to do this
@vincentpierre vincentpierre self-assigned this Feb 7, 2020
@vincentpierre vincentpierre changed the title Sentencing Action masking the same as observations Pass action masker as input to CollectObservations Feb 7, 2020
/// to the action the agent will be unable to perform.
/// </summary>
/// <param name="actionIndices">The indices of the masked actions on branch 0</param>
protected void SetActionMask(IEnumerable<int> actionIndices)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be public, right? They were protected on the Agent, but now they need to be called from outside of the Agent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right

/// When using Discrete Control, you can prevent the Agent from using a certain
/// action by masking it. You can call the following method on the ActionMasker
/// input :
/// - <see cref="SetActionMask(int branch, IEnumerable<int> actionIndices)"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Links to other overloads?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chriselion
Copy link
Contributor

Seems reasonable. It makes sense to handle these together, since the observations might affect the possible actions. The name "CollectObservations" sounds less appropriate now, but I don't have a better suggest.

@@ -19,6 +19,43 @@ internal ActionMasker(BrainParameters brainParameters)
m_BrainParameters = brainParameters;
}

/// <summary>
/// Sets an action mask for discrete control agents. When used, the agent will not be
/// able to perform the action passed as argument at the next decision. If no branch is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this doc, can you just say that for this method the branch is assumed to be 0 instead of saying "if no branch is specified."


/// <summary>
/// Sets an action mask for discrete control agents. When used, the agent will not be
/// able to perform the action passed as argument at the next decision. If no branch is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, you cannot specify a branch, so just say it's assumed to be 0.

@surfnerd
Copy link
Contributor

surfnerd commented Feb 7, 2020

What's the motivation behind this PR? I'm a bit confused 🙃

@vincentpierre
Copy link
Contributor Author

What's the motivation behind this PR? I'm a bit confused 🙃

Trying to do the same thing as we did for the VectorSensor but with masked actions. This will make sure that the user will only be able to call SetActionMask when CollectObservations is called.
It also makes it simpler for us since we do no longer forward calls from the agent to the decision masker.

@vincentpierre vincentpierre merged commit cbc6a70 into master Feb 10, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-take-out-action-mask branch February 10, 2020 19:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants