Programming Thread

Started by the-pi-guy, Mar 13, 2016, 10:39 PM

previous topic - next topic

0 Members and 5 Guests are viewing this topic.

Go Down

Legend

I tried my hand at some neural nets from scratch but I had some issues. Felt like I was brute forcing results instead of making predictable progress.




With just an input and output layer, I can get to this level of quality super quick. Sometimes it makes it a bit farther but never down to the next loop.



With a middle layer it reaches the same spot but takes a bit longer to train. This is around 50,000 epochs.



Two middle layers doesn't improve the final result, it just takes longer to reach there. This is 150,000 epochs.


I'm guessing I'm having serious problems with overfitting. It easily finds a method that works for the first swerve but it can't modify itself without losing that. Maybe I need use a less naive reinforcement method, or maybe I need to add more starts to the data.

Fun seeing how close it loves riding edges though. The reward function is based off distance travelled not distance along the path.

Legend

I fixed it. Problem was my input and output generalized poorly. It couldn't learn from one corner and then directly apply that to the next. I wanted it to learn how to interpret the input and output data itself, but that was asking too much for how simple the net is.

All I needed to do was rotate the velocity output to match the car and it loops the track with ease.

Legend

Bet yall haven't seen a neural net that looks like this before.

It doesn't do anything impressive but it uses the cellular automata structure I've talked about before. Every node is connected to the 8 or less nodes around it and updated simultaneously, not in series. The green nodes are controlled by sensors and the blue nodes are sampled as output.



The structure allows the AI to have a memory and iterate as part of problem solving. On multiple occasions when I had the reward system wrong, it had the ability to come to a complete stop in the road and then resume "driving." It is not told velocity info. The 5 inputs are 5 ray distances extending forward.

Of course the big negative of this structure is that information has to physically travel and overlap other information. The two green bars on the left have to send information across to the right blue bar which controls steering. I purposely designed the shape of this network to show this isn't a deal breaker, but the green cells can be placed on the bottom and the blue cells can be placed on the top to improve it. A regular neural network is much nicer because all inputs have equal potential within the system. Also the massive massive limitation of this setup is that traditional backpropagation is impossible.


the-pi-guy

So I effectively want to:
1.) Preload future scenes
2.) When the next scene is activated, in some instances I want to be able to save the current state, to return to it afterwards.
3.) When the next scene is activated, in other instances I want to be able to simply reload the scene.

For example if you're playing Skyrim, and you go into some basement, rather than simply reloading the main floor, I want to keep into memory, along with other scenes that might possibly show up.


I'm not completely sure the best way to handle it. Some parts, I've been able to find good solutions. Other parts, I'm still not completely sure.

Legend

First off, are you sure you need to unload scenes from memory? You can disable every parent component in a scene and just keep things there like ghosts. Solves all your problems unless you can't fit it in ram.


If you need to really unload things but not lose their state, you need to set up a system for adjusting the scene after it activates but before the first update.

the-pi-guy

First off, are you sure you need to unload scenes from memory? You can disable every parent component in a scene and just keep things there like ghosts. Solves all your problems unless you can't fit it in ram.
Actually I think this is exactly what I need, thanks.

the-pi-guy

It's not really programming related, but I've noticed I tend to be a lot more concerned about software being LTS when I'm working on professional stuff.

Legend

I can't download repositories from github  :'(

The download is so slow that it cuts off. Downloading assets hosted on github however just takes a few seconds like normal. Hopefully the problem is on githubs end and goes away on its own...

Legend

Still slow but github desktop kinda works if I clone. ::)

Legend

Haha that's a new one. The "remember this device" checkbox on a website was labeled as "never challenge me on this device again."

Legend

Heck yeah! I made one of my slower dev tool functions exponentially faster!!! Literally just .001% of the time the function would previously take when handling the full dataset.

Spoiler for Hidden:
I forgot I had a few debug error checks running inside it lol.

darkknightkryta

Controller to arcade update:
So I worked my way around the evdev and have my controller being read.  I then started looking into controlling the GPIO pins aaaaaaaaannnnnnd wiringpi has been depreciated.  I've been looking into accessing the registers via LInux's memory mappers.  Fun time.  I still need to figure out how to access the spi interface though.  Luckily I found current sink registers.  I was thinking of using GPIO extenders and switching them from sink to read to register a button press. Hopefully these registers work.

Legend

Keep crashing my game. Maybe I need 128 gb of ram for development.

the-pi-guy

Jul 13, 2022, 12:11 AM Last Edit: Jul 13, 2022, 12:25 AM by the-pi-guy
Suppose you had a turn based game, with the following stipulations:

  • With two units of speed N and M, the first unit would be expected to have N turns in the same amount of time the second unit has M turns
  • Two units can't have a turn at the same time.
  • The queue must be calculated beforehand so that the player can see the queue, and the queue must be consistent.


The turn is decided by the unit's speed:
A unit that it twice as fast would go twice as many times, and similarly the faster units go before the slower ones.

The player is able to see the queue for turns, and the queue must be consistent. So the queue must be calculated a certain distance, and it needs to be recalculated at regular intervals.


the-pi-guy

Jul 13, 2022, 01:13 AM Last Edit: Jul 13, 2022, 03:57 AM by the-pi-guy
Possible solution 1:
Use the least common multiple, calculate the entire queue up to that multiple. Then for moves you simply have to enqueue, dequeue each time. 

Very good solution for small numbers, but not very scalable. If N and M were numbers like 255, 256 (2 large relatively prime numbers), you would be looking at a queue of 65,280.

Edit
4 possible solutions I've thought up and I finally have one i am happy about.

Go Up