Jump to content




Bee Breeding With Attributes (Credit To Direwolf20 For Idea)

turtle

  • You cannot reply to this topic
128 replies to this topic

#41 McLeopold

  • Members
  • 123 posts

Posted 27 August 2013 - 11:08 AM

Thanks for finding the problem and reporting it.

View Postdybukk, on 26 August 2013 - 08:47 PM, said:

First of all I noticed this :

score = max(bees[combo[1]].score, bees[combo[2]].score)


It didn't take into account if one of the combo's might not a targeted drone. So I changed it to :

No it doesn't at that point, but there is a guard on line 640 that checks if either the primary or secondary species is not targeted, it will exit and return a score of 0. So by the time it hits that line of code, you know both will be targeted.

View Postdybukk, on 26 August 2013 - 08:47 PM, said:

This wasn't the problem though. It seems that the code scores everything the same that has the potential to make a particular type of bee. So all the following have the same score :

Industrious - Industrious
Unweary - Industrious
Dilligent - Industrious
Unweary - Dilligent

That is almost correct, but not quite. For a princess and a drone there are 4 combinations of primary and secondary that could happen. I score each of those combinations as if they had a 100% chance of succeeding in a mutation, which is simplified and not correct. So an Industrious:Industrious princess bred with an Industrious:Industrious drone will score each combination as Industrious and add them up. An Unweary:Unweary princess bred with a Diligent:Diligent drone will score 4 combinations (all being Unweary-Diligent) as Industrious and add them up the same. (I honestly don't know how the bee code is written, so this could be totally off. But it makes sense from a mendelian inheritance perspective.)

View Postdybukk, on 26 August 2013 - 08:47 PM, said:

There was nothing really modifying the score based around the probability of getting that particular type of drone. Maybe there should be a percentage taken off to give the pure drone higher ranking? I'm not sure.

Your guess is right. I think what is really needed is to account for the fact that a mutation has a chance of succeeding and to take that percentage and multiply it by the difference in the base score and the potential score. This way the Industrious-Industrious (100% chance of Industrious) combo will score higher than the Unweary-Diligent (8% chance) combo.

Or more simply, I could deduct one for each actual species attribute that doesn't match the potential attribute. Then I don't need to add percent mutation data to the program. This is almost the fix you did, but you boosted a drone for matching instead of deducting from a drone that didn't match. I think deducting is better because it maps to the potential outcome better.

Quote

Eventually I got the pure princess back and it started pairing with the pure drone. However it didn't exit as I suspected it should from looking at the code.

At that point the program is trying to stabalize the attributes of the bees. This is used so that you can breed in flyer and nocternal and other attributes. I think I should add an option to the program to specify if you don't care about purifying attributes.

BTW

bees[combo[1]].targeted and bees[combo[1]].score or 0

That is almost a ternary operator. It can break down if the second value is nil.

#42 dybukk

  • Members
  • 7 posts

Posted 27 August 2013 - 11:36 AM

View PostMcLeopold, on 27 August 2013 - 11:08 AM, said:

No it doesn't at that point, but there is a guard on line 640 that checks if either the primary or secondary species is not targeted, it will exit and return a score of 0. So by the time it hits that line of code, you know both will be targeted.

For some reason I read it as an "and". My bad. Although maybe it should get a score if it has at least one of the parts you are looking for.

View PostMcLeopold, on 27 August 2013 - 11:08 AM, said:

Your guess is right. I think what is really needed is to account for the fact that a mutation has a chance of succeeding and to take that percentage and multiply it by the difference in the base score and the potential score. This way the Industrious-Industrious (100% chance of Industrious) combo will score higher than the Unweary-Diligent (8% chance) combo.

Or more simply, I could deduct one for each actual species attribute that doesn't match the potential attribute. Then I don't need to add percent mutation data to the program. This is almost the fix you did, but you boosted a drone for matching instead of deducting from a drone that didn't match. I think deducting is better because it maps to the potential outcome better.

I suspect you are right in that deducting would be better. I just wasn't quite sure what maths was best :)

View PostMcLeopold, on 27 August 2013 - 11:08 AM, said:

At that point the program is trying to stabalize the attributes of the bees. This is used so that you can breed in flyer and nocternal and other attributes. I think I should add an option to the program to specify if you don't care about purifying attributes.

It was breeding "like for like" bees at this point. It was already stable. It was caring on as it needed "slot" to be the same in bosh hashes, which was always going to be 1 and 2.

View PostMcLeopold, on 27 August 2013 - 11:08 AM, said:

BTW

bees[combo[1]].targeted and bees[combo[1]].score or 0

That is almost a ternary operator. It can break down if the second value is nil.

Ahhhh should have thought of that.

Thanks again :)

