Extending the interface
I have uploaded a code with a function that starts like this:
public class MDP<S, A extends Action> implements MarkovDecisionProcess<S, A> {
//some code...blah blah blah...
}
S
and A
should be kind type
. Action
- interface
.
In my code, I want to use this class MDP
. Therefore, I needed to define S
and A
; I defined S
as a specific class, but I don't know how to define A
... it is not a class and it is not an interface. What should it be?
Thank:)
source to share
For your code
public class MDP<S, A extends Action> implements MarkovDecisionProcess<S, A> {
//some code...blah blah blah...
}
S
and A
are types. They can refer to an interface or a class. The lettering is arbitrary. They can be any letter. This is true.
public class MDP<Q, Z extends Action> implements MarkovDecisionProcess<Q, Z> {
//some code...blah blah blah...
}
All he says is, "A class MDP
is a parameterized class that has parameters S
and A
, where A
is some subclass Action
, and it implements the interface MarkovDecisionProcess<S,A>
. S
And A
may or may not be of the same type."
When you specify type parameters for a class, you can narrow down the specification of that type. In this case, it S
remains the same (in terms of specificity), but you reduce the second parameter to some instance Action
.
It is possible to have these types in an interface declaration. They can then be left on the copy.
public interface MarkovDecisionProcess<S,V extends Action>{}
public class MDP implements MarkovDecisionProcess{}
You may need to read some of the white papers.
source to share
In relation to the MDP documentation, "Action" is an interface:
public interface Action
Describes an Action that can or has been taken by an Agent via one of its Actuators.
Take a look at the documentation: http://aima-java.github.io/aima-java/aima3e/javadoc/aima-core/aima/core/probability/mdp/impl/MDP.html
source to share