Angel \”Java\” Lopez on Blog

July 11, 2017

New Month’s Resolutions: July 2017

We are in the second part of the year, a long year with interesting projects. Time to write the new month’s resolutions and review the past ones:

– Continue RskSharp [pending]
– Continue SimpleBlockchain [pending]
– Continue BlockchainSharp [complete] see repo
– Continue ChineseP [complete] see repo
– Continue TensorSharp [pending]
– Continue RSharp [complete] see repo
– Experiments with RSKJ fork [complete] see repo
– Continue Vyu [pending]
– Continue Domie [complete] see repo
– Continue Wordie [pending]

Also, I was working on:

– Start WikiExpert [complete] see repo
– Start PerProm [complete] see repo
– Start RskApi [complete] see repo
– Improve SharpGo [complete] see repo
– Improve Neurum [complete] see repo
– Improve ClojJS [complete] see repo
– Improve SimpleScraper [complete] see repo
– New Sample in SimpleGA [complete] see repo
– Start GenPrj [complete] see repo
– Start RskUtils [complete] see repo
– Start SimpleJsonRpc [complete] see repo
– Start HuskyJS [complete] see repo
– Improve Husky [complete] see repo

My new month’s resolutions:

– Continue RskSharp
– Continue SimpleBlockchain
– Continue BlockchainSharp
– Continue ChineseP
– Continue TensorSharp
– Continue RSharp
– Continue WikiExpert
– Continue SimpleGA
– Continue Neurum
– Continue HuskyJS

Stay tuned!

Angel “Java” Lopez*
http://www.ajlopez.com
http://twitter.com/ajlopez

 

 

 

 

June 24, 2015

Genetic Algorithms: Links And Resources (4)

Filed under: Artificial Intelligence, Genetic Algorithm, Links — ajlopez @ 11:14 am

Previous Post

Genetic algoritms applied to machine learning
http://www.ijcsit.com/docs/Volume%202/vol2issue5/ijcsit20110205121.pdf

Announcing gerl: Genetic Programming in Erlang
http://dan.bravender.net/2007/9/27/Announcing_gerl%3A_Genetic_Programming_in_Erlang.html

Parallel genetic algorithm in Erlang
http://personal.denison.edu/~lalla/MCURCSM2011/6.pdf

A genetic algorithm example in Erlang. | Dream Child
https://atrueswordsman.wordpress.com/2010/12/14/a-genetic-algorithm-example-in-erlang/

IEEE Xplore Abstract – Machine learning using a genetic algorithm to optimise a draughts program board evaluation function
http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=592428&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D592428

antirez/shapeme
https://github.com/antirez/shapeme

Encog Machine Learning Framework | Heaton Research
http://www.heatonresearch.com/encog

AI Programming: Noob to Pro | Game Jolt
http://gamejolt.com/community/forums/topics/ai-programming-noob-to-pro/699/

(1) Life as evolving software | Gregory Chaitin – Academia.edu
https://www.academia.edu/5799236/Life_as_evolving_software

aforge – AForge.NET Framework – Google Project Hosting
https://code.google.com/p/aforge/

IEEE Xplore – Using genetic algorithms to solve the South African school timetabling problem
http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5716348

Pragmatic Genetic Programming | Engineering Useful Surprises
http://www.vagueinnovation.com/pragmatic_gp/

My Links
http://delicious.com/ajlopez/geneticalgorithms

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

June 18, 2015

Genetic Algorithms: Links And Resources (3)

Filed under: Genetic Algorithm, Links — ajlopez @ 10:13 am

Previous Post
Next Post

Machine Learning: Genetic Algorithms in Javascript Part 2
http://burakkanber.com/blog/machine-learning-genetic-algorithms-in-javascript-part-2/

Machine Learning: Genetic Algorithms Part 1 (Javascript)
http://burakkanber.com/blog/machine-learning-genetic-algorithms-part-1-javascript/

