{"action":"created","comment":{"url":"https://api.github.com/repos/JJ/nodeo/pulls/comments/42987131","id":42987131,"diff_hunk":"@@ -0,0 +1,82 @@\n+var test = require('tap').test,\n+nodeo = require(__dirname + '/../../lib/nodeo.js');\n+\n+var CF = nodeo.chromosome_float;\n+var Classic = nodeo.classic_float;\n+\n+test('loads', function (t) {\n+         t.ok(Classic, 'Loaded OK');\n+         t.end();\n+     });\n+\n+var population_size = 16,\n+population = new Array([]),\n+chromosome_size = 16;\n+\n+\n+test('chromosomes floats', function (t) {\n+    var tmpChr=[];\n+    for( var i=0; i<chromosome_size; ++i ) tmpChr[i]=Math.random();\n+    for ( var i = 0; i < population_size; i ++ )  {\n+\tvar chromosome = new CF.Chromosome( tmpChr );\n+\tpopulation.push( chromosome );\n+\tt.equal(chromosome.vector.length, chromosome_size, \"Length \" + chromosome.vector.toString() + \" OK\" );\n+\t/*var is_match = chromosome.string.match(/[01]+/g );\n+\tt.ok(is_match, \"Binary\");\n+        chromosome.fitness =  nodeo.utils.max_ones( chromosome.string );\n+        */\n+\tt.ok( chromosome.fitness >= 0, \"fitness\" );\n+\n+    // Testing mutation\n+\tvar new_chromosome = CF.mutate(chromosome);\n+\tt.ok( !new_chromosome.vector.reduce(function(prev,e,i){return prev && e==chromosome.vector[i];},true), // Compares vector position by position\n+         \"mutation \" + chromosome.vector.toString() + \" - \" + new_chromosome.vector.toString());\n+\tt.equal( new_chromosome.vector.length, chromosome.vector.length, \"Length mutation\" );\n+\tif ( nodeo.utils.sum_ones( new_chromosome.vector )<chromosome_size/2 ) {\n+        // Testing invert\n+\t    var to_cross = CF.invert( chromosome );\n+\t    t.ok( to_cross.vector.reduce(function(prev,e,i){return prev && e==to_cross.vector[i];},true) !== chromosome.vector.reduce(function(prev,e,i){return prev && e==to_cross.vector[i];},true)\n+            , \"invert \" + to_cross.vector.toString() + \" - \" + chromosome.vector.toString() );\n+\n+        // Testing crossover\n+\t    var crossed = CF.crossover( to_cross, chromosome );\n+\t    t.ok( !crossed[0].vector.reduce(function(prev,e,i){return prev && e==to_cross.vector[i];},true),  // Compares vector position by position\n+\t\t  \"Crossed 1 \" + crossed[0].vector + \"!==\" + chromosome.vector);\n+\t    t.equal( crossed[0].vector.length,chromosome.vector.length, \"Crossed 1's Length\");","path":"test/unit/floats.js","position":45,"original_position":45,"commit_id":"fcbcd1ffa98a51d448f5185ce748a0a549fd4b87","original_commit_id":"fcbcd1ffa98a51d448f5185ce748a0a549fd4b87","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long.<br>Mixed double and single quotes.","created_at":"2015-10-26T12:34:55Z","updated_at":"2015-10-26T12:34:55Z","html_url":"https://github.com/JJ/nodeo/pull/22#discussion_r42987131","pull_request_url":"https://api.github.com/repos/JJ/nodeo/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/JJ/nodeo/pulls/comments/42987131"},"html":{"href":"https://github.com/JJ/nodeo/pull/22#discussion_r42987131"},"pull_request":{"href":"https://api.github.com/repos/JJ/nodeo/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/JJ/nodeo/pulls/22","id":48733488,"html_url":"https://github.com/JJ/nodeo/pull/22","diff_url":"https://github.com/JJ/nodeo/pull/22.diff","patch_url":"https://github.com/JJ/nodeo/pull/22.patch","issue_url":"https://api.github.com/repos/JJ/nodeo/issues/22","number":22,"state":"open","locked":false,"title":"Master","user":{"login":"vrivas","id":3046042,"avatar_url":"https://avatars.githubusercontent.com/u/3046042?v=3","gravatar_id":"","url":"https://api.github.com/users/vrivas","html_url":"https://github.com/vrivas","followers_url":"https://api.github.com/users/vrivas/followers","following_url":"https://api.github.com/users/vrivas/following{/other_user}","gists_url":"https://api.github.com/users/vrivas/gists{/gist_id}","starred_url":"https://api.github.com/users/vrivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrivas/subscriptions","organizations_url":"https://api.github.com/users/vrivas/orgs","repos_url":"https://api.github.com/users/vrivas/repos","events_url":"https://api.github.com/users/vrivas/events{/privacy}","received_events_url":"https://api.github.com/users/vrivas/received_events","type":"User","site_admin":false},"body":"Hi JJ!\nI’ve developed the version that deals with floats (vector of floats).\nI’ve used a slightly different approach in my chromosome since operators and reproduction are NOT methods of chromosome, but they have been build as function, and encapsulated under the same namespace.\n\nI can change quite easily if you prefer to have the same approach than in your binary chromosome… although I think is better the way I’ve done it :)","created_at":"2015-10-26T12:34:50Z","updated_at":"2015-10-26T12:34:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1004bd697a613ad50a5159e2868a55186c746ce9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JJ/nodeo/pulls/22/commits","review_comments_url":"https://api.github.com/repos/JJ/nodeo/pulls/22/comments","review_comment_url":"https://api.github.com/repos/JJ/nodeo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JJ/nodeo/issues/22/comments","statuses_url":"https://api.github.com/repos/JJ/nodeo/statuses/fcbcd1ffa98a51d448f5185ce748a0a549fd4b87","head":{"label":"vrivas:master","ref":"master","sha":"fcbcd1ffa98a51d448f5185ce748a0a549fd4b87","user":{"login":"vrivas","id":3046042,"avatar_url":"https://avatars.githubusercontent.com/u/3046042?v=3","gravatar_id":"","url":"https://api.github.com/users/vrivas","html_url":"https://github.com/vrivas","followers_url":"https://api.github.com/users/vrivas/followers","following_url":"https://api.github.com/users/vrivas/following{/other_user}","gists_url":"https://api.github.com/users/vrivas/gists{/gist_id}","starred_url":"https://api.github.com/users/vrivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrivas/subscriptions","organizations_url":"https://api.github.com/users/vrivas/orgs","repos_url":"https://api.github.com/users/vrivas/repos","events_url":"https://api.github.com/users/vrivas/events{/privacy}","received_events_url":"https://api.github.com/users/vrivas/received_events","type":"User","site_admin":false},"repo":{"id":44929486,"name":"nodeo","full_name":"vrivas/nodeo","owner":{"login":"vrivas","id":3046042,"avatar_url":"https://avatars.githubusercontent.com/u/3046042?v=3","gravatar_id":"","url":"https://api.github.com/users/vrivas","html_url":"https://github.com/vrivas","followers_url":"https://api.github.com/users/vrivas/followers","following_url":"https://api.github.com/users/vrivas/following{/other_user}","gists_url":"https://api.github.com/users/vrivas/gists{/gist_id}","starred_url":"https://api.github.com/users/vrivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrivas/subscriptions","organizations_url":"https://api.github.com/users/vrivas/orgs","repos_url":"https://api.github.com/users/vrivas/repos","events_url":"https://api.github.com/users/vrivas/events{/privacy}","received_events_url":"https://api.github.com/users/vrivas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vrivas/nodeo","description":"Simple evolutionary algorithm in JavaScript in CommonJS format, for node.js and anything else.","fork":true,"url":"https://api.github.com/repos/vrivas/nodeo","forks_url":"https://api.github.com/repos/vrivas/nodeo/forks","keys_url":"https://api.github.com/repos/vrivas/nodeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vrivas/nodeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vrivas/nodeo/teams","hooks_url":"https://api.github.com/repos/vrivas/nodeo/hooks","issue_events_url":"https://api.github.com/repos/vrivas/nodeo/issues/events{/number}","events_url":"https://api.github.com/repos/vrivas/nodeo/events","assignees_url":"https://api.github.com/repos/vrivas/nodeo/assignees{/user}","branches_url":"https://api.github.com/repos/vrivas/nodeo/branches{/branch}","tags_url":"https://api.github.com/repos/vrivas/nodeo/tags","blobs_url":"https://api.github.com/repos/vrivas/nodeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vrivas/nodeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vrivas/nodeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/vrivas/nodeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vrivas/nodeo/statuses/{sha}","languages_url":"https://api.github.com/repos/vrivas/nodeo/languages","stargazers_url":"https://api.github.com/repos/vrivas/nodeo/stargazers","contributors_url":"https://api.github.com/repos/vrivas/nodeo/contributors","subscribers_url":"https://api.github.com/repos/vrivas/nodeo/subscribers","subscription_url":"https://api.github.com/repos/vrivas/nodeo/subscription","commits_url":"https://api.github.com/repos/vrivas/nodeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/vrivas/nodeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/vrivas/nodeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/vrivas/nodeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/vrivas/nodeo/contents/{+path}","compare_url":"https://api.github.com/repos/vrivas/nodeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vrivas/nodeo/merges","archive_url":"https://api.github.com/repos/vrivas/nodeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vrivas/nodeo/downloads","issues_url":"https://api.github.com/repos/vrivas/nodeo/issues{/number}","pulls_url":"https://api.github.com/repos/vrivas/nodeo/pulls{/number}","milestones_url":"https://api.github.com/repos/vrivas/nodeo/milestones{/number}","notifications_url":"https://api.github.com/repos/vrivas/nodeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vrivas/nodeo/labels{/name}","releases_url":"https://api.github.com/repos/vrivas/nodeo/releases{/id}","created_at":"2015-10-25T20:57:49Z","updated_at":"2015-10-25T20:57:50Z","pushed_at":"2015-10-26T12:32:03Z","git_url":"git://github.com/vrivas/nodeo.git","ssh_url":"git@github.com:vrivas/nodeo.git","clone_url":"https://github.com/vrivas/nodeo.git","svn_url":"https://github.com/vrivas/nodeo","homepage":null,"size":2649,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JJ:master","ref":"master","sha":"da716039ecb38951a65a6297eebb08eb6c3dfd15","user":{"login":"JJ","id":500,"avatar_url":"https://avatars.githubusercontent.com/u/500?v=3","gravatar_id":"","url":"https://api.github.com/users/JJ","html_url":"https://github.com/JJ","followers_url":"https://api.github.com/users/JJ/followers","following_url":"https://api.github.com/users/JJ/following{/other_user}","gists_url":"https://api.github.com/users/JJ/gists{/gist_id}","starred_url":"https://api.github.com/users/JJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JJ/subscriptions","organizations_url":"https://api.github.com/users/JJ/orgs","repos_url":"https://api.github.com/users/JJ/repos","events_url":"https://api.github.com/users/JJ/events{/privacy}","received_events_url":"https://api.github.com/users/JJ/received_events","type":"User","site_admin":false},"repo":{"id":14179974,"name":"nodeo","full_name":"JJ/nodeo","owner":{"login":"JJ","id":500,"avatar_url":"https://avatars.githubusercontent.com/u/500?v=3","gravatar_id":"","url":"https://api.github.com/users/JJ","html_url":"https://github.com/JJ","followers_url":"https://api.github.com/users/JJ/followers","following_url":"https://api.github.com/users/JJ/following{/other_user}","gists_url":"https://api.github.com/users/JJ/gists{/gist_id}","starred_url":"https://api.github.com/users/JJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JJ/subscriptions","organizations_url":"https://api.github.com/users/JJ/orgs","repos_url":"https://api.github.com/users/JJ/repos","events_url":"https://api.github.com/users/JJ/events{/privacy}","received_events_url":"https://api.github.com/users/JJ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JJ/nodeo","description":"Simple evolutionary algorithm in JavaScript in CommonJS format, for node.js and anything else.","fork":false,"url":"https://api.github.com/repos/JJ/nodeo","forks_url":"https://api.github.com/repos/JJ/nodeo/forks","keys_url":"https://api.github.com/repos/JJ/nodeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JJ/nodeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JJ/nodeo/teams","hooks_url":"https://api.github.com/repos/JJ/nodeo/hooks","issue_events_url":"https://api.github.com/repos/JJ/nodeo/issues/events{/number}","events_url":"https://api.github.com/repos/JJ/nodeo/events","assignees_url":"https://api.github.com/repos/JJ/nodeo/assignees{/user}","branches_url":"https://api.github.com/repos/JJ/nodeo/branches{/branch}","tags_url":"https://api.github.com/repos/JJ/nodeo/tags","blobs_url":"https://api.github.com/repos/JJ/nodeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JJ/nodeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JJ/nodeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/JJ/nodeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JJ/nodeo/statuses/{sha}","languages_url":"https://api.github.com/repos/JJ/nodeo/languages","stargazers_url":"https://api.github.com/repos/JJ/nodeo/stargazers","contributors_url":"https://api.github.com/repos/JJ/nodeo/contributors","subscribers_url":"https://api.github.com/repos/JJ/nodeo/subscribers","subscription_url":"https://api.github.com/repos/JJ/nodeo/subscription","commits_url":"https://api.github.com/repos/JJ/nodeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/JJ/nodeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/JJ/nodeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/JJ/nodeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/JJ/nodeo/contents/{+path}","compare_url":"https://api.github.com/repos/JJ/nodeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JJ/nodeo/merges","archive_url":"https://api.github.com/repos/JJ/nodeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JJ/nodeo/downloads","issues_url":"https://api.github.com/repos/JJ/nodeo/issues{/number}","pulls_url":"https://api.github.com/repos/JJ/nodeo/pulls{/number}","milestones_url":"https://api.github.com/repos/JJ/nodeo/milestones{/number}","notifications_url":"https://api.github.com/repos/JJ/nodeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JJ/nodeo/labels{/name}","releases_url":"https://api.github.com/repos/JJ/nodeo/releases{/id}","created_at":"2013-11-06T17:27:41Z","updated_at":"2015-10-25T20:54:44Z","pushed_at":"2015-10-26T12:34:50Z","git_url":"git://github.com/JJ/nodeo.git","ssh_url":"git@github.com:JJ/nodeo.git","clone_url":"https://github.com/JJ/nodeo.git","svn_url":"https://github.com/JJ/nodeo","homepage":null,"size":2649,"stargazers_count":15,"watchers_count":15,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":6,"forks":5,"open_issues":6,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JJ/nodeo/pulls/22"},"html":{"href":"https://github.com/JJ/nodeo/pull/22"},"issue":{"href":"https://api.github.com/repos/JJ/nodeo/issues/22"},"comments":{"href":"https://api.github.com/repos/JJ/nodeo/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/JJ/nodeo/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/JJ/nodeo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JJ/nodeo/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/JJ/nodeo/statuses/fcbcd1ffa98a51d448f5185ce748a0a549fd4b87"}}}}