News for hackers. Stuff that matters.

Lord_Fixer

Re:A strong_typedef library with strong operators - C++ on Monday December 11, 2023 @08:56AM (#38600651)
A (yet another) strong_typedef implementation for C++.

strong_typedefs allow you to create new types that are derived from existing ones, but are not implicitly convertible to them. This allows you to create types that are semantically different, but have the same underlying representation.

Using strong_typedefs helps in avoiding some common pitfalls, like accidentally adding a distance to a time or passing a weight to a function that expects a price (where all of could be represented by a double).

This (single-header) library also provides a convenient way of defining common operators for your new types. You can express that it makes sense to multiply a price by a quantity, while preventing the multiplication of two prices.

This website is a part of my engineering thesis. I have started creating it as a private project and just then decided to publish it. It's an online sandbox created for teachers to help them explain students how the computer's memory looks like during program execution. It provides TRE programming language, designes just for this portal. I know that this approach has some disadvantages, as I don't expect people to want to learn it, but I've had some rasons to do it this way. First, I wanted to put inside it as many programming concepts, as possible, which I wouldn't be able to do while using, for example, js. Second, and more important, I just wanted to create my own programming language, to see how it's done and to learn something new myself. To compensate that, I've decided to create series of ready to use programs, so people might just pick one and see how it works, without learnig TRE. Creating those lessons is still in progress, so there are just few available right now. The whole project is just an early version (even tho I have been working on it for a while), so some things might not work as expected, or not work at all. I wanted to share it to collect some feedback, especially that I have released a source code today on the github.
Re:Teaching AI to race using NNs and genetic algorithms on Wednesday August 31, 2016 @07:44PM (#12402283)
Yeah, sure, why not :) I will have some spare time at the weekend, so then I will try to implement evenything that has been proposed in the feedback that i've got.
Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @03:08PM (#12392970)
Yes, I did, but as you mentioned, where's fun in it? :D

When I create projects of my own I like to face some challenges that help me improve my skills. On the other hand there is work, where I use libraries and other ready stuff, as the software has to be usually deployed as fast as possible and in the highest quality. But with project like this I can take my time and just have fun :) And by fun I mean comming up with an arhitecture, code optimization, data structures (like quad tree in this example) implementation and many others.

Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @02:37PM (#12392692)
It's more like game engine, not a graphics engine. Canvas enabled me to draw basic shapes with a specific transformation. I had to implement something, that would give me a convenient way of managing them (like grouping them, or animating them - as canvas only provides a way of drawing and forgetting them). So with my code I can add an object to some scene, add children to it, transform it at the fly and move the camera. With pure canvas that also would be possible, but not as simple.
Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @02:22PM (#12392550)
After 100 generations thay actually have learned to move correctly, that's impresive. But they move very slowly. But for 100 nodes in a single hidden layer it takes them only around 10-20 generations to learn for me (not 80), and they race really fast.
Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @02:08PM (#12392425)
It might be that in the process of learning, algorithm decided, that it can pass a constant value at the speed output and use this one node just to steer.

But I'm testing this scenario right now, and all I can get are cars going on different curves. Are you sure, that you have restarted the process after making changes to the script?

Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @01:16PM (#12391949)
I might be wrong, but isn't it? I think, that in fact it is, and what you are talking about is reinforcement learning with tabu search, or something.

EDIT: Sorry, I've understood you wrong, what you are describing is, of course, not a tabu search, but still I believe that this GA is a reinforcement learning.

EDIT2: After some research I can say, that opinions are divided :D

Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @01:03PM (#12391842)
Yes, that's correct.
Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @11:39AM (#12391103)
Actually when I was designing this, I thought that it will take at least 100 generations to learn some simple moves. But NN are powerful indeed.
Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @10:04AM (#12390211)
Yeah, that might be true, and that's what this editor is for :D I didn't want to give users the best solution at the beggining, so they might search for it themselves. It's actally only the third combination of parameters that I've tested.

On the other hand 0.5 is not so large, when you look at the mutation procedure. If a speciman is going to be mutated, only 20% of it's weights are changed and only within a range [-0.1,...,0.1]. But fill free to experiment :)

Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @09:52AM (#12390082)
Thanks for sharing.

You can find here all of the code. Everything here is written (by me) from a scratch, beggining with game engine, and ending on ML algorithms. It's taken to the level where I even multiply matrixes for graphics transformation, operating on pure HTML5 canvas. So everyone should find there something interesting for him. Only editors are a great plugin for ace C9.

Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @09:41AM (#12389981)
Thanks :)

I actually have had inactivity detection implemented at some point, but I've resigned of this in favor for user-defined stop condition. But you are right, I will bring that back.

It's actually expected that in some cases it might take many generations to learn, as the population is rather small. In other attempts they can do this in like 5 generations, so please, tray to restart the whole process.

Keeping one track untill at least one car is able to finish it is not as good idea as it seems due to ovefritting. The will simply memorize all the moves depending on some insigificant factors and they won't be albe to finish any other track. I have tested that :D

Re:Teaching AI to race using NNs and genetic algorithms on Tuesday August 30, 2016 @09:32AM (#12389887)
Thanks :)

Yup, I (as a developer of this thing) haven't created a documentation yet, but it's mostly due to the fact, that I have deployed this just yesterday and there are still many things that I'd like to change in it. But I will work on that :)