Exact and Asymptotically Exact Solutions for a Class of Assortment Problems
http://joc.journal.informs.org/content/21/1/13

Genetic Algorithm for Dynamic Path Planning
http://deimos.eos.uoguelph.ca/sareibi/PUBLICATIONS_dr/abs-conferences/Shamli_CCECC04_R5.pdf

A Mobile Robot Path Planning Using Genetic Algorithm in Static Environment
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.165.9531

Evolutionary systems and artificial life
http://informatics.indiana.edu/rocha/alife.html

Evolution computations on C#
http://www.codeproject.com/Articles/15979/Evolution-computations-on-C

Sketch of an “artificial scientist” project
http://www.vagueinnovation.com/pragmatic_gp/sketch-of-an-artificial-scientist-project/

dolphin278 / genetic
https://github.com/dolphin278/genetic
Implementation of genetic algorithms for nodejs

Genetic and Evolutionary Computation: Medical Applications
http://www.amazon.com/Genetic-Evolutionary-Computation-Medical-Applications/dp/0470748133

The AI Revolution Is On
http://www.wired.com/magazine/2010/12/ff_ai_essay_airevolution/

Genetic Algorithm For Hello World
http://www.puremango.co.uk/2010/12/genetic-algorithm-for-hello-world/

Next generation of algorithms inspired by problem-solving ants
http://phys.org/news/2010-12-algorithms-problem-solving-ants.html

Introduction to Genetic Algorithms
http://www.amazon.com/Introduction-Genetic-Algorithms-S-N-Sivanandam/dp/3642092241

genetic-my-number
http://code.google.com/p/genetic-my-number/

Human-based computation
http://en.wikipedia.org/wiki/Human-based_computation

Curve fitting with Pyevolve
http://acodersmusings.blogspot.com.ar/2009/07/curve-fitting-with-pyevolve.html

Pragmatic Genetic Programming
http://www.vagueinnovation.com/pragmatic_gp/

My Links
http://delicious.com/ajlopez/geneticalgorithms

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

November 8, 2012

Genetic Algorithms: Links And Resources (2)

Filed under: Genetic Algorithm, Links — ajlopez @ 12:44 pm

Previous Post
Next Post

Past week, I presented my distributed genetic algorithm example (Browser, JavaScript, Node.js, Socket.IO, TCP+JSON) at @udadev (see page). Now, more links about this topic:

Gene Expression Programming: Mathematical Modeling by an Artificial Intelligence
http://www.gene-expression-programming.com/

New operator for the Traveling Salesman Problem
http://geneura.wordpress.com/2009/12/11/new-operator-for-the-traveling-salesman-problem/

A Genetic Algorithm in T-SQL
http://www.sqlservercentral.com/articles/T-SQL/69169/

Genetic Programming: Mona Lisa Source Code and Binaries
http://rogeralsing.com/2008/12/11/genetic-programming-mona-lisa-source-code-and-binaries/

orienteering problem
http://www.codeproject.com/answers/44350/orienteering-problem.aspx
how to use generic algorithm to solve Automatic Route Generation

yogthos / Clojure-Genetic-Algorithm-Example
https://github.com/yogthos/Clojure-Genetic-Algorithm-Example/blob/master/src/ga/main.clj

lancecarlson / eugene
https://github.com/lancecarlson/eugene
Evolve your programs! Eugenics applied to software

Breaking Transposition Cipher with Genetic Algorithm
http://www.ktu.lt/lt/mokslas/zurnalai/elektros_z/z79/18_ISSN_1392-1215_Breaking%20Transposition%20Cipher%20with%20Genetic%20Algorithm.pdf

Genetic Programming and a LLVM JIT for restricted Python AST expressions
http://pyevolve.sourceforge.net/wordpress/?p=2353

A Simple C# Genetic Algorithm
http://www.codeproject.com/Articles/3172/A-Simple-C-Genetic-Algorithm

