exouxas / fosterscript.core Goto Github PK
View Code? Open in Web Editor NEWA flexible NEAT-based neural network library for .NET, empowering intelligent agents in research, games, and AI simulations.
License: MIT License
A flexible NEAT-based neural network library for .NET, empowering intelligent agents in research, games, and AI simulations.
License: MIT License
The logic for when an Actor needs to sense something or act on something in a World.
Need to figure out a smart way to do dependencies. The idea was to have a list of the Dependency class, but this seems weird as it's abstract and means we'd need to add an instance of a complete module for it to work. Maybe a list of classes instead, and versions that go with them?
I would like for the project to be able to use GPU-optimized calculations. Mainly for when you make a hidden node, but possibly also for improving the performance of the future "position based optimization" that will be added to worlds in #15
We need to create a list of .NET versions to compile with. I want this project to be compatible with at least the following:
Any other versions will be kept up to date until it becomes too annoying to do so.
There are also vague plans to convert this project to C++ or something that might improve performance.
Need to make a way to test the different features of this lib. Not sure how yet, but it will be detailed here.
The project should have tests created for as many testable cases as possible to make sure everything is functional.
Both IndefiniteWorld and FiniteWorld trigger an extra step after they're stopped. They should not.
Contains a list or lists of nodes, and calculates these. Nodes contain a "Calculate" and a "Propagate" method, these will be in Brain.cs too, and will start a propagation process and a calculation process. Both will be threaded, but the methods will be synchronized to make using them easier (calling Propagate() should act the same as if it wasn't threaded, but have the
An Actor.cs with a Brain.cs in it.
An instance of this contains several Actors (which can be Learners in the future, as Actor is the superclass of Learner), and allows for those Actors to interact with and perceive their surroundings. Will run without an integrated clock cycle, and instead finish ASAP. If it's very similar to IndefiniteWorld.cs, then some functionality should either be moved over to World.cs or be implemented directly from IndefiniteWorld.cs through inheritance.
Allows an inheriting class to be dependent on in other classes. This is to make the dynamic loader possible without crashing if one file is missing.
Current structure:
I'd like to separate the namespaces into somethinglike this:
So to fix this I need to figure out the following:
Although it's very nice to make an up-to-date example while making the framework, it's likely going to get messy if there are many examples.
Here are a few different ways of structuring the World
related classes (and potentially probably interfaces). World
will optimize Actor calculation by limiting operations based on proximity. At first I think it should just be made the simplest way possible with no optimization, but careful thought should be used for how to structure it still as this project definitely needs optimization later. Optimization will be done in #15.
Storing position values could use one of three strategies:
Actor
.Module
included in an Actor
.World
.Actors should not need to have a position. Other applications may use this neural network, which might not need positions, so forcing every actor to have a position would be wrong. Position related calculation optimization would not work if all actors were on the same point, but creating this optimization would only be relevant if the actors need a position.
When using the module approach, removing the module to remove the positions would be easy. Still, it might break the code depending on how the calculation optimization is written.
However, using the third option, where positions are stored in the world, then the world will define everything position related. And the modules for movement etc., would either need to be extra generic or maybe even written inside the world class used.
When a world calls on the actors' methods to think and act, the actor can have a property that tells the world how long its sensory and motor/acting range is. This would make it possible for the world to decide which actors can perceive or act on other actors. Greatly expands the possibility for custom world systems.
Using the module strategy would align with the project's original vision, but this could be more challenging. On the other hand, using the direct property strategy would be incredibly easy but would not align as well with the direction this project is heading.
The third option seems more and more in line with the vision of the project. This will be attempted, and the result will decide wether or not it's a good method.
An instance of this contains several Actors (which can be Learners in the future, as Actor
is the superclass of Learner
) and allows those Actors to interact with and perceive their surroundings. It will have an integrated clock cycle, run on a thread, and not have a definite time to stop. The FiniteWorld.cs class will be the altered version of this that runs X cycles, specified in #11.
This structure has World
as a superclass that implements a container for the Actors
.
flowchart LR
world[World]
worldf[FiniteWorld]
worldi[IndefiniteWorld]
worldi-->world
worldf-->world
World
could have the methods Think()
and Act()
, which would trigger its inhabitants' respective methods.
Although having a third dimension would increase computation time when it might not be needed, for example, if you're only using two of the dimensions, it would make it a lot easier to just force all positions to always be in 3d, so we will do this.
The serialization implementation adds a bunch of warnings. Attempt to get rid of them:
Add events for the following:
Allows an inheriting class to be dependent on in other classes. This is to make the dynamic loader possible without crashing if one file is missing.
An Actor.cs with a Brain.cs in it basically.
There needs to be a way for Module
to access their actors position. Consider some different approaches, and implement the best suited one.
Some options:
Actor
that gets the position from the World
it's contained in._world
field public.Considering that I would like to change World
into not having positions stored, and instead have a subclass for positioning, the following are the drawbacks of each approach:
Actor
that gets the position from the World
it's contained in: Having tight coupling wouldn't work, as not every Actor
would be in a world with positions for its actors._world
field public: I believe this would only cause issues within a Module
if the referenced world doesn't cast to a world subclass with positioning.Both of these approaches could be fixed by making a subclass of Actor
, and implementing one of the suggested approaches. Might be an idea to also create a subclass of Module
in this case.
The IndefiniteExample.cs file creates all actors and fills them with the correct modules, but running the world.Start()
method doesn't make it actually run.
It seems like something might be wrong with the timer inside the IndefiniteWorld class.
Create GitHub action to automatically compile the code that gets committed to the main branch, or when a pull request is made to the main branch.
For this package to be compatible with Unity, it apparently needs to compile to .NET Standard 2.1.
Use the Roslyn runtime compiler to load modules during runtime
There's definitely some improvement to be done on the folder structure of the project. When building and packaging, it outputs to ./src/Core/*
while it should probably output to ./
.
Takes functionality from the Module subclasses added to its module "reservior". Needs to be able to function in a World.
The logic for when an Actor needs to sense something or act on something in a World.
The basis for both IndefiniteWorld.cs and FiniteWorld.cs. Needs more description I think.
An instance of this contains several Actors (which can be Learners in the future, as Actor is the superclass of Learner), and allows for those Actors to interact with and perceive their surroundings. Will have an integrated clock cycle, run on a thread, and not have a definite time to stop. The FiniteWorld.cs class will be the altered version of this that runs X cycles.
When adding modules using the method that adds single modules, it doesn't check if the module has all its needed dependencies. In addition to this, if it can't initialize, it will never be initialized.
Basically create a set of neurons or a neuron that can mimic any other neuron, and let it decide whether it needs to calculate or not, maybe disable all following neurons' calculations for one step.
Disabling the following neurons could be difficult or problematic, since this neural net will have the possibility of backpropagation.
Has to be discussed more before working on it, but keep the thought vaguely in mind while designing the brain system.
The World class needs a way to grab all actors within a specified range for when implementing a sensing module for actors.
This does not have to be optimized, as optimization will be done in #15
A way for actors to effectively know what other actors are nearby to perceive or act on.
The World
classes will be made without this optimization first, and later upgraded using this issue.
The idea is to create a class that acts as a collection, where each entity is forced to have some sort of position. It uses this position data to effectively store the locations of all the entities and has methods for grabbing all entities within a radius of another entity.
Refs:
https://programming.guide/robin-hood-hashing.html
https://www.nuget.org/packages/Faster.Map#readme-body-tab
https://doc.cgal.org/latest/Orthtree/index.html#Chapter_Orthtree
When checking for dependencies, use HashSet instead of Dictionary—supposed to be faster. Won't make a difference if all agents have the same modules all the time, but if the amount of modules is variable per actor basis, it should help with the performance.
The file was meant to show how to use the library, but now that there will be an example repo, this might not be needed.
If it's still needed, fill the entire description
Takes functionality from the Module child classes added to its module "reservior". Needs to be able to function in a World.
Before publishing the repo, clean up the code and repo.
An instance of this contains several Actors (which can be Learners in the future, as Actor is the superclass of Learner), and allows for those Actors to interact with and perceive their surroundings. Will run without an integrated clock cycle, and instead finish ASAP. If it's very similar to IndefiniteWorld.cs, then some functionality should either be moved over to World.cs or be implemented directly from IndefiniteWorld.cs through inheritance.
Correcting position using MoveTo can be complex or, worse, recursive. Add a way to set bounds of the World class, with features for both boundaries blocking or repeating as an option.
Contains a list or lists of nodes, and calculates these. Nodes contain a "Calculate" and a "Propagate" method, these will be in Brain.cs too, and will start a propagation process and a calculation process. Both will be threaded, but the methods will be synchronized to make using them easier (calling Propagate() should act the same as if it wasn't threaded, but have the calculation(s) have the benefit of threading)
Needs more info. Tricky to deal with event subscriptions and child classes that can be in multiple parent classes.
I haven't looked enough into this, but I would like there to be a workflow that automatically makes a NuGet package of this library whenever there's a new version. Maybe with automatic versioning?
I'll have to research how others do it to see what is common.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.