Dybukk

#43 McLeopold

  • Members
  • 123 posts

Posted 27 August 2013 - 01:33 PM

View Postdybukk, on 27 August 2013 - 11:36 AM, said:

Although maybe it should get a score if it has at least one of the parts you are looking for.
-snip--
It was caring on as it needed "slot" to be the same in bosh hashes, which was always going to be 1 and 2.

I don't think it should still score if one of the species is not targeted. You don't want to "taint" the princess, the whole issue you had at the beginning. This is especially frustrating when trying to just breed in attributes from a species you don't care about.

As for the slot, oops. I see what your saying now. I forgot that I put the slot attribute in there. I only ended up using it to print the bee table.

Both issues are fixed and the bee-install program will update for you.

#44 wavern

  • Members
  • 3 posts

Posted 30 August 2013 - 01:17 PM

View PostMcLeopold, on 27 August 2013 - 01:33 PM, said:

View Postdybukk, on 27 August 2013 - 11:36 AM, said:

Although maybe it should get a score if it has at least one of the parts you are looking for.
-snip--
It was caring on as it needed "slot" to be the same in bosh hashes, which was always going to be 1 and 2.

I don't think it should still score if one of the species is not targeted. You don't want to "taint" the princess, the whole issue you had at the beginning. This is especially frustrating when trying to just breed in attributes from a species you don't care about.

As for the slot, oops. I see what your saying now. I forgot that I put the slot attribute in there. I only ended up using it to print the bee table.

Both issues are fixed and the bee-install program will update for you.

Since this last update it seems the turtle is way too happy to make pure-bred bees and stop on the way to the target.

"bee Imperial", for example, made pure bred Cultivated. The previous version, while never actually detecting pure bred bees, would at least progress to the target.

#45 McLeopold

  • Members
  • 123 posts

Posted 30 August 2013 - 03:17 PM

View Postwavern, on 30 August 2013 - 01:17 PM, said:


Since this last update it seems the turtle is way too happy to make pure-bred bees and stop on the way to the target.

"bee Imperial", for example, made pure bred Cultivated. The previous version, while never actually detecting pure bred bees, would at least progress to the target.

Can you post the bee.log of that run? If you've run the program again, it would have been replaced. If not, we can look at the data and see what decisions it made.

#46 dybukk

  • Members
  • 7 posts

Posted 31 August 2013 - 01:47 AM

Quote


Since this last update it seems the turtle is way too happy to make pure-bred bees and stop on the way to the target.

"bee Imperial", for example, made pure bred Cultivated. The previous version, while never actually detecting pure bred bees, would at least progress to the target.

