PROGRAMMING WITH PYTHON. First Test Results with Fixed-Rule and Random-Rule Actors

emerging-mind.org eJournal ISSN 2567-6466
Email: info@emerging-mind.org
3.Dec 2017
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

Contents

1 Discussion… 2
1.1 Expectations . . . . . . . . . . . . . . . . . . . . . . . . . . .2
1.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Consequences . . . . . . . . . . . . . . . . . . . . . . . . . .4
2 Data Fixed-Rule Actor… 4
2.1 EXPERIMENT 1 …4
2.2 EXPERIMENT 2 …5
2.3 EXPERIMENT 3 …5
2.4 EXPERIMENT 4 . ..5
3 Data Random-Rule Actor..10
3.1 EXPERIMENT 1 . . .10
3.2 EXPERIMENT 2 . . .10
3.3 EXPERIMENT 3 . . .10
3.4 EXPERIMENT 4 . . . .10

Abstract

A first series of tests have been realized with fixed-rule actors and
random-rule actors. The results show, that there is no clear correlation
between the mean amount of energy and the death-rate of an actor
(-0.78 fixed rule Actor), (-0.71 random rule actor). Between the death-rates of both actors we have a correlation of -0.18, and between the
mean energy of both actors a little bit positive correlation of 0.05.

1 Discussion

A first experiment has been realized with the version of the program named ae6-2-6-main.py.

This program offers the following options for the user:
1. Which kind of behavior (fixed-rule, random-rule)
2. Size of grid (n x n)
3. Percentage of obstacles in the grid (default is 20)
4. Percentage of food in the grid (default is 5)
5. Amount of cycles for one run
6. Amount of repetitions of runs
7. Debug mode (clicking with the mouse after every step) or not
8. Duration of sleeping between steps (if no debug mode)(0 – 5 sec)
9. Manual or random determination of start position

The output is a graph showing the mean energy consumed, the death
rate per run, the percentage of energy level per run, the percentage of
obstacles and food to the grid area.

All these options of the program have been tested. Everything worked
fine. Only in the complete automatic mode (with automatic start positions)
the program crashed with spyder in the case of the random rule actor.
Repeating these tests directly from the Linux-Shell with the directory
path ’ /Dokumente/EMP/SW/PY-PROGRAMS/A-E-6-2$’ and the command ’python3 ae6-2-6-main.py’ everything worked fine. No problems. Thus it seems that the error is an artifact caused by the spyder-software.

1.1 Expectations

In this experiment the following options have been activated:

1. Either behavior type 1 or 2
2. Using the grid sizes 7 – 9 – 11 – 15
3. In parallel using the amount of cycles with 50 – 70 – 90 – 130
4. In all cases 10 repetitions
5. No-Debug, Sleep-time 0 sec, automatic determination of start position.
6. For every type of behaviour with a certain amount of cycles the experiment has been done 3 times.

With these assumptions does the abbreviation ’T1-7-50-10-R1’ mean
that this experiment used type 1 of behaviour, grid-size was 7×7, amount of cycles was 50 with 10 repetitions, and this was experiment 1 of three.

In case of the fixed-rule actor the amount of the death-rate depends directly from the fact, that the right-hand rule allows a path, where there is no single food object. The size of the grid and the percentage of objects and food does not matter. The only influence can be that the positive paths can have until 4 food interactions; this can increase the amount of mean energy.

In the case of the random-rule actor the death-rate depends from the
fact, that a random path is completely open. Even if a random actor hits
lots of food-objects this does not guarantee a death-free path. The only
influence can be that the length of the path increases the probability to hit
a food object.

1.2 Results

The results show, that there is no clear correlation between the mean
amount of energy and the death rate of an actor (-0.78 fixed rule Actor),
(-0.71 random rule actor). This confirms the expectation above.
Between the death rates of both actors we have a correlation of -0.18,
and between the mean energy of both actors a little bit positive correlation
of 0.05. That there are slight correlations between the death-rates of both
actors and even more between the mean energies is also confirming the
expectations. Because both actors depend from the same configuration
and where the proportion between objects and food is stable with regard
to the whole grid it is only the length of the path which varies, and this can
increase the amount of energy while the death-rate keeps its uncertainty.

 

