Package eu.iv4xr.framework.mainConcepts
Class TestGoal
java.lang.Object
nl.uu.cs.aplib.mainConcepts.Goal
eu.iv4xr.framework.mainConcepts.TestGoal
A TestGoal is a Goal, but you can additionally specify a test oracle. When a
TestGoal receives a proposal from a test-agent (through the method
propose_(Object)
), and if this proposal is judged as solving the
goal, the method propose_(Object)
will automatically pass the
proposal to be inspected by the test-oracle.
A test-oracle expresses a test on the correctness of the proposal (not to be confused with the goal-predicate itself). E.g. the goal may only require that a certain object becomes accessible to the agent, whereas the oracle would test whether this object has the correct properties. A test-oracle is essentially a function f that will inspect a given proposal-object and returns a verdict.
- Author:
- Wish
-
Field Summary
Modifier and TypeFieldDescription(package private) Function<Object,ObservationEvent.VerdictEvent>
(package private) TestAgent
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<Proposal> TestGoal
Set the given function as a goal function.<Proposal> TestGoal
invariant(TestAgent testagent, Function<Proposal,ObservationEvent.VerdictEvent> oracle)
Just another name fororacle(TestAgent,Function)
.<Proposal> TestGoal
invariant(Function<Proposal,ObservationEvent.VerdictEvent> oracle)
Just another name fororacle(TestAgent,Function)
.<Proposal> TestGoal
oracle(TestAgent testagent, Function<Proposal,ObservationEvent.VerdictEvent> oracle)
Specify the test-oracle associated with for this TestGoal.<Proposal> TestGoal
oracle(Function<Proposal,ObservationEvent.VerdictEvent> oracle)
Specify the test-oracle associated with for this TestGoal.oracle_(TestAgent testagent, Function<Object,ObservationEvent.VerdictEvent> oracle)
Specify the test-oracle associated with for this TestGoal.protected void
We overrideGoal.propose_(Object)
so that it now automatically check the oracle when the given proposal solves this Goal.<Proposal> TestGoal
Set the predicate which would serve as the predicate to solve.withEpsilon(Double e)
Set the value of eplison.withTactic(Tactic S)
Set the strategy to that a solving agent can use to solve this goal.
-
Field Details
-
owningTestAgent
TestAgent owningTestAgent -
oracle
Function<Object,ObservationEvent.VerdictEvent> oracle
-
-
Constructor Details
-
TestGoal
Create a blank test-goal with the specified name. -
TestGoal
Create a blank test-goal with the specified name, and link this goal to the given test agent.
-
-
Method Details
-
oracle_
public TestGoal oracle_(TestAgent testagent, Function<Object,ObservationEvent.VerdictEvent> oracle)Specify the test-oracle associated with for this TestGoal. Note that every TestGoal must have an oracle.- Parameters:
testagent
- The test-agent to which this TestGoal will be associated to (the one that will work on this goal).oracle
- The oracle predicate/function.
-
invariant
public <Proposal> TestGoal invariant(TestAgent testagent, Function<Proposal,ObservationEvent.VerdictEvent> oracle)Just another name fororacle(TestAgent,Function)
. It is used to specify the test-oracle associated with for this TestGoal. Note that every TestGoal must have an oracle. This method will also link this teat-goal to the given test-agent. -
invariant
Just another name fororacle(TestAgent,Function)
. It is used to specify the test-oracle associated with for this TestGoal. Note that every TestGoal must have an oracle. This method assumes that this test-goal has been linked to some test-agent. -
oracle
public <Proposal> TestGoal oracle(TestAgent testagent, Function<Proposal,ObservationEvent.VerdictEvent> oracle)Specify the test-oracle associated with for this TestGoal. Note that every TestGoal must have an oracle. This method will also link this teat-goal to the given test-agent.- Parameters:
testagent
- The test-agent to which this TestGoal will be associated to (the one that will work on this goal).oracle
- The oracle predicate/function.
-
oracle
Specify the test-oracle associated with for this TestGoal. Note that every TestGoal must have an oracle. Also note that a test-goal must be linked to a test-agent. This method assumes that this test-goal has been linked to one.- Parameters:
oracle
- The oracle predicate/function.
-
propose_
We overrideGoal.propose_(Object)
so that it now automatically check the oracle when the given proposal solves this Goal. -
ftoSolve
Set the given function as a goal function. A proposal o is a solution if abs(goalfunction(o)) is a value less than epsilon (default is 0.005). The more general typing of the method's signature is for convenience, to allow you to explicitly specify the type of the goal's proposals domain at the point where this method is called, e.g. as in:Goal g = new Goal().ftoSolve((Integer x) -> x - 9999);
The method returns this Goal itself so that it can be used in the Fluent Interface style. -
toSolve
Set the predicate which would serve as the predicate to solve. The more general typing of the method's signature is for convenience, to allow you to explicitly specify the type of the goal's proposals domain at the point where this method is called, e.g. as in:Goal g = new Goal().toSolve((Integer x) -> x == 9999);
The method returns this Goal itself so that it can be used in the Fluent Interface style. -
withEpsilon
Set the value of eplison. The method returns this Goal itself so that it can be used in the Fluent Interface style.- Overrides:
withEpsilon
in classGoal
-
withTactic
Set the strategy to that a solving agent can use to solve this goal. The method returns this Goal itself so that it can be used in the Fluent Interface style.- Overrides:
withTactic
in classGoal
-