@syntest/search
Version:
The common core of the SynTest Framework
88 lines • 2.84 kB
TypeScript
import { Logger } from "@syntest/logging";
import { Encoding } from "./Encoding";
import { ObjectiveFunction } from "./objective/ObjectiveFunction";
/**
* Archive that keeps track of the fittest encodings for each covered objective.
*
* @author Mitchell Olsthoorn
*/
export declare class Archive<T extends Encoding> {
protected static LOGGER: Logger;
/**
* Mapping of covered objectives to the corresponding fittest encoding.
*
* @protected
*/
protected _map: Map<ObjectiveFunction<T>, T>;
/**
* Mapping of unique encodings contained within the archive to the objectives
* that they were selected for.
*
* @protected
*/
protected _uses: Map<T, ObjectiveFunction<T>[]>;
constructor();
/**
* The size of the archive.
*
* Measured by the number of unique encodings contained in the archive.
*/
get size(): number;
/**
* Determines if the archive already contains this objective function.
*
* @param objectiveFunction The objective function to check for
*/
hasObjective(objectiveFunction: ObjectiveFunction<T>): boolean;
/**
* Determines if the archive already contains this encoding.
*
* @param encoding The encoding to check for
*/
hasEncoding(encoding: T): boolean;
/**
* Updates the archive with a new encoding.
*
* This function will overwrite the current encoding for the specified objective function.
*
* @param objectiveFunction The objective to update
* @param encoding The new encoding
* @param keepOld Whether to keep the old encoding in the archive
*/
update(objectiveFunction: ObjectiveFunction<T>, encoding: T, keepOld: boolean): void;
/**
* Merges the given archive into this archive.
*
* When there is overlap in the archives the current one will be overriden.
* WARNING: this function does thus not use the secondary objectives to select the optimal solution.
* TODO use the secondary objectives in this function
*
* @param other the other archive
*/
merge(other: Archive<T>): void;
/**
* Clears the archive.
*/
clear(): void;
/**
* Return the objective functions associated with the stored encodings.
*/
getObjectives(): ObjectiveFunction<T>[];
/**
* Return the encodings.
*/
getEncodings(): T[];
/**
* Return the encoding corresponding with the objective function.
*
* @param objective The objective to use.
*/
getEncoding(objective: ObjectiveFunction<T>): T;
/**
* Return the uses of the encoding across the objective functions.
*
* @param encoding The encoding to look for.
*/
getUses(encoding: T): ObjectiveFunction<T>[];
}
//# sourceMappingURL=Archive.d.ts.map