UNPKG

@zfunction/genetics-js

Version:

Genetic and evolutionary algorithms framework for the web

28 lines 1.29 kB
"use strict"; /* * @license * Copyright (c) 2019 Cristian Abrante. All rights reserved. * Licensed under the MIT License. See LICENSE in the project root for license information. */ Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("../../generator/utils"); var NPointsCrossover_1 = require("./NPointsCrossover"); var OnePointCrossover = /** @class */ (function () { function OnePointCrossover() { } OnePointCrossover.prototype.cross = function (firstParent, secondParent, individualConstructor, engine) { if (engine === void 0) { engine = utils_1.Generator.DEFAULT_ENGINE; } return this.crossWith(firstParent, secondParent, { individualConstructor: individualConstructor, engine: engine }); }; OnePointCrossover.prototype.crossWith = function (firstParent, secondParent, params) { var cross = new NPointsCrossover_1.NPointsCrossover(); return cross.crossWith(firstParent, secondParent, { engine: params.engine, individualConstructor: params.individualConstructor, numberOfCrossoverPoints: 1, }); }; return OnePointCrossover; }()); exports.OnePointCrossover = OnePointCrossover; //# sourceMappingURL=OnePointCrossover.js.map