UNPKG

@syntest/core

Version:

The common core of the SynTest Framework

89 lines 3.4 kB
import { Encoding } from "../Encoding"; import { Archive } from "../Archive"; import { SearchSubject } from "../SearchSubject"; import { ObjectiveManager } from "../objective/managers/ObjectiveManager"; import { BudgetManager } from "../budget/BudgetManager"; import { TerminationManager } from "../termination/TerminationManager"; import { SearchListener } from "../SearchListener"; import { EventManager } from "../../event/EventManager"; /** * Abstract search algorithm to search for an optimal solution within the search space. * * The search algorithm is dependent on the encoding of the search space. * * @author Mitchell Olsthoorn */ export declare abstract class SearchAlgorithm<T extends Encoding> { /** * Manager that passes event emisions to the eventlisteners. * @protected */ protected _eventManager: EventManager<T>; /** * Manager that keeps track of which objectives have been covered and are still to be searched. * @protected */ protected _objectiveManager: ObjectiveManager<T>; /** * List of search listeners. * * These listeners can be used to notify other services with updates about the search process. * @protected */ protected _listeners: SearchListener<T>[]; /** * Abstract constructor. * * @param eventManager The event manager * @param objectiveManager The objective manager * @protected */ protected constructor(eventManager: EventManager<T>, objectiveManager: ObjectiveManager<T>); /** * Initialization phase of the search process. * * @protected * @param budgetManager The budget manager to track budget progress * @param terminationManager The termination trigger manager */ protected abstract _initialize(budgetManager: BudgetManager<T>, terminationManager: TerminationManager): void; /** * Iteration phase of the search process. * * @protected * @param budgetManager The budget manager to track budget progress * @param terminationManager The termination trigger manager */ protected abstract _iterate(budgetManager: BudgetManager<T>, terminationManager: TerminationManager): void; /** * Search the search space for an optimal solution until one of the termination conditions are met. * * @param subject The subject of the search * @param budgetManager The budget manager to track budget progress * @param terminationManager The termination trigger manager */ search(subject: SearchSubject<T>, budgetManager: BudgetManager<T>, terminationManager: TerminationManager): Promise<Archive<T>>; /** * Return the objective manager. */ getObjectiveManager(): ObjectiveManager<T>; getCovered(objectiveType?: string): number; getUncovered(objectiveType?: string): number; /** * The progress of the search process. */ progress(objectiveType?: string): number; /** * Add a search listener to monitor the search process. * * @param listener The listener to add */ addListener(listener: SearchListener<T>): SearchAlgorithm<T>; /** * Remove a search listener from the search process. * * @param listener The listener to remove */ removeListener(listener: SearchListener<T>): SearchAlgorithm<T>; } //# sourceMappingURL=SearchAlgorithm.d.ts.map