population

Choosing individuals from a population, by a fitness function

本小妞迷上赌 提交于 2019-12-05 06:03:19
I've been working on an algorithm, where I need to choose n individuals from a population of size k, where k is much bigger than n. All individuals have a fitness value, therefore the selection should favor higher fitness values. However, I don't want to simply choose best n individuals, the worse ones should have a chance also. (Natural selection) So, I decided to find the min and max fitness values within population. So, any individual would have p = (current - min) / (max - min) probability to be chosen, but I can not just iterate over all of them, roll the dice and choose one if the

SSE 4 popcount for 16 8-bit values?

南楼画角 提交于 2019-12-04 06:27:53
I have the following code which compiles with GCC using the flag -msse4 but the problem is that the pop count only gets the last four 8-bits of the converted __m128i type. Basically what I want is to count all 16 numbers inside the __m128i type but I'm not sure what intrinsic function call to make after creating the variable popA . Somehow popA has to be converted into an integer that contains all the 128-bits of information? I suppose theres _mm_cvtsi128_si64 and using a few shuffle few operations but my OS is 32-bit. Is there only the shuffle method and using _mm_cvtsi128_si32 ? EDIT: If the

Creating data in Prefuse

早过忘川 提交于 2019-12-03 08:24:13
I am new to Prefuse. The demo examples are all loaded data from a file/database. Is there any way to create the data dynamically instead of loading from file. For example, I want to create a tree data structure and visualize this. Any simple working example would be really helpful for me. I've just been attacking this problem. Here's a tweaked version of Example.java which shows one way to make it happen. Instead of loading data from socialnet.xml , I'm generating it programatically (based on Aggregate.java but without the aggregation stuff) and adding one field to each Node and each Edge .

Creating Population Pyramid with D3.js

徘徊边缘 提交于 2019-12-03 07:54:49
问题 I need to make a classic looking population pyramid with D3.js. Something similar to this image: I have found a few examples that look really good (this and this) but they are more complex than I'm looking for. Does anyone know of a good SIMPLE example that I can look at? Any advice for starting this? Should I just be making two bar graphs next to each other, one for each sex group? 回答1: The key to making a visualization like this is to spend a good amount of time setting up the layout in

Creating Population Pyramid with D3.js

﹥>﹥吖頭↗ 提交于 2019-12-02 21:23:21
I need to make a classic looking population pyramid with D3.js. Something similar to this image: I have found a few examples that look really good ( this and this ) but they are more complex than I'm looking for. Does anyone know of a good SIMPLE example that I can look at? Any advice for starting this? Should I just be making two bar graphs next to each other, one for each sex group? The key to making a visualization like this is to spend a good amount of time setting up the layout in advance before you get to drawing anything. There are a few key measurements that you will want to use to

Why do they use an ObjectId and a Number in the Mongoose Population example?

独自空忆成欢 提交于 2019-12-02 01:42:39
问题 In this example, they create personSchema using ObjectId to reference the Story and this I understand. But then in storySchema why don't they do the same to reference the person? Or the inverse: why using ObjectId instead of Number in Person? var mongoose = require('mongoose') , Schema = mongoose.Schema var personSchema = Schema({ _id : Number, name : String, age : Number, stories : [{ type: Schema.Types.ObjectId, ref: 'Story' }] }); var storySchema = Schema({ _creator : { type: Number, ref:

Hamming weight/population count in T-SQL

我们两清 提交于 2019-11-28 14:16:03
I'm looking for a fast way to calculate the hamming weight/population count/"the number of 1 bits" of a BINARY(1024) field. MySQL has a BIT_COUNT function that does something like that. I couldn't find a similar function in T-SQL? Or would you suggest storing the binary data in a field of another type? If you don't know what I'm talking about, here's a Wikipedia article about the hamming weight . You could use a helper table with precalculated Hamming weights for small numbers, like bytes, then split the value accordingly, join to the helper table and get the sum of partial Hamming weights as

How can I know when SQL Full Text Index Population is finished?

有些话、适合烂在心里 提交于 2019-11-27 03:42:37
We are writing unit tests for our ASP.NET application that run against a test SQL Server database. That is, the ClassInitialize method creates a new database with test data, and the ClassCleanup deletes the database. We do this by running .bat scripts from code. The classes under test are given a connection string that connects to the unit test database rather than a production database. Our problem is, that the database contains a full text index, which needs to be fully populated with the test data in order for our tests to run as expected. As far as I can tell, the fulltext index is always

How can I know when SQL Full Text Index Population is finished?

二次信任 提交于 2019-11-26 12:40:26
问题 We are writing unit tests for our ASP.NET application that run against a test SQL Server database. That is, the ClassInitialize method creates a new database with test data, and the ClassCleanup deletes the database. We do this by running .bat scripts from code. The classes under test are given a connection string that connects to the unit test database rather than a production database. Our problem is, that the database contains a full text index, which needs to be fully populated with the