%option onerrorinpopulatebeliefforconsequence own
// with this option we tell zubr we will provide our own implementation of the method
// onErrorInPopulateBeliefForConsequence
Then in the definition section we provide its implementation:
// this is the implementation of the method we promised to provide:
protected void onErrorInPopulateBeliefForConsequence(Belief formerBelief, Action formerAction, VisibleState vs) {
JOptionPane.showMessageDialog(frame, "error in populate belief for consequence", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
As you can see the method takes following arguments:
- Belief
- Action
- VisibleState
If you download zubr (https://sourceforge.net/projects/perkun/) and process the file example16_on_error_in_populate_belief_for_consequence.zubr from the "examples" folder with it then you obtain the optimizer Java code:
zubr example16_on_error_in_populate_belief_for_consequence.zubr > MyOptimizer.java
This Java code can be compiled and executed. You can run it from my server:
http://www.pawelbiernacki.net/optimizerWithErrorHandling.jnlp
This program just allows you to input the alpha (twice) and then exits displaying our error message. Why? The problem is we did not provide any model, i.e. whatever happens will be unexpected for our optimizer. In the next example we will provide the model and things will become more interesting.
No comments:
Post a Comment