Hi Teck Ping,
the SUL interface is specifically for reactive systems which translate to MealyMachines. However, you can just jump one level higher and directly provide a (DFA)MembershipOracle implementation or a SingleQueryOracle(DFA) implementation, if you want a simpler interface and don't care about parallelization, e.g.:
DFAMembershipOracle<I> mqOracle = new SingleQueryOracleDFA<I>() {
@Override
public Boolean answerQuery(Word<I> prefix, Word<I> suffix) {
// open connection
Connection c = new Connection(...);
// send over TCP
Result r = c.send(prefix.concat(suffix));
// interpret results
return r.isGood();
}
};
A few remarks:
* You could also handle the connection outside of the oracle and simply reset the lift in the beginning, which may be faster. The above is just a straight adaption from the SUL structure.
* The prefix, suffix split means that after transitioning the system under learning to the state reached by "prefix", only the "suffix" should determine the output. This is mostly relevant for MealyMembershipOracles, where the length of outputs matter. Since you only care about the single boolean result, it is fine here, to simply concat the two values and regard them as a single input sequence.
* You already did a good job, encoding the timing constraints into different symbols, since there is currently no concept of timed automata. I don't know to which extend your lift supports these timing information, but if it is a real-time system, you may have to fiddle around a little bit with Thread.sleep(), etc.
Kind regards,
Markus
On Sun, Jul 14, 2019 at 09:42:48PM -0700, Teck Ping Khoo wrote:
> Hi Markus
>
> Thanks for your reply. After some pondering, I realized that my use case is
> more specific - Allow me to explain:
>
> The SUL is actually that of a *bug*, not the entire lift controller. When
> the lift has just closed its doors, if the lift car floor button of the *same
> *floor is pressed within 1s, the door will open when the lift is moving
> (which is the bug). To explain further, it is normal for the lift door to
> open when the floor button (inside the lift) for the current floor is
> pressed, when the lift is not moving. However, when this same input is
> applied within 1s after the lift moves off, it becomes an abnormal
> behavior.
>
> The target model should therefore be a DFA which accepts strings that
> trigger the bug, and not a Mealy machine. Let the symbol "a" represent the
> floor 1 button pressed and the symbol "b" be the floor 2 button pressed.
> Let "a1" mean that "a" occurs after 0.5s, "a2" mean that "a" occurs after
> 1.0s, and so on, till "a10" (means "a" delayed for 5s). I can similarly
> define "b1" to "b10". This will make up an alphabet of 20 symbols "a1",
> "a2", ..."a10" and "b1", "b2", ... "b10". A string like a "b1", "a2", "b9"
> will trigger the bug. This means that we request the lift move to floor 2,
> en route we press floor 1, and within 1s when the lift door closes at floor
> 2 to move to floor 1, we press floor 2.
>
> I tried to find an example of using LearnLib to build a DFA using the
> "pre()","step()" and "post()" methods of the "TestSUL" interface but could
> not find any. Does "TestSUL" support the learning of a DFA? Does the output
> of "step()" only support feeding back the output of a Mealy Machine state,
> or does it also support feedback of the acceptance of a word by the target
> DFA?
>
> If "step()" works for learning a DFA, I only require the input of "step()"
> (as below) to be a Word, right?
>
>
> *public Boolean step(Input a_input) throws SULException*