1.3 Consequences

This simple setting demonstrates that an input output system whose only
interactions with the environment are fixed or random movements which occur independent of the actual context as well as interaction with food when the actor hits the food directly is highly uncertain in its overall outcome.

To improve the success of an actor one has to provide some kind of an
internal representation of the environment inside the actor in a way which
allows an exploitation of those properties of the environment which support more success in terms of energy and low death-rates.

Another dimension could be the generation of offspring under certain
successful runs. Offspring would generate some kind of a population which
implies new kinds of constraints.

DATA

For the data sets read the attached PDF.

PROGRAMMING WITH PYTHON. Milestone 0. Actor-Environment Baseline

emerging-mind lab (EML)
eJournal ISSN 2567-6466
29.Nov. 2017
info@emerging-mind.org
Author: Gerd Doeben-Henisch
EMail: gerd@doeben-henisch.de
FRA-UAS – Frankfurt University of Applied Sciences
INM – Institute for New Media (Frankfurt, Germany)

ZIP-FOLDER

SUMMARY

This small software package is a further step in the exercise to learn python3 while trying to solve a given theoretical problem. The logic behind this software can be described as follows:

  1. This software shall be an illustration to a simple case study from the uffmm.org site. The text of the case study is not yet finished, and this software will be extended further in the next weeks/ months…
  2. The base-version of this software offers the user a menu-driven start to define  a simple test-environment where he can investigate the behaviour of (yet) simple actors. At the end of a test run (every run can have n-many cycles, there can be m-many repetitions of a run) a simple graphic shows the summarized results.
  3. The actual actors are without any kind of perception, no memory, no computational intelligence, they are completely driven either by a fixed rule or by chance. But they are consuming energy which decreases during time and they will ‚die‘ if they can not find new energy.
  4. A more extended description of the software will follow apart from the case study as well as within the case study.
  5. The immediate next extensions will be examples of simple sensory models (smelling, tasting, touching, hearing, and viewing). Based on this   some exercises will follow with simple memory structures, simple model-building capabilities, simple language constructs, making music, painting pictures, do some arithmetic. For this the scenario has to be extended that there are at least three actors.
  6. By the way, the main motivation for doing this is philosophy of science: exercising the construction of an emerging-mind where all used parts and methods are know. Real Intelligence can never be described by its parts only; it is an implicit function, which makes the ‚whole‘ different  to the so-called ‚parts‘. As an side-effect there can be lots of interesting applications helping humans to become better humans 🙂 But, because we are free-acting systems, we can turn everything in ins opposite, turning  something good into ‚evil’…

PROGRAMMING WITH PYTHON ubuntu 14, Windows10, ubuntu 16. Build the Environment. Part 2

emerging-mind lab (EML)
eJournal ISSN 2567-6466
31.Oct – 2.Nov 2017
info@emerging-mind.org
Gerd Doeben-Henisch
gerd@doeben-henisch.de
FRA-UAS – Frankfurt University of Applied Sciences
INM – Institute for New Media (Frankfurt, Germany)
November 2, 2017

Contents

1 Why an Update (of ubuntu 14.04)? 2
2 Download And Install Ubuntu 14.04 3
3 Prepare The SW Environment 3
4 Terminal, Packet-Manager ’Synaptic’ 4
5 Manage Programs 5
6 Type Setting with TEXStudio 5
7 File-manager ’Krusader’ 6
8 Open Office Suite (e.g. for Drawing) 6
9 Simple Editor ’gedit’ 8
10 Screen-shots with ’shutter’ 8
11 Image Post-Processing with ’gimp’ 8
12 Python2+3, spyder3
13 Recording with the ’simplescreenrecorder’ 10
14 Video-Streamer ’vlc’ 11
15 Speech Synthesis with ’espeak’ and ’pyttsx’ 11
16 Ubuntu 14 and Windows 10 as Environment for Python3 12
17 Opting for ubuntu 16.04 besides ubuntu 14.04 12
18 Rebuild the Environment with ubuntu 16.04 13

