【问题标题】:How to iterate over solutions using the Alloy API?如何使用 Alloy API 迭代解决方案?
【发布时间】:2014-12-01 11:21:10
【问题描述】:

Alloy - Generate .xml instance from .als 中所述,我正在使用Alloy 的API。

我想遍历所有解决方案。

如何做到这一点?

【问题讨论】:

    标签: alloy


    【解决方案1】:

    为了遍历所有可满足的解决方案,您可以简单地循环调用 A4Solution 对象上的 next() 方法,直到获得的解决方案无法满足(使用 satisfiable() 方法检查)。

    你会得到类似的东西:

    A4Solution mySolution = TranslateAlloyToKodkod.execute_command(null, model.getAllReachableSigs(), cmd, new A4Options());
    
    while(mySolution.satisfiable()){
        mySolution=mySolution.next();
        //...
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-22
      • 1970-01-01
      • 2016-03-19
      • 2020-06-07
      • 2019-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多