public async Task <dto.AssignSeatsResponse> AssignSeat(dto.AssignSeatRequest assignSeatRequest) { var sellSeatRequest = await GetSellSeatRequest(assignSeatRequest, false); var assignSeatsRequest = new AssignSeatsRequest { ContractVersion = _navApiContractVer, MessageContractVersion = _navMsgContractVer, Signature = await _sessionBag.Signature(), SellSeatRequest = sellSeatRequest }; var assignSeatsResponse = await _client.AssignSeatsAsync(assignSeatsRequest); var error = NewskiesHelper.GetUpdateResponseError(assignSeatsResponse.BookingUpdateResponseData); if (error != null) { throw new dto.ResponseErrorException( dto.Enumerations.ResponseErrorCode.SeatAssignmentFailure, error); } return(Mapper.Map <dto.AssignSeatsResponse>(assignSeatsResponse)); }
public async Task <AssignSeatsResponse> Execute(AssignSeatsRequest request) { var configuration = await configurationRepository.GetConfiguration(); var fitnessFunction = FitnessFunction.GetScoreFunction(request.Map, request.Attendees, request.Topics); var solution = await GeneticAlgorithmFactory <int> .Factory .WithMutationProbability(configuration.MutationProbability) .WithPopulationSize(configuration.PopulationSize) .WithEliteSize(configuration.EliteSize) .WithMaxGenerations(configuration.MaxGenerations) .WithSolutionPrecision(configuration.SolutionPrecision) .Create( new Mutator <int>(new RandonInvididualGenesPoint()), new DavisOrderCrossOver <int>(new RandonInvididualGenesPoint()), new RandomPopulationCreator <int>(), fitnessFunction) .FindSolutionAsync(GetGenes(request.Map, request.Attendees).ToArray()); return(new AssignSeatsResponse { Solution = solution, Score = fitnessFunction(solution) }); }