Skip to content

Commit 5d1702f

Browse files
committed
setHeuristicFunctions() is only relevant for MIO
1 parent 29ba7e1 commit 5d1702f

File tree

9 files changed

+6
-30
lines changed

9 files changed

+6
-30
lines changed

whisker-main/src/whisker/search/SearchAlgorithm.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ export interface SearchAlgorithm<C extends Chromosome> {
6363
*/
6464
setFitnessFunctions(fitnessFunctions: Map<number, FitnessFunction<C>>): void;
6565

66-
/**
67-
* Sets the functions for calculating the heuristic values.
68-
* @param heuristicFunctions The functions for calculating the heuristic values in the range of [0, 1]
69-
* from the fitness values, where 0 is the worst value and 1 is the best value.
70-
*/
71-
setHeuristicFunctions(heuristicFunctions: Map<number, (number) => number>): void;
72-
7366
/**
7467
* Sets the selection operator used by the search algorithm.
7568
* @param selectionOperator the selection operator used by the algorithm

whisker-main/src/whisker/search/SearchAlgorithmBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export class SearchAlgorithmBuilder<C extends Chromosome> {
266266
* A helper method that builds the 'MIO' search algorithm with all necessary properties.
267267
*/
268268
private _buildMIO(): SearchAlgorithm<C> {
269-
const searchAlgorithm: SearchAlgorithm<C> = new MIO();
269+
const searchAlgorithm = new MIO<C>();
270270
searchAlgorithm.setFitnessFunctions(this._fitnessFunctions);
271271
searchAlgorithm.setHeuristicFunctions(this._heuristicFunctions);
272272
searchAlgorithm.setLocalSearchOperators(this._localSearchOperators);

whisker-main/src/whisker/search/algorithms/MIO.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ export class MIO<C extends Chromosome> extends SearchAlgorithmDefault<C> {
166166
StatisticsCollector.getInstance().fitnessFunctionCount = fitnessFunctions.size;
167167
}
168168

169+
/**
170+
* Sets the functions for calculating the heuristic values.
171+
* @param heuristicFunctions The functions for calculating the heuristic values in the range of [0, 1]
172+
* from the fitness values, where 0 is the worst value and 1 is the best value.
173+
*/
169174
setHeuristicFunctions(heuristicFunctions: Map<number, (number) => number>): void {
170175
this._heuristicFunctions = heuristicFunctions;
171176
}

whisker-main/src/whisker/search/algorithms/MOSA.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,4 @@ export class MOSA<C extends Chromosome> extends SearchAlgorithmDefault<C> {
424424
setFitnessFunction(fitnessFunction: FitnessFunction<C>): void {
425425
throw new Error('Method not implemented.');
426426
}
427-
428-
setHeuristicFunctions(heuristicFunctions: Map<number, (number: any) => number>): void {
429-
throw new Error('Method not implemented.');
430-
}
431427
}

whisker-main/src/whisker/search/algorithms/NEAT.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ export class NEAT extends SearchAlgorithmDefault<NeatChromosome> {
196196
throw new Error('Method not implemented.');
197197
}
198198

199-
setHeuristicFunctions(heuristicFunctions: Map<number, (number: any) => number>): void {
200-
throw new Error('Method not implemented.');
201-
}
202-
203199
setSelectionOperator(selectionOperator: Selection<NeatChromosome>): void {
204200
throw new Error('Method not implemented.');
205201
}

whisker-main/src/whisker/search/algorithms/OnePlusOneEA.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,6 @@ ${bestIndividual.toString()}`);
140140
return this._startTime;
141141
}
142142

143-
setHeuristicFunctions(heuristicFunctions: Map<number, (number: any) => number>): void {
144-
throw new Error('Method not implemented.');
145-
}
146-
147143
setSelectionOperator(selectionOperator: Selection<C>): void {
148144
throw new Error('Method not implemented.');
149145
}

whisker-main/src/whisker/search/algorithms/RandomSearch.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ export class RandomSearch<C extends Chromosome> extends SearchAlgorithmDefault<C
120120
return this._startTime;
121121
}
122122

123-
setHeuristicFunctions(heuristicFunctions: Map<number, (number: any) => number>): void {
124-
throw new Error('Method not implemented.');
125-
}
126-
127123
setSelectionOperator(selectionOperator: Selection<C>): void {
128124
throw new Error('Method not implemented.');
129125
}

whisker-main/src/whisker/search/algorithms/SearchAlgorithmDefault.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ export abstract class SearchAlgorithmDefault<C extends Chromosome> implements Se
9898

9999
abstract setFitnessFunctions(fitnessFunctions: Map<number, FitnessFunction<C>>): void;
100100

101-
abstract setHeuristicFunctions(heuristicFunctions: Map<number, (number) => number>): void;
102-
103101
abstract setSelectionOperator(selectionOperator: Selection<C>): void;
104102

105103
abstract setLocalSearchOperators(localSearchOperators: LocalSearch<C>[]): void;

whisker-main/src/whisker/search/algorithms/SimpleGA.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,6 @@ export class SimpleGA<C extends Chromosome> extends SearchAlgorithmDefault<C> {
229229
return this._startTime;
230230
}
231231

232-
setHeuristicFunctions(heuristicFunctions: Map<number, (number: any) => number>): void {
233-
throw new Error('Method not implemented.');
234-
}
235-
236232
setLocalSearchOperators(localSearchOperators: LocalSearch<C>[]): void {
237233
throw new Error('Method not implemented.');
238234
}

0 commit comments

Comments
 (0)