public override void Execute(Instance instance) { if (!(instance is SMInstance)) { this.result = new SMResult("Type mismatch"); return; } SMInstance smi = (SMInstance)instance; StableMarriageAlgorithm smAlg = new ManFirstAlgorithm(); smAlg.Execute(smi.SwapRoles()); SMResult mAlgResult = (SMResult) smAlg.Result; this.result = new SMResult(mAlgResult.wMatch, mAlgResult.mMatch, smi); }
public SMSpace() { this.name = "Stable Marriage"; SMInstanceGenerator smi1 = new SMRandomGenerator(); SMInstanceGenerator smi2 = new SMCyclicGenerator(); SMInstanceGenerator smi3 = new SMStrictGenerator(); this.generators.AddRange(new[] { smi1, smi2, smi3 }); StableMarriageAlgorithm sma1 = new WomanFirstAlgorithm(); StableMarriageAlgorithm sma2 = new ManFirstAlgorithm(); StableMarriageAlgorithm sma3 = new ElopeAlgorithm(); StableMarriageAlgorithm sma4 = new ManElopeAlgorithm(); StableMarriageAlgorithm sma5 = new MEA2(); this.algorithms.AddRange(new[] { sma1, sma2, sma3, sma4, sma5 }); }