Exemple #1
0
 /**
  * Given a Linear Temporal Logic (LTL) file, generate the corresponding MoML and update the MoML.
  *
  * <p>This is the main entry point for non-gui use of the g4ltl package. If finding a strategy
  * fails the gui may want to ask the user if they want to find a counter strategy.
  *
  * @param ltlFile The ltl file.
  * @param optionTechnique and integer where 0 means CoBeuchi, 1 means Beuchi
  * @param unrollSteps The number of unroll steps.
  * @param findStrategy True if a strategy should be found, false if a counter-strategy should be
  *     found. If a strategy cannot be found, then a counter-strategy is searched for.
  * @param context The context for the change. One way to get the context is by calling
  *     basicGraphFrame.getModel().
  * @return The name of the state machine that was created.
  * @exception Exception If thrown while synthesizing.
  */
 public static String generateMoML(
     File ltlFile, int optionTechnique, int unrollSteps, boolean findStrategy, NamedObj context)
     throws Exception {
   SolverUtility solver = new SolverUtility();
   ResultLTLSynthesis result =
       G4LTL.synthesizeFromFile(
           solver,
           ltlFile,
           optionTechnique,
           unrollSteps, /*SynthesisEngine.OUTPUT_FSM_ACTOR_PTOLEMY,*/
           findStrategy);
   if (findStrategy && result.getMessage1().startsWith("<") == false) {
     result =
         solver.synthesizeFromFile(
             ltlFile,
             optionTechnique,
             unrollSteps,
             SynthesisEngine.OUTPUT_FSM_ACTOR_PTOLEMY,
             false);
   }
   String name = updateModel(result.getMessage1(), context);
   return name;
 }
Exemple #2
0
 /**
  * Given a Linear Temporal Logic (LTL) file, generate the corresponding MoML.
  *
  * @param solver The G4LTL Solver to use.
  * @param ltlFile The ltl file.
  * @param optionTechnique and integer where 0 means CoBeuchi, 1 means Beuchi
  * @param unrollSteps The number of unroll steps.
  * @param findStrategy True if a strategy should be found, false if a counter-strategy should be
  *     found. Typically a strategy is found first and then if the result does not contain a
  *     "&lt;", this method is called with findStrategy set to false to find a counter-strategy.
  * @return The moml of a state machine that represents the LTL file.
  * @exception Exception If thrown while synthesizing.
  */
 public static ResultLTLSynthesis synthesizeFromFile(
     SolverUtility solver,
     File ltlFile,
     int optionTechnique,
     int unrollSteps,
     boolean findStrategy)
     throws Exception {
   // System.out.println("G4LTL.synthesizeFromFile(): " + ltlFile + " " + optionTechnique + " " +
   // unrollSteps + " " + findStrategy);
   ResultLTLSynthesis result =
       solver.synthesizeFromFile(
           ltlFile,
           optionTechnique,
           unrollSteps,
           SynthesisEngine.OUTPUT_FSM_ACTOR_PTOLEMY,
           findStrategy);
   return result;
 }