biologyguy / Evopix

Pictures evolved
0 stars 0 forks source link

Breeding function #7

Open biologyguy opened 10 years ago

biologyguy commented 10 years ago

A new thread might be best here. Before you dive into combining points and path attributes, maybe start with just testing for path matches and mismatches, and building a baby from that alone. Set a mismatch as having a 50%/50% of being included, and each matched path has 50/50 chance of coming completely from one parent or the other. Get the evp built, and push it into a new Evopic object, and then call svg_out() to write the baby to a file so you can see it in your browser. Have a look at Evopic.reconstruct_evp() for ideas about writing the new evp file. Breeding Bubba with Bob or Sue will give the best results, because Bubba has an extra path and some obvious mutations. This would definitley get you on the right track.

jhawkey commented 10 years ago

Thanks Steve! Just took a look at your code and it's starting to make more sense now. The paths, that is. I shall attempt to play some more during those boring talks! ;)

jhawkey commented 10 years ago

See commit 36f118cfd6c3f021ebeff96f187ff35fb24e21f6 :D

jhawkey commented 10 years ago

Okay, scratch that, now see commit fde3289c03881b8fda84dad078e494d11c7a976d :D

The baby's look a little bit weird... sometimes they're really huge and sometimes they're really tiny. Other times they get these weird red growths in strange places. My code may be a little broken. I suspect it's in the path order stuff.

Currently the points, linear and radial points are determined by weighting using the same random proportion that is set at the beginning. I'm doing a coin flip to determine which parents stops and strokes get incorporated into the path, because I'm not sure how to weight/recombine/mutate hex values and the like.

biologyguy commented 10 years ago

I hope this doesn't mean there were a lot of boring or incomprehensible talks ;) Looks awesome, but I'll review more closely this evening to see if I can find the breaks.

biologyguy commented 10 years ago

Just a thought, but this might be eaiser if you were able to instantiate an 'empty' Evopic object, given that I've already written the reconstruct_evp() function. I can make that happen pretty easy if you want it.

biologyguy commented 10 years ago

I was able to trace back the bug to your weighting() function. You are applying a weight uniformly across all points in a path from one parent or the other, instead of taking a weighted average of the two. You've effectively implemented a scaling function! We're going to need one of those, so maybe rename it, and keep it for later ;) For your actual wieghting function, you'll need to do something like this for each coordinate pair: [((x1 - x2) * weight) + x1, ((y1 - y2) * weight) + y1] i.e., find the length of the line between points, truncate it with the weighting value, place one end on point (x2, y2), and then find the 'new' (x1, y1).

jhawkey commented 10 years ago

Ah huh! That makes sense. I think I took the weighting function from an earlier comment in one of the issues and so didn't actually think about it logically. I'll fix the bug today and see what new results we get.

biologyguy commented 10 years ago

Hey Jane, Been awhile since we touched base. I'm guessing grad school life has caught up with you again, but I thought I'd give you an update. I've more or less finished the mutation script, and I'm starting to get a handle on the Django framework. I've written a step-by-step guide for getting it set up (in the wiki), and I think it should work on your Mac. If you can get the server running, go to http://localhost:8000/404 and hit refresh a bunch of times to see Bob mutating :) There is still no rush on the breed function, given that we don't really have a website to plug anything into. I'm going to start building that up over the next month or so. I hope all is well down under! -Steve

jhawkey commented 10 years ago

Hi Steve,

Yes, unfortunately I have been really busy with the PhD these last few weeks. Usually I use my weekends to catch up on stuff like this but all my family have birthdays at this time of year so that’s been really busy too!

I am at a conference this weekend (which is kind of lame that it’s on all weekend), but my plan is to get stuck back into this the following weekend when things have calmed down a little.

Can’t wait to check out the website!

On 3 October 2014 at 7:41:40 am, Steve Bond (notifications@github.com) wrote:

Hey Jane, Been awhile since we touched base. I'm guessing grad school life has caught up with you again, but I thought I'd give you an update. I've more or less finished the mutation script, and I'm starting to get a handle on the Django framework. I've written a step-by-step guide for getting it set up (in the wiki), and I think it should work on your Mac. If you can get the server running, go to http://localhost:8000/404 and hit refresh a bunch of times to see Bob mutating :) There is still no rush on the breed function, given that we don't really have a website to plug anything into. I'm going to start building that up over the next month or so. I hope all is well down under! -Steve

— Reply to this email directly or view it on GitHub.