Pyevolve
http://pyevolve.sourceforge.net/
Pyevolve was developed to be a complete genetic algorithm framework written in pure python.

GENETIC ALGORITHMS
http://www.obitko.com/tutorials/genetic-algorithms/

Genetic Algorithms in Plain English
http://www.ai-junkie.com/ga/intro/gat1.html

A 2D Packing Problem
http://3map.snu.ac.kr/ytoh/AcademicProjects/GeneticAlgorithm/2DPacking.pdf

Genetic Algorithms: Cool Name & Damn Simple
http://lethain.com/genetic-algorithms-cool-name-damn-simple/

Genetic Programming: A Novel Failure
http://lethain.com/genetic-programming-a-novel-failure/

Genetic algorithms, Mona Lisa and JavaScript + Canvas
http://blog.nihilogic.dk/2009/01/genetic-mona-lisa.html

The Future of Game AI: Learning to Use Human Tactics
http://gambit.mit.edu/readme/pdfs/ndowgun_thesis_2009.pdf

Gambit Game Lab
http://gambit.mit.edu/readme/index.php

My Links
http://delicious.com/ajlopez/geneticalgorithms

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

September 22, 2012

SimpleGA (1) Genetic Algorithms in Javascript/Node.js

Filed under: Algorithms, Genetic Algorithm, JavaScript, NodeJs, Open Source Projects — ajlopez @ 7:24 pm

Two week ago, I was writing:

https://github.com/ajlopez/SimpleGA

a Simple Genetic Algorithm base framework, that supports population, evaluation and mutator operators (I should add crossover operators). The base algorithm is based on

A Genetic Algorithm Tutorial (pdf)

You can create a population of genotypes, each one with an evaluation function. The library evaluates each genotypes and prepares another population, based on the value of each genotype, copying the best ones, and mutating some of the initial specimen based on fitness. The fitness value is v = fi / fa, where fi is the individual fitness evaluation, and fa is the fitness average. The integer part of v determines the count of copies of an individual that survives to the next generation. The fraction part is the probability of having a mutated copy in the next generation set of genotypes:

var newpopulation = [];

for (var k = 0; k < l; k++) {
	if (values[k] < 0)
		continue;
		
	var fitness = values[k] / total;
	
	if (fitness < 0)
		continue;
		
	var ntimes = Math.floor(fitness);
	var fraction = fitness - ntimes;
	
	for (var j = 0; j < ntimes; j++)
		newpopulation.push(population[k]);
		
	if (fraction > 0 && Math.random() <= fraction)
		newpopulation.push(population[k]);
}

if (mutators && mutators.length > 0) {
	l = newpopulation.length;
	var lm = mutators.length;
	
	for (k = 0; k < l; k++) {
		var mutator = mutators[Math.floor(Math.random() * lm)];
		newpopulation[k] = mutator.mutate(newpopulation[k]);
	}
}

(I should add crossover operator support). There is a sample implementing the Travelling Saleman Problem

https://github.com/ajlopez/SimpleGA/blob/master/samples/tsp/tsp.js

running in console using https://github.com/ajlopez/SimpleGA/blob/master/samples/tsp/program.js

It can run from the console, or you can launch a local web page:

https://github.com/ajlopez/SimpleGA/blob/master/samples/tsphtml/index.html

I wrote client/server version (web page at browser, Node.js server program) and a distributed version (the evaluation of many population running in many server nodes, coordinated by a Node.js server, showing results in a browser).

Next steps: add crossover operators, sample short descriptions, more samples.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

September 21, 2012

Genetic Algorithms: Links and resources (1)

Filed under: Genetic Algorithm, Links — ajlopez @ 2:22 pm

