Set a Timeout for learning Duration of NL*

25 views
Skip to first unread message

John Huynh

unread,
Apr 17, 2020, 8:44:51 AM4/17/20
to LearnLib Q&A
Hello there,

I have used the NL* algorithm to learn a certain automaton which doesn't come to a result even after several hours. I am aware that this is caused by the implementation of my membership oracle.

I think the crucial part for taking so long is when the learner calls the method "refineHypothesis":

[...]

 while ((ce = eqOracle.findCounterExample(hyp, sigma)) != null) {
            System.out.println("Found counterexample " + ce);
            // Here the refining process takes a long time
            learner.refineHypothesis(ce);
            hyp = (CompactDFA<Integer>) learner.getHypothesisModel();
        }

[...]

What  I currently try to do is to set a timeout for a certain duration t after I started the learning process. So I want to stop the whole learning process after for example t=2h and furthermore, I would like to visualize the last conjecture that the learner proposed within that time t. 

I tried setting a timeout with "ExecutorService" and "Futures" but it seems like the "refineHypothesis" process/thread does not get killed after the time t even if I set so. 

Is there something else I can try? 


Kind regards,

John 



Markus Frohme

unread,
Apr 18, 2020, 8:46:09 AM4/18/20
to John Huynh, LearnLib Q&A
Hi John,


in general, this should be possible with the latest LearnLib version. Do you use parallel oracles that could somehow mess with the threading?

I hacked together a small example [0] which I believe does what you intend. Note that I used a DFA learner for easier construction of MQ/EQ oracles. Adapting this to your NFA case should be straight forward.

If you are sure that this is an issue with your membership oracle and not a problem with your refinement loop (i.e. it detects an infinite amount of states due to some faulty regular abstraction) you can also think about setting a timeout in your membership oracle and answering timed-out queries with, e.g., 'false'. This way, your learning process would finish with a complete hypothesis but the hypothesis expresses for every accepted word, e.g., "this word was accepted within 2 hours". On the other hand, you could no longer differentiate between rejected and timed-out words.


Kind regards,
Markus

[0] - https://gist.github.com/mtf90/ec6b73e8746f486a1b1809714479724b
> --
> You received this message because you are subscribed to the Google Groups "LearnLib Q&A" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to learnlib-qa...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/learnlib-qa/52fa859a-19a1-48a9-a79f-a561f4ca833d%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages