This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <script src="https://fb.me/react-with-addons-15.1.0.js"></script> | |
| <script src="https://fb.me/react-dom-15.1.0.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.4.5/react-redux.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.handler = (event, context, callback) => { | |
| var data = { | |
| headers: event.headers, | |
| path: event.resourcePath, | |
| queryParams: event.queryStringParameters, | |
| pathParams: event.pathParameters, | |
| bodyParams: event.body, | |
| method: event.httpMethod | |
| } | |
| var response = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def calculate_crowding_distance(pop) | |
| pop.each {|p| p[:dist] = 0.0} | |
| num_obs = pop.first[:objectives].size | |
| num_obs.times do |i| | |
| min = pop.min{|x,y| x[:objectives][i]<=>y[:objectives][i]} | |
| max = pop.max{|x,y| x[:objectives][i]<=>y[:objectives][i]} | |
| rge = max[:objectives][i] - min[:objectives][i] | |
| pop.first[:dist], pop.last[:dist] = 1.0/0.0, 1.0/0.0 | |
| next if rge == 0.0 | |
| (1...(pop.size-1)).each do |j| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {min, max} = require('underscore') | |
| const first = (arr) => arr[0] | |
| const last = (arr) => arr[arr.length - 1] | |
| const almostZero = (a) => (a > -0.000001 && a < 0.000001) | |
| const almostEqual = (a, b) => almostZero(Math.abs(a) - Math.abs(b)) | |
| const population = [ | |
| { objectives: [0.1, 0.2, 0.3] }, | |
| { objectives: [0.2, 0.4, 0.6] }, | |
| { objectives: [0.1, 0.05, 0.3] } | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Install Plug for plugin support | |
| " curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
| " Don't try to be vi compatible | |
| set nocompatible | |
| " Helps force plugins to load correctly when it is turned back on below | |
| filetype off | |
| " Auto reload file when changed by linter |
OlderNewer