@syntest/search
Version:
The common core of the SynTest Framework
58 lines • 1.81 kB
TypeScript
import { Encoding } from "../Encoding";
import { SearchSubject } from "../SearchSubject";
/**
* Function that models the objective.
*
* @author Mitchell Olsthoorn
*/
export declare abstract class ObjectiveFunction<T extends Encoding> {
protected _id: string;
protected _subject: SearchSubject<T>;
protected _lowestDistance: number;
/**
* Indicates if the distance should be shallow or deep.
*
* Shallow distances only return 0 (covered) or 1 (uncovered).
* Deep distances return the actual distance.
*
* Shallow distances can be used to speed up the search process
* when an objective is already covered while still improving the solution.
*/
protected shallowDistance: boolean;
constructor(id: string, subject: SearchSubject<T>);
/**
* Return if the objective function is shallow (True) or deep (False).
*/
get shallow(): boolean;
/**
* Set the depth of the objective function.
*
* @param shallow True if the objective function is shallow, False otherwise.
*/
set shallow(shallow: boolean);
/**
* Calculate distance from the objective to an encoding.
*
* @param encoding Encoding
*/
abstract calculateDistance(encoding: T): number;
/**
* Return the identifier of the objective.
*/
getIdentifier(): string;
/**
* Return the subject of the objective.
*/
getSubject(): SearchSubject<T>;
/**
* Update the lowest distance with a new distance
* @param distance
*/
updateDistance(distance: number): void;
/**
* Gets the lowest distance to this objective function
* @returns the lowest distance encountered so far
*/
getLowestDistance(): number;
}
//# sourceMappingURL=ObjectiveFunction.d.ts.map