OVERVIEW

The original plan was, to set up under ubuntu 14.04 a program-
ming environment which can use python3, spyder3 and as additional
software a speech-synthesis software like pyttsx. While everything
worked fine (see the first part of this article), it came to a ’show down’ when trying to combine python3 under ubuntu 14.04 with spyder3 and pyttsx3. All trials to overcome the problem led to new problems (see below). Finally I decided to give up the axiom of having ubuntu 14.04 on account of ros (robot operating system), because the primary tool is in this phase the programming language python. Python offers a ’universe of concepts’ on its own. And, who knows, there will be a day where ros will work with ubuntu 16.04 too :-). Then I installed ubuntu 16.04 (as upgrade from the internet) and checked the combination of python3, spyder3 and pyttsx3. It worked.

The pages 1-15 of the article describe a first update still using
ubuntu 14.04. Then it came to the crash when trying to combine python3 + spyder3 + pyttsx3. This led to the upgrade to ubuntu 16.04 and the new story. Before it came to the upgrade there was an important interaction with windows 10 helping to understand some limits and possibilities.

For more Details see:

Programming with Python. Part 6. First Demo Extended

emerging-mind.org
eJournal ISSN 2567-6466
(info@emerging-mind.org)
Author: Gerd Doeben-Henisch
gerd@doeben-henisch.de

ZIP-SW

VIDEO

Abstract

Part 4 was the first Milestone. For details see that document. In part 5 only small modifications and extensions happened.

Modifying Control Window Calls

There is only one simple call to start the control window without any other functions, this is ctrlWinStart(). All other calls do operate on features of the control window.

Extending Control Options With Percentage of Objects

A new control feature has been introduced: asking for the percentage of objects to be placed in the environment: ctrlWinLocateAct(winC). This allows a number between 1-100. The percentage of food-objects is still kept fixed with ’nfood = 1′.

The Whole Story Now

  1. A 7 x 7 grid is offered with empty cells.
  2. The user is asked for the percentage of objects in the environment (nobj) which shall randomly be distributed (black cells).
  3. 1% of cells is randomly occupied by food (i.e. here one cell) (green cell).
  4. The start position of an actor (red circle) can be selected by pointing into the grid.
  5. The number of cycles can be entered how often the environment shall be repeat the event loop.
  6. The type of behavior function of the actor can be selected: manually (:= 0), fixed (:= 1) as well as random (:= 2). With option 1 or 2 the demo is running by its own. With option 0 you have to select the next direction manually by clicking into the grid.
  7. While the demo is running it reports the actual energy level of the actor as well as the actual ‚Time of the environment‘ (which corresponds closely to the number of cycles).
  8. If either the maximum number of cycles is reached or the energy of the actor is below 0 the application will stop and after clicking into the grid  vanishes from the screen.

Asking for Percentage of Objects

ae5-Control Window asking for Percentage of Obstacles in Environment
ae5-Control Window asking for Percentage of Obstacles in Environment

Asking for Number of Cycles

AE5 - Control Window Asking for Number of Cycles to Run
AE5 – Control Window Asking for Number of Cycles to Run

ASKING FOR POINTING INTO THE GRID TO LOCATE ACTOR

AE5 - Control Window askeds to point into Grid to locate the actor
AE5 – Control Window askeds to point into Grid to locate the actor

Showing Env With Obstacles and Food

AE5 - Control Window Showing Actual Distribution of Obstacles (black), Food (green), as well as an Actor (green)
AE5 – Control Window Showing Actual Distribution of Obstacles (black), Food (green), as well as an Actor (green)

Select Behavior Type

AE5 - Control Window asking for Wanted Behavior Type of Actor (0-2)
AE5 – Control Window asking for Wanted Behavior Type of Actor (0-2)

Final Stage

AE5 - windows shows Grid with final state
AE5 – windows shows Grid with final state
AE5 - Control Windows Comments Final Stage with no moe Energy for Actor
AE5 – Control Windows Comments Final Stage with no moe Energy for Actor

