-
Notifications
You must be signed in to change notification settings - Fork 0
/
MobiusDemoMatchmakingConfig.ts
51 lines (41 loc) · 2.32 KB
/
MobiusDemoMatchmakingConfig.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import {IWeightedFitnessFunction} from "../../../genetic/api/FitnessFunction";
import {GeneticParameters} from "../../../genetic/api/GeneticParameters";
import {HallOfFameResult} from "../../../genetic/api/MetricCollector";
import {IMatchmakingParameters} from "../../api/IMatchmakingOptions";
import {IMatchupSchedule} from "../../api/MatchmakingGeneticTypes";
import {IMobiusMatchmakingOptions, IMobiusTeam, MobiusMatchmakingConfig} from "../MobiusMatchmakingConfig";
import {CountDecentDuplicateMatchupsFitnessFunction, CountTotalMatchupsFitnessFunction} from "../operators/MatchupFitnessFunctions";
import {HardEloDifferentialLimitKillPredicate} from "../operators/MatchupPopulationSelectors";
// This is an example of extending an existing matchmaking configuration to tweak parameters
export class MobiusDemoMatchmakingConfig extends MobiusMatchmakingConfig {
public constructor(parameters?: IMobiusMatchmakingOptions) {
super(parameters);
}
public configure(
parameters: IMatchmakingParameters<IMobiusTeam>
): GeneticParameters<IMatchupSchedule<IMobiusTeam>, HallOfFameResult<IMatchupSchedule<IMobiusTeam>>> {
const options = super.configure(parameters);
options.debugLogging = false;
options.maximumGenerations = 1000;
options.maximumPopulationSize = 100;
// example of tweaking configuration for optimizing maximum matches (permitting duplicates)
const maximizeMatches: boolean = false; // e.g., toggle this to 'true'
if (maximizeMatches) {
// increase weighting for maximizing total matches
options.findByOperatorType<IWeightedFitnessFunction<IMatchupSchedule<IMobiusTeam>>>(CountTotalMatchupsFitnessFunction)!
.child.weight = 1000;
// remove the fitness function that penalizes duplicate matchups
options.findByOperatorType(CountDecentDuplicateMatchupsFitnessFunction)!.remove();
options.findByOperatorType(HardEloDifferentialLimitKillPredicate)!.remove();
}
return options;
}
}
export const mobiusDemoMatchmakingConfig = new MobiusDemoMatchmakingConfig({
hallOfFame: 32,
maximumGamesPerTeam: 3,
hardEloDifferentialLimit: 200,
preventDuplicateMatchupsInLastXDays: 14,
countGamesPlayedInLastXDays: 21,
minimumPermittedBackToBackRecency: 1,
});