Yeah I was worried about things like that :(

Maybe we should only do the deduction when dealing with species specified on the command line (So a pure breed the user wants).

Dybukk

#47 wavern

  • Members
  • 3 posts

Posted 31 August 2013 - 12:52 PM

View PostMcLeopold, on 30 August 2013 - 03:17 PM, said:

View Postwavern, on 30 August 2013 - 01:17 PM, said:

Since this last update it seems the turtle is way too happy to make pure-bred bees and stop on the way to the target.

"bee Imperial", for example, made pure bred Cultivated. The previous version, while never actually detecting pure bred bees, would at least progress to the target.

Can you post the bee.log of that run? If you've run the program again, it would have been replaced. If not, we can look at the data and see what decisions it made.

Unfortunately I overwrote that run but I did try to get some Distilled bees yesterday and it ended up with Noble purebred.

http://pastebin.com/WkUyim5d

#48 McLeopold

  • Members
  • 123 posts

Posted 31 August 2013 - 02:19 PM

View Postwavern, on 31 August 2013 - 12:52 PM, said:

View PostMcLeopold, on 30 August 2013 - 03:17 PM, said:

View Postwavern, on 30 August 2013 - 01:17 PM, said:

Since this last update it seems the turtle is way too happy to make pure-bred bees and stop on the way to the target.

"bee Imperial", for example, made pure bred Cultivated. The previous version, while never actually detecting pure bred bees, would at least progress to the target.

Can you post the bee.log of that run? If you've run the program again, it would have been replaced. If not, we can look at the data and see what decisions it made.

Unfortunately I overwrote that run but I did try to get some Distilled bees yesterday and it ended up with Noble purebred.

http://pastebin.com/WkUyim5d

The system only had nobles left in it so there where no chances for mutation. It's good that it stopped then, because you weren't targeting Nobles. You'll need to do a bit more hands on breeding to maintain it's inventory.

If you were going for distilled, then I think you started with the wrong princess and drones. Distilled is pretty high up and needs an oily and industrious, of which you had neither. It would be better to target bees at the top of a line, such as primeval, before trying to cross breed 2 lines that you don't have.

At this point, I don't think the scoring function is flawed, but I still would like to see if simply targeting Industrious or Imperial get's stuck.

#49 wavern

  • Members
  • 3 posts

Posted 02 September 2013 - 03:53 PM

View PostMcLeopold, on 31 August 2013 - 02:19 PM, said:

View Postwavern, on 31 August 2013 - 12:52 PM, said:

View PostMcLeopold, on 30 August 2013 - 03:17 PM, said:

View Postwavern, on 30 August 2013 - 01:17 PM, said:

Since this last update it seems the turtle is way too happy to make pure-bred bees and stop on the way to the target.

"bee Imperial", for example, made pure bred Cultivated. The previous version, while never actually detecting pure bred bees, would at least progress to the target.

Can you post the bee.log of that run? If you've run the program again, it would have been replaced. If not, we can look at the data and see what decisions it made.

Unfortunately I overwrote that run but I did try to get some Distilled bees yesterday and it ended up with Noble purebred.

http://pastebin.com/WkUyim5d

The system only had nobles left in it so there where no chances for mutation. It's good that it stopped then, because you weren't targeting Nobles. You'll need to do a bit more hands on breeding to maintain it's inventory.

If you were going for distilled, then I think you started with the wrong princess and drones. Distilled is pretty high up and needs an oily and industrious, of which you had neither. It would be better to target bees at the top of a line, such as primeval, before trying to cross breed 2 lines that you don't have.

At this point, I don't think the scoring function is flawed, but I still would like to see if simply targeting Industrious or Imperial get's stuck.

Fair enough, I didn't check it's stock very closely before sending it off on it's way. I tried another and I didn't run across the problem so it was likely just a mistake on my part.

BTW, it turns out tolerances can go up to 5 instead of just the 3 you have in your code. Might want to add _4 and _5 to up/down/both tolerances otherwise when you hit those there's a null error.

#50 Firnagzen

  • Members
  • 11 posts

Posted 15 September 2013 - 02:51 AM

Thank you for this program, it's seriously useful.

But I've found a minor glitch, very minor, and it's this: if the turtle inventory is full (which could happen in turn if the dump chest is full), after the analysis, the sorting fails with a turtle: 18: expected number (I may be remembering the error wrongly). This is relevant mainly for longer runs, and really shouldn't show up very much, but just pointing this out.

#51 duranis

  • Members
  • 8 posts

Posted 03 October 2013 - 05:47 AM

Did anyone ever figure out the issue with the analyser not working on MCPC servers?
Would really love to use this but it just wont work on the server at the moment.

#52 McLeopold

  • Members
  • 123 posts

Posted 03 October 2013 - 01:15 PM

View PostFirnagzen, on 15 September 2013 - 02:51 AM, said:

Thank you for this program, it's seriously useful.

But I've found a minor glitch, very minor, and it's this: if the turtle inventory is full (which could happen in turn if the dump chest is full), after the analysis, the sorting fails with a turtle: 18: expected number (I may be remembering the error wrongly). This is relevant mainly for longer runs, and really shouldn't show up very much, but just pointing this out.

I think number expected would be the slot number of the free spot to use for swapping bees. I'll take a look at the code. I can probably detect it and show a more useful message, but the end result would be the same, the turtle can't continue without dropping items on the ground. I'm not sure if there would be a more elegant solution.

#53 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 08 October 2013 - 04:26 PM

I'm curious if i'm doing it wrong, i've got the same setup as you, except it's a normal chest below, and for some reason when the turtle says "dropping excess" it doesn't drop the excess bees, is that meant to happen?

#54 apemanzilla

  • Members
  • 1,421 posts

Posted 09 October 2013 - 09:31 PM

So when can we expect the crazy multi-turtle open peripheral madness type setup Direwolf is using in FC2? (Just kidding, keep up the good work!)

On a side note, is there any particular source you used for all the data about the species and mutations, or did you enter it manually?

#55 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 10 October 2013 - 05:59 PM

So i broke your program a little bit, if you move a bee out of it while it's working, when it's sorting it will bug out and gives the error bee:615: attempt to index ? (a nil value)

#56 atticusmas

  • New Members
  • 1 posts

Posted 10 October 2013 - 06:50 PM

Hey, I know I must be doing something wrong here but when I run the program and do something like "bee imperial" it does stuff and works fine but then at one point it says something like "bee 1 not correctly analyzed". Then it waits for mor bees. I think the problem is my dumb knolwege of bees and because of this I might not know what to put in. So to get an imperial bee, what would I have to put into the apiary?

#57 duranis

  • Members
  • 8 posts

Posted 13 October 2013 - 04:56 PM

View Postatticusmas, on 10 October 2013 - 06:50 PM, said:

Hey, I know I must be doing something wrong here but when I run the program and do something like "bee imperial" it does stuff and works fine but then at one point it says something like "bee 1 not correctly analyzed". Then it waits for mor bees. I think the problem is my dumb knolwege of bees and because of this I might not know what to put in. So to get an imperial bee, what would I have to put into the apiary?

Are you on a server? If so its likely running MCPC which is somehow breaking the bee analyser. I would LOVE to have a solution to that but have been unable to find out how to fix it (or even what exactly is causing the problem).

#58 apemanzilla

  • Members
  • 1,421 posts

Posted 13 October 2013 - 05:20 PM

I have been using this program, running on two or three turtles on an MCPC+ server without any problems whatsoever.

#59 Tigsen

  • Members
  • 12 posts

Posted 13 October 2013 - 07:44 PM

Not sure if it is unique to a certain release of MCPC+ but I as well have noticed that the analyzer doesn't return the correct info, in fact the builtin readbee program will not even run correctly with it.

#60 duranis

  • Members
  • 8 posts

Posted 13 October 2013 - 08:02 PM

View PostApemanzilla, on 13 October 2013 - 05:20 PM, said:

I have been using this program, running on two or three turtles on an MCPC+ server without any problems whatsoever.

Could you possibly post what version of MCPC+ you are running? I have been trying to solve this problem for awhile now but don't want to force the poor server admin to mess about with different versions in the hopes of finding the right one that works.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users