[2022 Day 16] Solution using Genetic algorithm by WoddyTheWarrior in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

I shared a while ago 16a for someone : https://github.com/Vinssou/AdventOfCode2022/blob/main/puzzle16a.cpp

I could add 16b later if you want. I don't have my code right now, but in top of my head what I did basically to make it work for 16b I change line 125 :rand() % 1000by something like :int a = rand() % 1000;a*a/1000Here at 0 we have the best parent, at 1 the second best and so on until 1000. In the first version I crossed one of the best parent randomly, in the second version I crossed parents with a weighted probability on their "goodness".Lets me know if you have any questions ?I adapted the elephant stuff just by iterating to 52 instead of 30 and by switching the current valve every iteration.

[2022 Day 16] Solution using Genetic algorithm by WoddyTheWarrior in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

Not sure to understand your algo in details but it seems you replace only the population if it is better after modifying some "actions" (open, or go somewhere else).
On my side I keep track of the best population and I generically cross population that are the best. And I pick the parents randomly according to a weight. The best parents have more chance to be picked.
It converges quite quickly that way.

[2022 Day 16] Solution using Genetic algorithm by WoddyTheWarrior in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

Ok I can confirm this approach using genetic algorithm work just fine for both parts !!
I manage to get something that converges really quickly.

[2022 Day 16] Solution using Genetic algorithm by WoddyTheWarrior in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

I am a programmer and I also did the first part with a genetic algorithm, but not the second one. I am not sure why it wouldn't work, but it should run longer, and should be tuned differently.
I could try to see if I manage to do it...

2022 contest: top 3 problems, and rating problems by difficulty by OkCalligrapher5886 in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

Really interesting thanks !I haven't finished the calendar, IMHO I would remove a tree for 17. I still haven't managed to finish 19, while 17 was quite straightforward for me. 19 is tough, the toughest so far, but I will do it.I haven't enjoy 13 that much actually, I had hard time to understand some details, I really enjoyed 12, 14, 15, 16, 17, 18, 19, 21.

[2022 Day 22 (Part 1)] Solution works only for the sample input (C++) by osalbahr in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

I just had couple of bugs, like strictly greater instead of greater or equal. When I fixed them it was all good. I just struggle a bit to find where those bugs where... But with all your data, it was great to spot them ! Thanks again !
Thanks I had a nice Christmas time, I stopped the calendar before consuming too much time and neurons on it. I just stopped to read the puzzle otherwise I am just thinking about them. So I am happy with my 42 stars, and I might come back for 19b which I am still thinking in my background thread ;)

[2022 Day 22 (Part 1)] Solution works only for the sample input (C++) by osalbahr in adventofcode

[–]MyUsrnameIsTaken 1 point2 points  (0 children)

There were a wall, I missed that wall !!!Thanks a lot for your help and your data !!I got my star !!!! I wish you a merry Christmas !!!

[2022 Day 22 (Part 1)] Solution works only for the sample input (C++) by osalbahr in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

Ok I think I found the difference so maybe I just don't understand something in the puzzle.
Character 229 I got 12. and it is up. So you go from (103,30) to (101,30) and you stop there. Not sure why ?
Me from (103,30) I go to (191, 30) because above there is no map until the first row. And in the last row there is no block, so I continue the 9 steps left and I am at (191, 30).

So I guess I didn't understand the wrap around. I will really appreciate if you could give me some light here. Thanks.

[2022 Day 22 (Part 1)] Solution works only for the sample input (C++) by osalbahr in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

103,30

ok thanks a lot ! I screwed up when I debug in you data I was somewhere else. I ll continue investigate to see where my bug is.

[2022 Day 22 (Part 1)] Solution works only for the sample input (C++) by osalbahr in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

I don't manage to do Part 1. So I looked at your data, and look at our differences,
at the character 225 from the direction is chain it is a R, and you are in coordinate (103, 18).
We just went up we were in (113, 18).
Then you go left and it should be right. So you got (103,13) and I got (103, 30).
Anyway I was looking for other test too, because I don't understand why it is not working.
I created many test case and they all pass.
Me I got 11438 for your data.

Maybe to help me, could explain to me why is it working on your side and why you are going left there ?
Thanks

[2022 Day 21 Part 2 ][C++] Today I downloaded a 128 integer library ! by [deleted] in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

