Class SpecificationGeneticAlgorithm
- java.lang.Object
-
- geneticalgorithm.SpecificationGeneticAlgorithm
-
public class SpecificationGeneticAlgorithm extends Object
Main entry point of the AuRUS search: a genetic algorithm that evolves candidate repairs for an unrealisable assume-guarantee LTL specification.Given an input
TlsfspecificationS = (A, G), this class orchestrates the complete evolutionary loop:- Initial population — seeded from the original specification plus
variants obtained by adding patterned assumptions over the input
variables (e.g.
G F x,G !(x0 & ... & xn)) and by lightly mutating individual assumptions and guarantees (seecreateInitialPopulation(Tlsf)). - Fitness evaluation — each candidate is scored by
AutomataBasedModelCountingSpecificationFitness, which combines the realisability status (checked with Strix), the syntactic similarity, and the semantic similarity (estimated via bounded model counting over automaton transfer matrices) with respect to the original specification. - Evolution — selection, crossover and mutation are applied over
successive generations, with rates and budgets taken from
Settings(population size, crossover/mutation rates, maximum number of individuals, generations, and overall timeout). - Output — every candidate that reaches full realisability is
collected into
solutionsand reported, ranked by fitness, in TLSF format.
This class implements the approach introduced in: M. Brizzio, M. Cordy, M. Papadakis, C. Sánchez, N. Aguirre, R. Degiovanni. "Automated Repair of Unrealisable LTL Specifications Guided by Model Counting", GECCO 2023 (doi:10.1145/3583131.3590454). Please cite this paper if you build on the technique.
- Author:
- Matías Brizzio
- See Also:
SpecificationChromosome,AutomataBasedModelCountingSpecificationFitness,Settings
- Initial population — seeded from the original specification plus
variants obtained by adding patterned assumptions over the input
variables (e.g.
-
-
Field Summary
Fields Modifier and Type Field Description List<SpecificationChromosome>bestSolutionsBest candidates collected during the search when realisability is not checked inside the fitness (seeSettings.check_REALIZABILITYandSettings.check_STRONG_SAT).InstantfinalExecutionTimeTimestamp taken at the very end of the run, after solutions have been printed.InstantinitialExecutionTimeTimestamp taken when the run starts, before building the initial population.InstantsearchExecutionTimeTimestamp taken when the evolutionary search finishes (before the final realisability sweep).List<SpecificationChromosome>solutionsRealisable repairs found during the search, i.e.
-
Constructor Summary
Constructors Constructor Description SpecificationGeneticAlgorithm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringprint_config()Returns a one-line summary of the current genetic-algorithm configuration: generations, population size, individuals budget, mutation rate and crossover rate.Stringprint_execution_time()Returns a summary of the wall-clock time spent by the run: the search time (initial population until the end of the evolution) and the total time (until solutions were printed), both in seconds.voidrun(owl.ltl.tlsf.Tlsf spec)Runs the genetic search on the given specification using the fitness weights currently configured inSettings(equivalent to callingrun(Tlsf, double, double, double)with negative factors, which leaves the configured values untouched).voidrun(owl.ltl.tlsf.Tlsf spec, double status_factor, double syntactic_factor, double semantic_factor)Runs the complete genetic search on the given specification.voidrunRandom(owl.ltl.tlsf.Tlsf spec)Baseline used in the experimental evaluation (flag-random): instead of evolving the population, it generatesSettings.GA_POPULATION_SIZErandom mutants of the input specification and checks each one for realisability with Strix at the end.
-
-
-
Field Detail
-
initialExecutionTime
public Instant initialExecutionTime
Timestamp taken when the run starts, before building the initial population.
-
searchExecutionTime
public Instant searchExecutionTime
Timestamp taken when the evolutionary search finishes (before the final realisability sweep).
-
finalExecutionTime
public Instant finalExecutionTime
Timestamp taken at the very end of the run, after solutions have been printed.
-
solutions
public List<SpecificationChromosome> solutions
Realisable repairs found during the search, i.e. candidates whose status reachedSpecificationChromosome.SPEC_STATUS.REALIZABLE. Ordered by discovery; printed ranked by fitness at the end of the run.
-
bestSolutions
public List<SpecificationChromosome> bestSolutions
Best candidates collected during the search when realisability is not checked inside the fitness (seeSettings.check_REALIZABILITYandSettings.check_STRONG_SAT). These are verified with Strix in a final sweep and promoted tosolutionsif realisable.
-
-
Method Detail
-
run
public void run(owl.ltl.tlsf.Tlsf spec) throws IOException, InterruptedExceptionRuns the genetic search on the given specification using the fitness weights currently configured inSettings(equivalent to callingrun(Tlsf, double, double, double)with negative factors, which leaves the configured values untouched).- Parameters:
spec- the (typically unrealisable) input specification to repair- Throws:
IOException- if an external solver invocation failsInterruptedException- if an external solver call is interrupted
-
run
public void run(owl.ltl.tlsf.Tlsf spec, double status_factor, double syntactic_factor, double semantic_factor) throws IOException, InterruptedExceptionRuns the complete genetic search on the given specification.The three factors set the weights of the fitness components (realisability status, syntactic similarity, semantic similarity); they are forwarded to
Settings.setFactors(double, double, double)and should sum to 1. Passing a negative value keeps the currently configured weight for that component.The method aborts early (without searching) if the input specification is already realisable, or if it is inconsistent — the approach requires a consistent specification as input. On termination, all realisable repairs found are printed in TLSF format together with timing and configuration information.
- Parameters:
spec- the (typically unrealisable) input specification to repairstatus_factor- weight of the realisability-status component of the fitnesssyntactic_factor- weight of the syntactic-similarity component of the fitnesssemantic_factor- weight of the semantic-similarity (model counting) component of the fitness- Throws:
IOException- if an external solver invocation failsInterruptedException- if an external solver call is interrupted
-
runRandom
public void runRandom(owl.ltl.tlsf.Tlsf spec) throws IOException, InterruptedExceptionBaseline used in the experimental evaluation (flag-random): instead of evolving the population, it generatesSettings.GA_POPULATION_SIZErandom mutants of the input specification and checks each one for realisability with Strix at the end. No fitness guidance is used, so comparing this baseline againstrun(Tlsf)isolates the contribution of the guided search.- Parameters:
spec- the (typically unrealisable) input specification- Throws:
IOException- if an external solver invocation failsInterruptedException- if an external solver call is interrupted
-
print_config
public String print_config()
Returns a one-line summary of the current genetic-algorithm configuration: generations, population size, individuals budget, mutation rate and crossover rate.- Returns:
- a human-readable configuration string
-
print_execution_time
public String print_execution_time()
Returns a summary of the wall-clock time spent by the run: the search time (initial population until the end of the evolution) and the total time (until solutions were printed), both in seconds. Relies on the timestampsinitialExecutionTime,searchExecutionTimeandfinalExecutionTime.- Returns:
- a human-readable timing string
-
-