These days, I wrote a simple genetic algorithm in Javascript, runing at browser, and at server (Node.js), even with distributed load (see https://github.com/ajlopez/SimpleGA) I should write a post about that code (my previous posts with experiments in C#), but first, I want to share some of my genetic algorithm links:

http://en.wikipedia.org/wiki/Genetic_algorithm

In the computer science field of artificial intelligence, a genetic algorithm (GA) is a search heuristic that mimics the process of natural evolution. This heuristic is routinely used to generate useful solutions to optimization and search problems. Genetic algorithms belong to the larger class of evolutionary algorithms (EA), which generate solutions to optimization problems using techniques inspired by natural evolution, such as inheritance, mutation, selection, and crossover.

Robocode with JGAP
http://jgap.sourceforge.net/doc/robocode/robocode.html

Andy’s Genetic Programming- GPQuick and Doodle Garde
https://www.assembla.com/wiki/show/bhmk_e1jWr3zqkab7jnrAJ/bhmk_e1jWr3zqkab7jnrAJ

Genetic Algorithms: Cool Name & Damn Simple
http://dev.lethain.com/genetic-algorithms-cool-name-damn-simple/

Local Optimization Software
http://www.mat.univie.ac.at/~neum/glopt/software_l.html

E-Book "Global Optimization Algorithms — Theory and Application"
http://www.it-weise.de/projects/
This book elaborates on many of the basic principles in global optimization, Evolutionary Algorithms, and Genetic Programming.

Evolvable Hardware
http://pages.cpsc.ucalgary.ca/~jacob/Courses/Winter2003/CPSC601-73/Slides/10-EvolvableHardware.pdf

Genetic A/B Testing with JavaScript
http://ejohn.org/blog/genetic-ab-testing-with-javascript/

Introduction to Genetic Algorithms
http://www.rennard.org/alife/english/gavintrgb.html
Genetic Programming: Evolution of Mona Lisa
http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/

Time for Genetic Programming?
http://blog.assembla.com/assemblablog/tabid/12618/bid/5680/Time-for-Genetic-Programming.aspx

Help! My Product Development is Going TOO FAST
http://blog.assembla.com/assemblablog/tabid/12618/bid/2448/Help-My-Product-Development-is-Going-TOO-FAST.aspx
Use evolution: We can build a machine that evolves the product by user-testing variations.

Discipulus 5 Genetic Programming Predictive Modelling
http://www.rmltech.com/
Genetic Algorithm Library
http://www.codeproject.com/Articles/26203/Genetic-Algorithm-Library

A FIELD GUIDE TO GENETIC PROGRAMMING
http://www.gp-field-guide.org.uk/

Genetic Algorithms
http://www.aiai.ed.ac.uk/technology/geneticalgorithms.html

An Introduction to Genetic Algorithms In Java
http://java.sys-con.com/node/36224

Survival of the Fittest: Natural Selection with Windows Forms
http://msdn.microsoft.com/en-us/magazine/cc163934.aspx
What is Genetic Programming?
http://www.genetic-programming.com/gpanimatedtutorial.html

Genetic Algorithms
http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol4/tcw2/report.html

Global Optimization Toolbox
http://www.mathworks.com/products/global-optimization/index.html

Travelling salesman problem
http://en.wikipedia.org/wiki/Traveling_Salesman_Problem
GAlib
A C++ Library of Genetic Algorithm Components
http://lancet.mit.edu/ga/

My Links
http://delicious.com/ajlopez/geneticalgorithms

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

February 7, 2010

Genetic Algorithms using GoRoutines and Channels in C#

Filed under: .NET, C Sharp, Genetic Algorithm — ajlopez @ 10:39 am

More than a year ago, I wrote:

Genetic Algorithms with AjAgents and Concurrency and Coordination Runtime (CCR)

exploring concurrency in the implementation of Travelling Salesman Problem using a genetic algorithm. At the end of past year, I wrote an example, using the ideas implemented in:

GoRoutines and Channels in C#

The code is in the AjConcurr.Tsp project at:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/AjConcurr

This is the result (not a great interface… ;-):

TSP is not a good problem to resolve using Genetic Algorithm: the result depends of the improvement of population after each iteration. My implementation uses a mutation algorithm that tries to generate better individuals (a fair algorithm should only mutate). The code is written in a big method, under the Run button click, only for demo purpose.

At the beginning, I define the channels:

            Channel genomas = new Channel();
            Channel evaluated = new Channel();
            Channel bestsofar = new Channel();
            Channel mutator = new Channel();

Remember: you can put a value (object) in a channel, and in another thread, you can get that value. If you put a value in a channel, and no thread is reading the channel, your thread is blocked. If you read a value from a channel, and no value is present, your thread is blocked. In this way, producers and consumers are synchronized.

Evaluated channel receives individuals (solutions to the problem) and collects it, forming a new population. The best individual is send to bestsofar channel, that keeps the best individual found in process. Genomas channel receives an individual, evaluate its fitness, and forward it to Evaluated channel. Mutator receives a genoma, mutates and evaluates it. The new genoma is forwarded to Evaluated channel.

Many populations are processed in parallel. More accurate: there is no population, there are N * M individuals that are processed, mutated, and collected. For each group of N collected individuals, the best are selected, and a new group of N individuals are injected again in the process.

This is the code. First, launch a goroutine to generate the initial populations:

// Generates the initial populations
GoRoutines.Go(() =>
{
    Genoma genoma = GenerateGenoma();
    for (int j = 0; j < PopulationSize * 10; j++)
    {
        genomas.Send(this.Mutate(genoma));
    }
});
 

Launch a goroutine to evaluate new genomas:

// Evaluate genomas
GoRoutines.Go(() =>
{
    while (true)
    {
        Genoma genoma = (Genoma)genomas.Receive();
        genoma.value = this.CalculateValue(genoma);
        evaluated.Send(genoma);
    }
});

A goroutine to collect genomas, select them, and generate a new group, population:

// Collect and select
GoRoutines.Go(() =>
{
  GenomaComparer comparer = new GenomaComparer();
    while (true)
    {
    List<Genoma> genomalist = new List<Genoma>();
    for (int k = 0; k < PopulationSize; k++)
    {
      Genoma genoma = (Genoma)evaluated.Receive();
      genomalist.Add(genoma);
    }
    genomalist.Sort(comparer);
    GoRoutines.Go(() => bestsofar.Send(genomalist[0]));
    for (int k = 0; k < PopulationSize / 5; k++)
      GoRoutines.Go(() => evaluated.Send(genomalist[k]));
    for (int k = 0; k < PopulationSize / 5; k++)
    {
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
    }
    }
});

A goroutine for receives genomas, improve them, and forwards them to evaluated channel:

// Mutates
GoRoutines.Go(() =>
{
    Random rnd = new Random();
    while (true)
    {
    Genoma genoma = (Genoma)mutator.Receive();
    Genoma newgenoma = this.Mutate(genoma);
        while (newgenoma.value >= genoma.value)
        {
            if (rnd.Next(3) == 0)
                break;
        newgenoma = this.Mutate(genoma);
        }
        evaluated.Send(newgenoma);
    }
});

A goroutine to receives and process the best-so-far indivuals:

// Receives and draws the results
GoRoutines.Go(() =>
{
    Genoma best = null;
    while (true)
    {
        Genoma genoma = (Genoma)bestsofar.Receive();
        if (best == null || best.value > genoma.value)
        {
            best = genoma;
            this.BestGenoma(genoma);
        }
    }
});

I didn’t write support for crossover, but it could be added. The problem and algorithm could be changed. The main idea of this spike is to show the parallel implementation of a genetic algorithm.

The main problem is in the evaluated channel reading and processing. In that step, the goroutine forwards values to many channels. I had to launch many goroutines to feed the channels, because if one of these is blocked, the full process were blocked.

Next step: implement and use Queue Channels as in:

Implements actor model, and put each step in an agent. And then, implement distributed agents.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

Blog at WordPress.com.