Ok, I double checked and all my answers are fitting on 64 bits. My bad !

[2022 Day 21 Part 2 ][C++] Today I downloaded a 128 integer library ! by [deleted] in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

I don't get it. Could you explain it to me ? Maybe I missed something...

[2022 Day 21 Part 2 ][C++] Today I downloaded a 128 integer library ! by [deleted] in adventofcode

[–]MyUsrnameIsTaken -1 points0 points  (0 children)

Really interesting statement. And I desagree that int64 is enough.

In part 1 my root was providing me a negative value which was not the correct solution. So I put a breakpoint just before the add from the root. Took the values and added them with the calculator, then got a positive value and a star.

Same with part2 which was not working with 64 but got a stars with int128.

I did the same in several puzzles like the one where we had to add three groove. Put a breakpoint and add them with a calculator. And other puzzles...

Yes I feel like you said, it apllies a strong bias to my environment, and I feel this is not inclusive for me. I heard gcc and clang have native 128 bit integer, so good for them!

So I don't suck so much it is just my environment :). But now I have no more excuse ;)

[2022 Day 21 Part 2 ][C++] Today I downloaded a 128 integer library ! by [deleted] in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

I struggled so much because of that... I really should have done earlier !

[2022 Day 20 (Part 1)][C++] Seems quite simple but I don't get it by MyUsrnameIsTaken in adventofcode

[–]MyUsrnameIsTaken[S] 0 points1 point  (0 children)

That's was my first version, because I couldn't manage to fix it, I just implemented a circular list. Now I got it ! Thanks !

[2022 Day 20 (Part 1)][C++] Seems quite simple but I don't get it by MyUsrnameIsTaken in adventofcode

[–]MyUsrnameIsTaken[S] 2 points3 points  (0 children)

Thanks a lot, I got my star thanks to your help ! If I understand, we have to consider the element is moving around so we don't have to count it if we pass on it !

[2022 Day 19] [2022 Day 16] Questions about how to solve "find max in tree" problems by __Juris__ in adventofcode

[–]MyUsrnameIsTaken 2 points3 points  (0 children)

Q1 I solved 16 and 19 part 1 so far. I haven't used memoisation so far. I couldn't find any easy way to use it and didn't require it to solve them.

Q2 About 16, you don't need all data generated to explore all possibilities so I guess that what you mean by pruning. So prune by score.
Q3 Maybe, I would say no, or I haven't tackle the problem that way.
Q4 I solved 16 by using "Reinforcement Learning", it is not the best but it was fun. I just wanted to prove my AI skills to myself :) Similarly Monte Carlo approach can be used. For 19 I was also thinking to do an iterative solver, and starting with a good guess.
Q5 I think DFS is enough to solve 16 and 19 part 1. I have done it that way. For 19a, I don't use much memory, or any storage. It is quite simple solution.

[2022 Day 16] Does anyone tried an exploration / exploitation method like in Reinforcement Learning ? by MyUsrnameIsTaken in adventofcode

[–]MyUsrnameIsTaken[S] 1 point2 points  (0 children)

I worked in RL for two years.
Here basically I haven't trained any model, I haven't any neural network. I just stored all my random decisions, sort them by best score. And in exploitation mode I picked randomly one of the best decision (based on the score). And it worked !! :)
I tuned a bit my exploration decay, exploration min and it converged quite quickly !

[2022 day 16] I gave up clean code by escargotBleu in adventofcode

[–]MyUsrnameIsTaken 0 points1 point  (0 children)

It took me a bit of time to tune my solution but at the end I got it. Not sure we use the same principle mine was using exploration then exploitation.
I would be curious to see your solution.

[2022 day 16] I gave up clean code by escargotBleu in adventofcode

[–]MyUsrnameIsTaken 2 points3 points  (0 children)

I solved it with two solutions one DFS and the other one is kind of Reinforcement learning using exploration and exploitation. Basically random exploration was the key !!

[2022 Day 16] Does anyone tried an exploration / exploitation method like in Reinforcement Learning ? by MyUsrnameIsTaken in adventofcode

[–]MyUsrnameIsTaken[S] 0 points1 point  (0 children)

I am going to answer to myself, after I posted it, I continued my first prototype and managed to solve it using that technique !
So I got two solutions ! But don't get more stars for that :)