Skip to content

Instantly share code, notes, and snippets.

View IGTI_Desafio_1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View IGTI_Trabalho_prático_1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@borgeslt
borgeslt / ArrayShuffleExtension.js
Last active Feb 3, 2020
Shuffling an array in Javascript
View ArrayShuffleExtension.js
Array.prototype.shuffle = function () {
return this.map(item => {
return {
index: Math.random(),
value: item
}
})
.sort((item1, item2) => item1.index - item2.index)
.map(item => item.value)
}
@borgeslt
borgeslt / SimpleDemoGA.js
Last active Jan 22, 2020
A Simple Genetic Algorithms in Javascript
View SimpleDemoGA.js
/*
Based on the Vijini Mallawaarachchi's article in Towards Data Science
https://towardsdatascience.com/introduction-to-genetic-algorithms-including-example-code-e396e98d8bf3
*/
"strict mode"
function Individual(numOfGenes) {
const _genes = Array(numOfGenes).fill(0).map(i => Math.floor(Math.random() * 1000 % 2));
let _fitness = 0;