Add enum for Selection method
This commit is contained in:
@@ -203,7 +203,7 @@ public class GeneticService : IGeneticService
|
||||
int populationSize,
|
||||
int generations,
|
||||
double mutationRate,
|
||||
string selectionMethod,
|
||||
GeneticSelectionMethod selectionMethod,
|
||||
int elitismPercentage,
|
||||
double maxTakeProfit,
|
||||
List<IndicatorType> eligibleIndicators)
|
||||
@@ -422,13 +422,13 @@ public class GeneticService : IGeneticService
|
||||
}
|
||||
}
|
||||
|
||||
private ISelection GetSelection(string selectionMethod)
|
||||
private ISelection GetSelection(GeneticSelectionMethod selectionMethod)
|
||||
{
|
||||
return selectionMethod.ToLower() switch
|
||||
return selectionMethod switch
|
||||
{
|
||||
"tournament" => new TournamentSelection(),
|
||||
"roulette" => new RouletteWheelSelection(),
|
||||
"fitness-weighted" => new RankSelection(), // Use rank selection as approximation
|
||||
GeneticSelectionMethod.Tournament => new TournamentSelection(),
|
||||
GeneticSelectionMethod.Roulette => new RouletteWheelSelection(),
|
||||
GeneticSelectionMethod.FitnessWeighted => new RankSelection(), // Use rank selection as approximation
|
||||
_ => new TournamentSelection()
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user