The Importance of Freedom and Creativity

Although this environment is very simple, it can demonstrate a lot of basic ‚verities‘. It shows directly the inappropriateness of a fixed behavior even in a static environment. This implies that a non-fixed behavior realized as a random behavior is in principle strong enough to find a solution (if there is any). Whether a solution is possible or not depends from the available time which in turn depends form the available energy.

If one interprets‚random behavior‘ as a behavior based on freedom and creativity then one has here a strong motivation that a society based on freedomand creativityhas (other ‚bad‘ factors neutralized) the best chances to master an unknown future.

How to Continue

You can continue with Part 1 ‚How to Program with Python under ubuntu 14.04?‘

Programming with Python. Part 5. From Windows to Linux

emerging-mind.org
eJournal ISSN 2567-6466
(info@emerging-mind.org)
Gerd Doeben-Henisch
gerd@doeben-henisch.de
October 20, 2017

In the parts 1-4 it has been explored how it is possible to program under Windows 10  in python a small test project within an  actor-anvironment framework. It worked.

In part 5 it will be tested, whether and how one can transfer the sources from part 4 to the platform ubuntu 14.04.

After some searching of different options it revealed to be very straightforward: open a linux console and enter the command:

sudo apt-get install spyder3

This installs the same spyder version as for Windows 10 including python 3.4.3 with all the libraries, including numpy. The only thing one has to do manually is to download again the graphics.py module from John Zelle (you can find it with google-search for a direct download).

Continue to part 6

Programming with Python. Part 4. First Demo complete

emerging-mind.org
eJournal ISSN 2567-6466
(info@emerging-mind.org)
Gerd Doeben-Henisch
gerd@doeben-henisch.de
October 20, 2017

PDF

ZIP-SW

1 First Milestone Reached

The basic idea from the beginning was to check whether it is possible to
program in python a simple actor-environment demo with a graphical user interface (GUI).

During the parts 1-3 it could be proved step wise that all the wanted
features could be realized.

Clearly the actual code is far from being elegant nor is he completely
explained. But everybody can inspect the code delivered as a ZIP-folder.

This first GUI-based demo contains the following features:

1. A 7 x 7 grid is offered with empty cells.
2. 20% are randomly occupied by obstacles (black cells).
3. 1% of cells is randomly occupied by food (i.e. here one cell) (green
cell).
4. The start position of an actor (red circle) can be selected by pointing
into the grid.
5. The number of cycles can be entered how often the environment shall
be repeat the event loop.
6. The type of behavior function of the actor can be selected: manually
(:= 0), fixed (:= 1) as well as random (:= 2). With option 1 or 2 the
demo is running by its own. With option 0 you have to select the next
direction manually by clicking into the grid.
7. While the demo is running it reports the actual energy level of the actor
as well as the actual ’Time of the environment’ (which corresponds
closely to the number of cycles).
8. If either the maximum number of cycles is reached or the energy of
the actor is below 0 the application will stop and after 10 s vanish from
the screen.

2 How to Continue

There are many options how to continue. Actually the following ones are
considered:

ACTOR-ENVIRONMENT FEATURES

1. Enhance the actual version with with e.g. offering the selection of
more parameters to be eligible.
2. Allow multiple actors simultaneously.
3. Allow the automatic repetition of a whole experiment over n-times.
4. Allow storing of results and statistical evaluations.
5. Start explorations of different behavior functions like genetic algorithms,
classifiers, reinforcement, learning similar to alpha go zero,
etc.
6. Enhance perceptual structures and motor patterns.
7. Check different cognitive architectures
8. Enable basic dialogues with the environment
9. …

COMPUTING FEATURES

1. Transfer the windows implementation on ubuntu 14.04 too.
2. Compare the different versions.
3. Integrate the actor-environment pattern within the ros-architecture
4. Allow real-world sensors and actors especially for robotics, for sound
art work, for picture art work, for sculpture art works as well as for text
art work)
5. Rewrite the actor-environment demo as a distributed process network.
6. Realize a first demo of a Local Learning Environment
7. …

Continue to part 5