问题
I'm using Alloy using its API as explained in Alloy - Generate .xml instance from .als.
I want to iterate over all solutions.
How to do this?
回答1:
In order to iterate over all the satisfiable solutions, you can simply loop over calls of the next() method on your A4Solution object, until the solution obtained is unsatisfiable (check with the satisfiable() method).
You will have something like :
A4Solution mySolution = TranslateAlloyToKodkod.execute_command(null, model.getAllReachableSigs(), cmd, new A4Options());
while(mySolution.satisfiable()){
mySolution=mySolution.next();
//...
}
来源:https://stackoverflow.com/questions/27227303/how-to-iterate-over-solutions-using-the-alloy-api