STARTING WITH PYTHON3 – The very beginning – part 8

Journal: uffmm.org,
ISSN 2567-6458, July 24-25, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:
gerd@doeben-henisch.de

CONTEXT

This is the next step in the python3 programming project. The overall context is still the python Co-Learning project.

SUBJECT

See part 7.

SZENARIO

Motivation

See part 7.

On this part 8 I focus on the dynamic part of the virtual world. Which kind of changes are possible and how they can be managed?


  1. Virtual World (VW) – General Assumptions
    See part 7.

    ACTOR STORY

    1. After completing a 2D virtual world with obstacles ‘O’, food objects ‘F’ and actors ‘A’, the general world cycling loop will be started. In this loop all possible changes will be managed. The original user has no active role during this cycling loop; he is now in the role of the administrator starting or stopping the cycling loop or   interrupt to get some data.
    2. The cycling loop can be viewed as structured in different phases.
    a) In the first phase all general services will be managed, this is the management of the energy level of all objects: (i) food objects will be updated to grow and (ii) actor objects will be updated by reducing the energy by the standard  depending from time. If energy level is below 0 then the avatar of the actor will be removed from the object list as well as from the grid.
    b) In the second phase all offered actions will be collected. The only sources for actions are so far the actors. There can either be an  (i) eat-action, if they dwell actually on a position with food, or (ii) they can make a move.
    (i) In case of an eat-action  the actor sends a message to the action buffer of the world: [ID of actor, position, eat-action]
    (ii) In case of a move-action the actor sends a message to the action buffer of the world: [ID of actor, position, move-action, direction DIR in [0,7]].
    3. The world function wf will randomly select each action message one after the other and process these. There are the following cases:
    (a) In case of an eat-action it will be checked whether there is food at the position. If not nothing will happen, if yes then the energy level of the eating actor will be increased  inside the actor and the amount of the food will be decreased. There is a correspondence between amount of food and consumed energy.
    (b) In case of a move-action it will be checked whether there is a path in the selected direction to move one cell. If not, then nothing will happen, if Yes, then the move will happen and the energy level will be decreased by a certain amount due to moving.
    3. After finishing all services the world clock WCLCK will be increased by one (Remark: in later versions it can happen that there exist actions whose duration needs more than 1 cycle to become finished).

IMPLEMENTATION

vw3.py (Main File)

gridHelper.py (Import module)

EXERCISES

One new aspect is the update of the food objects which ‘refresh’ their amount and with this amount their energy depending from the time. Here it is a simple time depending increment. In later versions one can diffeentiate between different foods, differen surounding conditions, etc.

def foodUpdate(olF,objL):

for i in range(len(olF)):        #Cycle through all food objects
if olF[i][3][1]<objL[‘F’][1]: #Compare with standard maximum
olF[i][3][1]+objL[‘F’][2]     # If lower then increment by standard
return olF

The other task during the object update is the management of the actor objects with regard to their energy.  They are losin energy directly depending from the time and in case of movement. During the simulation actors can increase their energy again by eating, but as long this does not happen their energy loss is continuously in every new cycle. This can lead to the extreme situation, where an actor has reached an energy zero state (<1).  In this case the actor will be removed from the grid (replacing its old position ‘A by an empty space ‘_’). Simultaneously this actor shall be removed from the list of all actors olA.

def actorUpdate(olA,objL,mx):
   for i in range(len(olA)):                             #Cycle through all actor objects
   olA[i][3][1]=olA[i][3][1]-objL[‘A’][2] #Decrement the energy level by the   standard

# Check whether an element is below 1 with its energy
iL=[y for y in range(len(olA)) if olA[y][3][1]<1] # Generate a list of all these actors with no energy

if iL != []: # If the list is not empty:

#Collect coordinates from actors in Grid
yxL=[[olA[y][x]] for y in range(len(olA)) for x in range(2) if olA[y][3][1]<1]

# Concentrate lists as (y,x) pairs
yxc=[[yxL[i][0], yxL[i+1][0]] for i in range(0,len(yxL),2)]

# Replace selected actors in the Grid by ‘_’
if yxc != []:

for i in range(len(yxc)):
y=yxc[i][0]
x=yxc[i][1]
mx[y][x]=’_’

# Delete actor from olA list
#Because pop() decreases the olA list, one has to start indexing from the ‘right end’ because then the decrement of the list
# keeps the other remaining indices valid!

for i in range(len(iL)-1,-1,-1):  #A reverse order!
   olA.pop(iL[i])
else:
  return olA

DEMO

This demo shows that part of a run where the energy level of the actors — in this case all together, which is usually not the case — are changing from 200 to 0, which means they have reached the critical state.

 

olA in Update :
[[1, 1, ‘A’, [0, 200, 200, 100]], [1, 4, ‘A’, [1, 200, 200, 100]], [2, 4, ‘A’, [2, 200, 200, 100]], [4, 3, ‘A’, [3, 200, 200, 100]]]
iL before if
[]
iL is empty

In this situation is the list of actors which have reached zero energy (iL) still empty.

Updated actor objects:

[1, 1, ‘A’, [0, 200, 200, 100]]

[1, 4, ‘A’, [1, 200, 200, 100]]

[2, 4, ‘A’, [2, 200, 200, 100]]

[4, 3, ‘A’, [3, 200, 200, 100]]

[‘_’, ‘_’, ‘_’, ‘_’, ‘F’, ‘O’, ‘F’]
[‘O’, ‘A’, ‘_’, ‘F’, ‘A’, ‘O’, ‘F’]
[‘F’, ‘O’, ‘O’, ‘F’, ‘A’, ‘_’, ‘O’]
[‘_’, ‘F’, ‘_’, ‘F’, ‘O’, ‘F’, ‘F’]
[‘O’, ‘_’, ‘O’, ‘A’, ‘O’, ‘O’, ‘_’]
[‘F’, ‘_’, ‘F’, ‘_’, ‘O’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘_’, ‘O’, ‘_’]

Updated food objects:

[0, 4, ‘F’, [0, 1000, 20]]

[0, 6, ‘F’, [1, 1000, 20]]

[1, 3, ‘F’, [2, 1000, 20]]

[1, 6, ‘F’, [3, 1000, 20]]

[2, 0, ‘F’, [4, 1000, 20]]

[2, 3, ‘F’, [5, 1000, 20]]

[3, 1, ‘F’, [6, 1000, 20]]

[3, 3, ‘F’, [7, 1000, 20]]

[3, 5, ‘F’, [8, 1000, 20]]

[3, 6, ‘F’, [9, 1000, 20]]

[5, 0, ‘F’, [10, 1000, 20]]

[5, 2, ‘F’, [11, 1000, 20]]

olA in Update :
[[1, 1, ‘A’, [0, 0, 200, 100]], [1, 4, ‘A’, [1, 0, 200, 100]], [2, 4, ‘A’, [2, 0, 200, 100]], [4, 3, ‘A’, [3, 0, 200, 100]]]

Now the energy levels reached 0.

iL before if
[0, 1, 2, 3] 

# The list iL is now filled up with indices of olA which actors reached energy 0

IL inside if: [0, 1, 2, 3]
yxL inside if: [[1], [1], [1], [4], [2], [4], [4], [3]]
xyc inside :
[[1, 1], [1, 4], [2, 4], [4, 3]]

This last version of the yxc list shows the (y,x) coordinates of those actors which have energy below 1.

iL before pop :
[0, 1, 2, 3]

Then starts the pop() operation which takes those identified actors from the olA list. The removing of actors starts from the right side of the list because otherwise somewhere in the middle of the list the indices would no longer  exist any more which have been valid in the full list.

pop : 3
pop : 2
pop : 1
pop : 0

Updated actor objects:

As one can see, the actors have been removed from grid.

[‘_’, ‘_’, ‘_’, ‘_’, ‘F’, ‘O’, ‘F’]
[‘O’, ‘_’, ‘_’, ‘F’, ‘_’, ‘O’, ‘F’]
[‘F’, ‘O’, ‘O’, ‘F’, ‘_’, ‘_’, ‘O’]
[‘_’, ‘F’, ‘_’, ‘F’, ‘O’, ‘F’, ‘F’]
[‘O’, ‘_’, ‘O’, ‘_’, ‘O’, ‘O’, ‘_’]
[‘F’, ‘_’, ‘F’, ‘_’, ‘O’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘_’, ‘O’, ‘_’]

Updated food objects:

[0, 4, ‘F’, [0, 1000, 20]]

[0, 6, ‘F’, [1, 1000, 20]]

[1, 3, ‘F’, [2, 1000, 20]]

[1, 6, ‘F’, [3, 1000, 20]]

[2, 0, ‘F’, [4, 1000, 20]]

[2, 3, ‘F’, [5, 1000, 20]]

[3, 1, ‘F’, [6, 1000, 20]]

[3, 3, ‘F’, [7, 1000, 20]]

[3, 5, ‘F’, [8, 1000, 20]]

[3, 6, ‘F’, [9, 1000, 20]]

[5, 0, ‘F’, [10, 1000, 20]]

[5, 2, ‘F’, [11, 1000, 20]]

!!! MAIN: no more actors in the grid !!!

[‘_’, ‘_’, ‘_’, ‘_’, ‘F’, ‘O’, ‘F’]
[‘O’, ‘_’, ‘_’, ‘F’, ‘_’, ‘O’, ‘F’]
[‘F’, ‘O’, ‘O’, ‘F’, ‘_’, ‘_’, ‘O’]
[‘_’, ‘F’, ‘_’, ‘F’, ‘O’, ‘F’, ‘F’]
[‘O’, ‘_’, ‘O’, ‘_’, ‘O’, ‘O’, ‘_’]
[‘F’, ‘_’, ‘F’, ‘_’, ‘O’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘_’, ‘O’, ‘_’]

CYCle : 6 ————————-

MAIN LOOP: STOP = ‘N’, CONTINUE != ‘N’

STARTING WITH PYTHON3 – The very beginning – part 7

Journal: uffmm.org,
ISSN 2567-6458, July 23, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:
gerd@doeben-henisch.de

CONTEXT

This is the next step in the python3 programming project. The overall context is still the python Co-Learning project.

SUBJECT

Meanwhile I am beginning to combine elements of the python language with some applied ideas (in the last section the idea of cognitive entropy illustrated with the equalization of strings). In this section I extend the idea of a simple 2-dimensional virtual world and the construction of objects and their properties.

Remark: for general help information go directly to the python manuals, which you can find associated with the entry for python 3.7.3 if you press the Windows-Button, look to the list of Apps (= programs), and identify the entry for python 3.7.3. If you open the python entry by clicking you see the sub-entry python 3.7.3 Manuals. If you click on this sub-entry the python documentation will open. In this documentation you can find nearly everything you will need. For Beginners you even find a small tutorial. … Yes, and there is all this and more in the world wide web too.

SZENARIO

Motivation

Because we want to introduce step-wise artificial actors which can learn, show some intelligence, and can work in teams, we need a minimal virtual world to start (this virtual world is a placeholder for the real world later if applied to the real world (RW) by sensors and actors). Although there is a big difference between the real world and a virtual world a virtual world is nevertheless very helpful for introducing basic concepts. And, indeed, finally if you are applying to real world data you will not be able to do this without mathematical models which represent virtual structures. You will need lots of mappings between real and virtual and vice versa. Thus from a theoretical point of view any kind of virtual model will do, the question is only how ‘easily’ and how ‘good’ it fits.

Virtual World (VW) – General Assumptions
  1. A 2-dimensional world as a grid together with a world clock CLCK. The clock produces periodic events which can be used to organize a timely order.

  2. There is an x and y axis with the root (0,0) in the upper left corner

  3. A coordinate (x,y) represents a position.

  4. A position can be occupied by (i) nothing or (ii) by an object. Objects can be obstacles, energy objects (= Food), a virtual executive actor, or even more.

  5. Only one object per position is allowed.

  6. It is assumed that there are four main directions (headings): ‘North (N)’ as -Y, ‘East (E)’ as +X, ‘South (S)’ as +Y, and ‘West (W)’ as -X. There are additional for compound directions North-East, East-South, South-West, and South-West.

  7. Possible movements are always in one of the mentioned directions from one cell to the adjacent cell. Movements will be blocked by obstacle objects or actor objects. In case of compound directions these are blocked to if the adjacent main directions are blocked

  8. A sequence of movements realizes in the grid a path from one position to the next.

  9. The size of the assumed grids is always finite. In a strict finite world the border of the grid blocks a movement. In a finite-infinite world the borders of the grid are connected in a way that the positions in the south lead to the position in the north and the positions in the east lead to the positions in the west, and vice versa. Therefor can a path in an finite-infinite world become infinite.

  10. A grid G with its objects O will be configured at the beginning of an experiment. Without the artificial actors all objects are in a static world assumed to be permanent. In a dynamic world there can be a world function f_w inducing changes depending from the world clock. Between permanent and dynamic exists some intermediate changes: Food can be there but with varying amount of energy, as well as with an actor; he can posses properties which can change during its existence.

  11. During an experiment possible changes in the world can happen through a world function f_w, if such a function has been defined. The other possible source for changes are artificial actors, which can act and which can ‘die’.

Remark: The basic idea of this kind of a virtual world I have got from a paper from S.W.Wilson from 1994 entitled ZCS: a zeroth level classifier system published in the Journal Evolutionary Computation vol. 2 number 1 pages 1-18. I have used this concept the first time in a lecture in 2012 (URL: https://www.doeben-henisch.de/fh/gbblt/node95.html). Although this concept looks at a first glance very simple, perhaps too simple, it is very powerful and allows very far reaching experiments (perhaps I can show some aspects from this in upcoming posts :-)).

ACTOR STORY

1. There is a human executive actor as a user who uses a program as an assisting actor by an interface with inputs and outputs.
2. The program tries to construct a 2D-virtual world in the format of a grid. The program needs the size of the grid as (m,n) = (number of columns, number of rows), which is here assumed by default as equal m=n. After the input the program will show the grid on screen.
3. Then the program will ask for the percentage of obstacles ‘O’ and energy objects (= food) ‘F’ in the world. Randomly the grid will be filled according to these values.
4. Then a finite number of virtual actors will be randomly inserted too, at least one.
5. After the completion of the virtual world grid a the list of all food objects as well as actors will be shown together with their individual Ids as well as additional properties.

IMPLEMENTATION

vw2b.py (main module)

gridHelper.py (import module)

EXERCISES

import copy as cp

The module ‘copy’ is important for cases where one wants to make a copy from an object with name ‘N’ and vaulue ‘V’ where the new name ‘N*’ should not be coupled to the old value ‘V’ but to some new value ‘V*’. Otherwise one has eventually many different new names ‘N1, N2, …, Nk’ but all are coupled to the same value ‘V’. Changing ‘V’ in connection with ohne Ni from all the new names wille be valid for all names. To stop such a synchrony between new names you have to use ‘copy’ like N*=copy.copy(N), or with the abbreviation ‘cp’: N*=cp.copy(N). In the source code zthere is one passage where this situation has bevome vivid.

def makeobjL(c,objL,mx,n):
ol=[]

In the following line list comprehension is used to collect all objects of type f==c in the matrix together with their (y,x) coordinates:
ol=[[y,x,f] for y in range(n) for x in range(n) for f in mx[y][x] if f==c]

Then for every such collected object the standard values of of the dictionary objL are appendet to these objects by copying (!!! see above) these values. This is important because these values ahll be changed afterwards independently from each other.
[ol[i].append(cp.copy(objL[c])) for i in range(len(ol))]

Now for every selected object with the  standard values an individual ID is computed and inserted at the first position of the property list.
for i in range(len(ol)):
ol[i][3][0]=i

return ol

olA, olA

With these operations we have now two independetn lists, one for food objects (olF), one for actor objects (olA) with individual values for each object. These can now individually  be managed during the upcoming simulation.

DEMO

PS C:\Users\gerd_2\code> python vw2b.py
Number of columns (= equal to rows!) of 2D-grid ?5

[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]
[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]
[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]
[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]
[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]

Percentage (as integer) of obstacles in the 2D-grid?50
Number of objects :
12
Position :
4 0
Position :
0 2
Position :
3 2
Position :
2 0
Position :
1 0
Position :
3 2
Position :
1 4
Position :
2 4
Position :
2 4
Position :
2 0
Position :
1 0
Position :
3 0
New Matrix :

[‘_’, ‘_’, ‘O’, ‘_’, ‘_’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘O’, ‘_’, ‘_’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘_’]

Percentage (as integer) of Energy Objects (= Food) in the 2D-grid ?20
Number of objects :
5
Position :
0 4
Position :
3 4
Position :
1 0
Position :
3 4
Position :
0 1
New Matrix :

[‘_’, ‘F’, ‘O’, ‘_’, ‘F’]
[‘F’, ‘_’, ‘_’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘O’, ‘_’, ‘F’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘_’]

Percentage (as integer) of Actor Objects in the 2D-grid ?10
Number of objects :
2
Position :
4 3
Position :
0 2
New Matrix :

[‘_’, ‘F’, ‘A’, ‘_’, ‘F’]
[‘F’, ‘_’, ‘_’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘_’, ‘_’, ‘O’]
[‘O’, ‘_’, ‘O’, ‘_’, ‘F’]
[‘O’, ‘_’, ‘_’, ‘A’, ‘_’]

Objects as food

[0, 1, ‘F’, [0, 1000, 20]]
[0, 4, ‘F’, [1, 1000, 20]]
[1, 0, ‘F’, [2, 1000, 20]]
[3, 4, ‘F’, [3, 1000, 20]]

Objects as actor

[0, 2, ‘A’, [0, 1000, 5, 100]]
[4, 3, ‘A’, [1, 1000, 5, 100]]

STOP = ‘N’, CONTINUE != ‘N’
N

 

STARTING WITH PYTHON3 – The very beginning – part 6

Journal: uffmm.org,
ISSN 2567-6458, July 20-22, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:
gerd@doeben-henisch.de

CONTEXT

This is the next step in the python3 programming project. The overall context is still the python Co-Learning project.

SUBJECT

Meanwhile I am beginning to combine elements of the python language with some applied ideas (in the last section the idea of cognitive entropy illustrated with the equalization of strings). In this section I address the idea of a simple 2-dimensional virtual world, how to represent it with python. In later sections I will use this virtual worlds for some ideas of internal representations and some kinds of learning in an artificial actor.

Remark: for general help information go directly to the python manuals, which you can find associated with the entry for python 3.7.3 if you press the Windows-Button, look to the list of Apps (= programs), and identify the entry for python 3.7.3. If you open the python entry by clicking you see the sub-entry python 3.7.3 Manuals. If you click on this sub-entry the python documentation will open. In this documentation you can find nearly everything you will need. For Beginners you even find a small tutorial. … Yes, and there is all this and more in the world wide web too.

SZENARIO

Motivation

Because we want to introduce step-wise artificial actors which can learn, show some intelligence, and can work in teams, we need a minimal virtual world to start (this virtual world is a placeholder for the real world later if applied to the real world (RW) by sensors and actors). Although there is a big difference between the real world and a virtual world a virtual world is nevertheless very helpful for introducing basic concepts. And, indeed, finally if you are applying to real world data you will not be able to do this without mathematical models which represent virtual structures. You will need lots of mappings between real and virtual and vice versa. Thus from a theoretical point of view any kind of virtual model will do, the question is only how ‘easily’ and how ‘good’ it fits.

Assumptions Virtual World (VW)

  1. A 2-dimensional world as a grid together with a world clock CLCK. The clock produces periodic events which can be used to organize a timely order.

  2. There is an x and y axis with the root (0,0) in the upper left corner

  3. A coordinate (x,y) represents a position.

  4. A position can be occupied by (i) nothing or (ii) by an object. Objects can be obstacles, energy objects (= Food), by a virtual executive actor, or even more.

  5. Only one object per position is allowed.

  6. It is assumed that there are four directions (headings): ‘North (N)’ as -Y, ‘East (E)’ as +X, ‘South (S)’ as +Y, and ‘West (W)’ as -X.

  7. Possible movements are always only in one of the main directions from one cell to the adjacent cell. Movements will be blocked by obstacle objects or actor objects.

  8. A sequence of movements realizes in the grid a path from one position to the next.

  9. The size of the assumed grids is always finite. In a strict finite world the border of the grid blocks a movement. In a finite-infinite world the borders of the grid are connected in a way that the positions in the south lead to the position in the north and the positions in the east lead to the positions in the west, and vice versa. Therefor can a path in an finite-infinite world become infinite.

  10. A grid G with its objects O will be configured at the beginning of an experiment. Without the artificial actors all objects are in a static world assumed to be permanent. In a dynamic world there can be a world function f_w inducing changes depending from the world clock.

  11. During an experiment possible changes in the world can happen through a world function f_w, if such a function has been defined. The other possible source for changes are artificial actors, which can act and which can ‘die’.

Remark: The basic idea of this kind of a virtual world I have got from a paper from S.W.Wilson from 1994 entitled ZCS: a zeroth level classifier system published in the Journal Evolutionary Computation vol. 2 number 1 pages 1-18. I have used this concept the first time in a lecture in 2012 (URL: https://www.doeben-henisch.de/fh/gbblt/node95.html). Although this concept looks at a first glance very simple, perhaps too simple, it is very powerful and allows very far reaching experiments (perhaps I can show some aspects from this in upcoming posts :-)).

ACTOR STORY
  1. There is a human executive actor as a user who uses a program as an assisting actor by an interface with inputs and outputs.

  2. The program tries to construct a 2D-virtual world in the format of a grid. The program needs the size of the grid as (m,n) = (number of columns, number of rows), which is here assumed by default as equal m=n. After the input the program will show the grid on screen.

  3. Then the program will ask for the percentage of obstacles ‘O’ and energy objects (= food) ‘F’ in the world. Randomly the grid will be filled according to these values.

  4. Then a finite number of virtual actors will be randomly inserted too. In the first version only one.

POSSIBLE EXTENSIONS

In upcoming versions the following options should be added:

  1. Allow multiple objects with free selectable strings for encoding.

  2. Allow multiple actors.

  3. Allow storage of a world specification with reloading in the beginning instead of editing.

  4. Transfer the whole world specification into an object specification. This allows the usage of different worlds in one program.

IMPLEMENTATION

vw1b.py

And with separation of support functions in an import module:

vw1c.py

gridHelper.py(The import module)

EXERCISES

m=int(input(‘Number of columns (= equal to rows!) of 2D-grid ?’))

The input() command generates as output a string object. If one wants to use as output numbers for follow-up computations one has to convert the string object into an integer object, which can be done with the int() operator.

mx=nmlist(n)

Is the call of the nmlist() function which has been defined before the main source code (see. above)(in another version all these supporting functions will again be stored as an extra import module:

printMX(mx,n)

This self-defined function assumes the existence of a matrix object mx with n=m many columns and rows. One row in the matrix can be addressed with the first index of mx like mx[i]. The ‘i’ gives the number of the row from ‘above’ starting with zero. Thus if the matrix has n-many rows then we have [0,…,n-1] as index numbers. The rows correspond to the y-axis.

mx = [[‘_’ for y in range(n)] for x in range(n)]

This expression is an example of a general programming pattern in python called list comprehension (see for example chapters 14 and 22 of the mentioned book of Mark Lutz in part 1 of this series). List comprehension has the basic idea to apply an arbitrary python expression onto an iteration like y in range(n). In the case of a numeric value n=5 the series goes from 0 to 4. Thus y takes the values from 0 to 4. In the above case we have two iterations, one for y (representing the rows) and one vor x (representing the columns). Thus this construct generates (y,x) pairs of numbers which represent virtual positions and each position is associated with a string value ‘_’. And because these instructions are enclosed in []-brackets will the result be a set of lists embedded in a list. And as you can see, it works 🙂 But I must confess that from the general idea of list comprehension to this special application is no direct way. I got this idea from the stack overflow web site (https://stackoverflow.com/questions) which offers lots of discussions around this topic.

for i in range(no):

x=rnd.randrange(n)

y=rnd.randrange(n)

mx[x][y]=obj

A simple for-loop to generate random pairs of (x,y) coordinates to place the different objects into the 2D-grid realized as a matrix object mx.

Demo

PS C:\Users\gdh\code> python vw1.py

Number of columns (= equal to rows!) of 2D-grid ?5

[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]

[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]

[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]

[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]

[‘_’, ‘_’, ‘_’, ‘_’, ‘_’]

Percentage (as integer) of obstacles in the 2D-grid?45

Number of objects :

11

Position :

3 2

Position :

2 3

Position :

3 2

Position :

3 2

Position :

0 1

Position :

2 2

Position :

0 1

Position :

4 3

Position :

0 2

Position :

3 1

Position :

1 4

New Matrix :

[‘_’, ‘O’, ‘O’, ‘_’, ‘_’]

[‘_’, ‘_’, ‘_’, ‘_’, ‘O’]

[‘_’, ‘_’, ‘O’, ‘O’, ‘_’]

[‘_’, ‘O’, ‘O’, ‘_’, ‘_’]

[‘_’, ‘_’, ‘_’, ‘O’, ‘_’]

Percentage (as integer) of Energy Objects (= Food) in the 2D-grid ?15

Number of objects :

3

Position :

3 4

Position :

0 4

Position :

4 1

New Matrix :

[‘_’, ‘O’, ‘O’, ‘_’, ‘F’]

[‘_’, ‘_’, ‘_’, ‘_’, ‘O’]

[‘_’, ‘_’, ‘O’, ‘O’, ‘_’]

[‘_’, ‘O’, ‘O’, ‘_’, ‘F’]

[‘_’, ‘F’, ‘_’, ‘O’, ‘_’]

Default random placement of one virtual actor

Position :

2 2

New Matrix :

[‘_’, ‘O’, ‘O’, ‘_’, ‘F’]

[‘_’, ‘_’, ‘_’, ‘_’, ‘O’]

[‘_’, ‘_’, ‘A’, ‘O’, ‘_’]

[‘_’, ‘O’, ‘O’, ‘_’, ‘F’]

[‘_’, ‘F’, ‘_’, ‘O’, ‘_’]

STARTING WITH PYTHON3 – The very beginning – part 5

Journal: uffmm.org,
ISSN 2567-6458, July 18-19, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:
gerd@doeben-henisch.de

CONTEXT

This is the next step in the python3 programming project. The overall context is still the python Co-Learning project.

SUBJECT

After a first clearing of the environment for python programming we have started with the structure of the python programming language, and in this section will continue dealing with the object type sequences and string and more programming elements are shown in a simple example of a creative actor.

Remark: for general help information go directly to the python manuals, which you can find associated with the entry for python 3.7.3 if you press the Windows-Button, look to the list of Apps (= programs), and identify the entry for python 3.7.3. If you open the python entry by clicking you see the sub-entry python 3.7.3 Manuals. If you click on this sub-entry the python documentation will open. In this documentation you can find nearly everything you will need. For Beginners you even find a small tutorial.

SZENARIO

For the further discussion of additional properties of python string and sequence objects I will assume again a simple scenario. I will expand the last scenario with the simple input-output actor by introducing some creativity into the actor. This means that the actor receives again either one word or sequences of words but instead of classifying the word according to some categories or instead of giving back the list of the multiple words as individual entities the actor will change the input creatively.
In case of a single word the actor will re-order the symbols of the string and additionally he can replace one individual symbol by some random symbol out of a finite alphabet.
In case of multiple words the actor will first partition the sequence of words into the individual words in a list, then he will also re-order these items of the list, will then re-order the letters in the words, and finally he can replace in every word one individual symbol by some random symbol out of a finite alphabet. After these operations the list is again concatenated to one sequence of words.
In this version of the program one can repeat in two ways: either (i) input manually new words or (ii) redirect the output into the input that the actor can continue to change the output further.
Interesting feature Cognitive Entropy: If the user selects always the closed world option then the set of available letters will not be expanded during all the repetitions. This reveals then after some repetitions the implicit tendency of all words to become more and more equal until only one type of word ‘survived’. This depends on the random character of the process which increases the chances of the bigger numbers to overrun the smaller ones. The other option is the open world option. This includes that in a repetition a completely new letter can be introduced in a single word. This opposes the implicit tendency of cognitive entropy to enforce the big numbers against the smaller ones.

How can this scenario be realized?

ACTOR STORY

1. There is a user (as executive actor) who can enter single or multiple words into the input interface of an assisting interface.
2. After confirming the input the assisting actor will respond in a creative manner. These creativity is manifested in changed orders of symbols and words as well as by replaced symbols.
3. After the response the user can either repeat the sequence or he can stop. If repeating then he can select between two options: (i) enter manually new words as input or (ii) redirect the output of the system as new input. This allows a continuous creative change of the words.
4. The repeated re-direction offers again two options: (i) Closed world, no real input, or (ii) Open world; some real new input

IMPLEMENTATION

Download here the python source code. This text appears as an HTML-document, because the blog-software does not allow to load a python program file directly.

stringDemo2.py

DEMOS

Single word in a closed world:

PS C:\Users\gerd_2\code> python stringDemo2.py
Single word = ‘1’ or Multiple words = ‘2’
1
New manual input =’1′ or Redirect the last output = ‘2’
1
Closed world =’1′ or Open world =’2′
1
Input a single word
abcde
Your input word is = abcde
New in-word order with worder():
ebaca
STOP = ‘N’, CONTINUE != ‘N’
y
Single word = ‘1’ or Multiple words = ‘2’
1
New manual input =’1′ or Redirect the last output = ‘2’
2
Closed world =’1′ or Open world =’2′
1
The last output was = ebaca
New in-word order with worder():
ccbaa
STOP = ‘N’, CONTINUE != ‘N’
y
Single word = ‘1’ or Multiple words = ‘2’
1
New manual input =’1′ or Redirect the last output = ‘2’
2
Closed world =’1′ or Open world =’2′
1
The last output was = ccbaa
New in-word order with worder():
ccccb
STOP = ‘N’, CONTINUE != ‘N’
y
Single word = ‘1’ or Multiple words = ‘2’
1
New manual input =’1′ or Redirect the last output = ‘2’
2
Closed world =’1′ or Open world =’2′
1
The last output was = ccccb
New in-word order with worder():
ccccc
STOP = ‘N’, CONTINUE != ‘N’

The original word ‘abcde’ has been changed to ‘ccccc’ in a closed world environment. If one introduces an open world scenario then this monotonicity can never happen.

Multiple words in a closed world

PS C:\Users\gerd_2\code> python stringDemo2.py
Single word = ‘1’ or Multiple words = ‘2’
2
New manual input =’1′ or Redirect the last output = ‘2’
1
Closed world =’1′ or Open world =’2′
1
Input multiple words
abc def geh
Your input words are = abc def geh
List version of sqorder input =
[‘abc’, ‘def’, ‘geh’]
New word order in sequence with sqorder():
def geh geh
List version of input in mcworder()=
[‘def’, ‘geh’, ‘geh’]
New in-word order with worder():
fef
New in-word order with worder():
hee
New in-word order with worder():
ege
New word-sequence order :
fef hee ege
STOP = ‘N’, CONTINUE != ‘N’
y
Single word = ‘1’ or Multiple words = ‘2’
2
New manual input =’1′ or Redirect the last output = ‘2’
2
Closed world =’1′ or Open world =’2′
1
The last output was = fef hee ege
List version of sqorder input =
[‘fef’, ‘hee’, ‘ege’]
New word order in sequence with sqorder():
fef fef ege
List version of input in mcworder()=
[‘fef’, ‘fef’, ‘ege’]
New in-word order with worder():
fff
New in-word order with worder():
fee
New in-word order with worder():
eee
New word-sequence order :
fff fee eee
STOP = ‘N’, CONTINUE != ‘N’
y
Single word = ‘1’ or Multiple words = ‘2’
2
New manual input =’1′ or Redirect the last output = ‘2’
2
Closed world =’1′ or Open world =’2′
1
The last output was = fff fee eee
List version of sqorder input =
[‘fff’, ‘fee’, ‘eee’]
New word order in sequence with sqorder():
eee fee fee
List version of input in mcworder()=
[‘eee’, ‘fee’, ‘fee’]
New in-word order with worder():
eee
New in-word order with worder():
eef
New in-word order with worder():
eee
New word-sequence order :
eee eef eee
STOP = ‘N’, CONTINUE != ‘N’
y
Single word = ‘1’ or Multiple words = ‘2’
2
New manual input =’1′ or Redirect the last output = ‘2’
2
Closed world =’1′ or Open world =’2′
1
The last output was = eee eef eee
List version of sqorder input =
[‘eee’, ‘eef’, ‘eee’]
New word order in sequence with sqorder():
eee eee eee
List version of input in mcworder()=
[‘eee’, ‘eee’, ‘eee’]
New in-word order with worder():
eee
New in-word order with worder():
eee
New in-word order with worder():
eee
New word-sequence order :
eee eee eee
STOP = ‘N’, CONTINUE != ‘N’

You can see that the cognitive entropy replicates with the closed world assumption in the multi-word scenario too.

EXERCISES

Here are some details of objects and operations.

Letters and Numbers

With  ord(‘a’) one can get the decimal code of the letter as ’97’ and the other way around one can translate a decimal number ’97’ in a letter with  chr(97) to ‘a’.  For ord(‘z’) one gets ‘122’, and then one can use the numbers to compute characters which has been used in the program to find random characters to be inserted in a word.

Strings and Lists

There are some operations only avalable for list-objects and others only for string-objects.  Thus to change and re-arrange a string directly is not possible, but translating a string in a list, then apply some operations, and then transfer the changed list back into a string, this works fine. Thus translate a word w into a list wl by wl = list(w) allows the re-order of these elements by appending: wll.append(wl[r]). Afterwords I have translated the list again in a string by constructing a new string wnew by concatenating all letters step by step: wnew=wnew+wl[i]. If yould try to transfer the list directly like in the following example, then you will get as a result again  list:

>> w=’abcd’
>>> wl=list(w)
>>> wl
[‘a’, ‘b’, ‘c’, ‘d’]
>>> wn=str(wl)
>>> wn
“[‘a’, ‘b’, ‘c’, ‘d’]”

Immediate Help

If one needs direct information about the operations which are possible with a certain object like here the string object ‘w’, then one can ask for all possible operation like this:

>> dir(w)
[‘__add__’, ‘__class__’, ‘__contains__’, ‘__delattr__’, ‘__dir__’, ‘__doc__’, ‘__eq__’, ‘__format__’, ‘__ge__’, ‘__getattribute__’, ‘__getitem__’, ‘__getnewargs__’, ‘__gt__’, ‘__hash__’, ‘__init__’, ‘__init_subclass__’, ‘__iter__’, ‘__le__’, ‘__len__’, ‘__lt__’, ‘__mod__’, ‘__mul__’, ‘__ne__’, ‘__new__’, ‘__reduce__’, ‘__reduce_ex__’, ‘__repr__’, ‘__rmod__’, ‘__rmul__’, ‘__setattr__’, ‘__sizeof__’, ‘__str__’, ‘__subclasshook__’, ‘capitalize’, ‘casefold’, ‘center’, ‘count’, ‘encode’, ‘endswith’, ‘expandtabs’, ‘find’, ‘format’, ‘format_map’, ‘index’, ‘isalnum’, ‘isalpha’, ‘isascii’, ‘isdecimal’, ‘isdigit’, ‘isidentifier’, ‘islower’, ‘isnumeric’, ‘isprintable’, ‘isspace’, ‘istitle’, ‘isupper’, ‘join’, ‘ljust’, ‘lower’, ‘lstrip’, ‘maketrans’, ‘partition’, ‘replace’, ‘rfind’, ‘rindex’, ‘rjust’, ‘rpartition’, ‘rsplit’, ‘rstrip’, ‘split’, ‘splitlines’, ‘startswith’, ‘strip’, ‘swapcase’, ‘title’, ‘translate’, ‘upper’, ‘zfill’]
>>>

In the case that ‘w’ is a sequence of strings/ words like w=’abc def’, then does the list operations be of no help, because one gets a list of letters, not of words:

>> wl2=list(w)
>>> wl2
[‘a’, ‘b’, ‘c’, ‘ ‘, ‘d’, ‘e’, ‘f’]

For the program one needs a list of single words. Looking to the possible operations with string objects with Dir() above, one sees the name ‘split’. We can ask, what this ‘split’ is about:

>>> help(str.split)
Help on method_descriptor:

split(self, /, sep=None, maxsplit=-1)
Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string.
None (the default value) means split according to any whitespace,
and discard empty strings from the result.
maxsplit
Maximum number of splits to do.
-1 (the default value) means no limit.

This sounds as if it could be of help. Indeed, that is the mechanism I have used:

>> w=’abc def’
>>> w
‘abc def’
>>> wl=w.split()
>>> wl
[‘abc’, ‘def’]

Function Definition

As you can see in the program text the inimal structure of a function definition is as follows:

def fname(Input-Arfuments):
     some commands
    [return VarNames]

The name is needed for the identification of the command, the input variables to get some values from the outside to work on and finally, but optionally, you can return the values of some variables back to the outside of the function.

The For-Loop

Besides the loop organized by the while-command there is the other command with a fixed number of repetitions indicated by the for-command:

for i in range(n):
commands

The operator ‘range()’ delivers a sequence of numbers from ‘0’ to ‘n-1’ and attaches these to the variable ‘i’. Thus the variable i takes one after the other all the numbers from range(). During one repetition all the commands will be executed which are listed after the for-command.

Random Numbers

In this program very heavily I have used random numbers. To be able to do this one has before this usage to import the random number library. I did this with the call:

import random as rnd

This introduces additionally an abbreviation ‘rnd’. Thus if one wants to cal a certain operation from the random object one can write like this:

r=rnd.randrange(0,n)

In this example one uses  the randrange() operation from random with the arguments (0,n) this means that an integer random number will be generated in the intervall [0,n-1].

If-Operator with Combined Conditions

In the program you can find statements like

if opt==’1′ and opt2==’1′ and opt3==’1′:

Following the if-keyword you see three different conditions

opt==’1′
opt2==’1′
opt3==’1′

which are put together to one expression by the logical operator ‘and’. This means that all three conditions must be simultaneously be true, otherwise this combined condition will not work.

Introduce the Import Module Mechanism

See for this the two files:

stringDemo2b.py
stringDemos.py

StringDemo2b.py is the same as stringDemo2.py discussed above but all the supporting functions are now removed from the main file and stored in an extra file called ‘stringDemos.py’ which works for the main file stringDemo2b.py as a module file. Tht this works there must be a special

import stringDemos as sd

command and at each occurence of a function call with functions from the imported module in the main module stringDemo2b.py one has to add the prefix ‘sd.’ indicating, that these functions are now located in a special place.

This import call does work only if the special path for the import module ‘stringDemos.py’ is visible to the python modulecall mechanisms. In this case the Path with the modul stringDemos.py is given as C:\Users\gerd_2\code. If one wants know what the actual path names are which are known to the python system one can use a system call:

>> import sys
>>> sys.path
>>> …

If the wanted path is not yet part of these given paths one can append the new path like this:

>> sys.path.append(‘C:\\Users\\gerd_2\\code’)

If this has all done rightly one can work with the program like before. The main advantage of this splitting of the main program and of the supporting functions is (i) a greater transparency of the main code and (ii) the supporting functions can now easily be used from other programs too if needed.

 

 

STARTING WITH PYTHON3 – The very beginning – part 4

Journal: uffmm.org,
ISSN 2567-6458, July 15, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:
gerd@doeben-henisch.de

Change: July 16, 2019 (Some re-arrangement of the content :-))

CONTEXT

This is the next step in the python3 programming project. The overall context is still the python Co-Learning project.

SUBJECT

After a first clearing of the environment for python programming we have started with the structure of the python programming language, and in this section will deal with the object type string(s).

Remark: the following information about strings you can get directly from the python manuals, which you can find associated with the entry for python 3.7.3 if you press the Windows-Button, look to the list of Apps (= programs), and identify the entry for python 3.7.3. If you open the python entry by clicking you see the sub-entry python 3.7.3 Manuals. If you click on this sub-entry the python documentation will open. In this documentation you can find nearly everything you will need. For Beginners you even find a nice tutorial.

TOPIC: VALUES (OBJECTS) AS STRINGS

PROBLEM(s)

(1) When I see a single word (a string of symbols) I do not know which type this is in python. (2) If I have a statement with many words I would like to get from this a partition into all the single worlds for further processing.

VISION OF A SOLUTION

There is a simple software actor which can receive as input either single words or multiple words and which can respond by giving either the type of the received word or the list of the received multiple words.

ACTOR STORY (AS)

We assume a human user as executing actor (eA) and a piece of running software as an assisting actor (aA). For these both we assume the following sequence of states:

  1. The user will start the program by calling python and the name of the program.
  2. The program offers the user two options: single word or multiple words.
  3. The user has to select one of these options.
  4. After the selection the user can enter accordingly either one  or multiple words.
  5. The program will respond either with the recognized type in python or with a list of words.
  6. Finally asks the program the user whether he/she will continue or stop.
  7. Depending from the answer of the user the program will continue or stop.

IMPLEMENTATION

Here you can download the sourcecode: stringDemo1

# File stringDemo1.py
# Author: G.Doeben-Henisch
# First date: July 15, 2019

##################
# Function definition sword()

def sword(w1):
w=str(w1)
if w.islower():
print(‘Is lower\n’)
elif w.isalpha() :
print(‘Is alpha\n’)
elif w.isdecimal():
print(‘Is decimal\n’)
elif w.isascii():
print(‘Is ascii\n’)
else : print(‘Is not lower, alpha, decimal, ascii\n’)

##########################
# Main Programm

###############
# Start main loop

loop=’Y’
while loop==’Y’:

###################
# Ask for Options

opt=input(‘Single word =1 or multiple words =2\n’)

if opt==’1′:
w1=input(‘Input a single word\n’)
sword(w1) # Call for new function defined above

elif opt==’2′:
w1=input(‘Input multiple words\n’)
w2=w1.split() # Call for built-in method of class str
print(w2)

loop=input(‘To stop enter N\n’) # Check whether loop shall be repeated

DEMO

Here it is assumed that the code of the python program is stored in the folder ‘code’ in my home director.

I am starting the windows power shell (PS) by clicking on the icon. Then I enter the command ‘cd code’ to enter the folder code. Then I call the python interpreter together with the demo programm ‘stringDemo1.py’:

PS C:\Users\gerd_2\code> python stringDemo1.py
Single word =1 or multiple words =2

Then I select first option ‘Single word’ with entering 1:

1
Input a single word
Abrakadabra
Is alpha

To stop enter N

After entering 1 the program asks me to enter a single word.

I am entering the fantasy word ‘Abrakadabra’.

Then the program responds with the classification ‘Is alpha’, what is correct. If I want to stop I have to enter ‘N’ otherwise it contiues.

I want o try another word, therefore I am entering ‘Y’:

Y
Single word =1 or multiple words =2

I select again ‘1’ and the new menue appears:

1
Input a single word
29282726
Is decimal

To stop enter N

I entered a sequence of digits which has been classified as ‘decimal’.

I want to contiue with ‘Y’ and entering ‘2’:

Y
Single word =1 or multiple words =2
2
Input multiple words
Hans kommt meistens zu spät
[‘Hans’, ‘kommt’, ‘meistens’, ‘zu’, ‘spät’]
To stop enter N

I have entered a German sentence with 5 words. The response of the system is to identify every single word and generate a list of the individual words.

Thus, so far, the test works fine.

COMMENTS TO THE SOURCE CODE

Before the main program a new function ‘sword()’ has been defined:

def sword(w1):

The python keyword ‘def‘ indicates that here the definition of a function  takes place, ‘sword‘ is the name of this new function, and ‘w1‘ is the input argument for this function. ‘w1’ as such is the name of a variable pointing to some memory place and the value of this variable at this place will depend from the context.

w=str(w1)

The input variable w1 is taken by the operator str and str translates the input value into a python object of type ‘string’. Thus the further operations with the object string can assume that it is a string and therefore one can apply alle the operations to the object which can be applied to strings.

if w.islower():

One of these string-specifi operations is islower(). Attached to the string object ‘w’ by a dot-operator ‘.’ the operation ‘islower() will check, whether the string object ‘w’ contains lower case symbols. If yes then the following ‘print()’ operation will send this message to the output, otherwise the program continues with the next ‘elif‘ statement.

The ‘if‘ (and following the if the ‘elif‘) keyword states a condition (whether ‘w’ is of type ‘lower case symbols’). The statement closes with the ‘:’ sign. This statement can be ‘true’ or not. If it is true then the part after the ‘:’ sign will be executed (the ‘print()’ action), if false then the next condition ‘elif … :’ will be checked.

If no condition would be true then the ‘else: …’ statement would be executed.

The main program is organized as a loop which can iterate as long as the user does not stop it. This entails that the user can enter as many words or multi-words as he/ she wants.

loop=’Y’
while loop==’Y’:

In the first line the variable ‘loop’ receives as a value the string ‘Y’ (short for ‘yes’). In the next line starts the loop with the python key-word ‘while’ forming a condition statement ‘while … :’. This is similar to the contion statements above with ‘if …. :’ and ‘elif … :’.

The condition depends on the expression ‘loop == ‘Y” which means that  as long as the variable loop is logically equal == to the value ‘Y’ the loop condition  is ‘true’ and the part after the ‘:’ sign will be executed. Thus if one wants to break this loop one has to change the value of the variable ‘loop’ before the while-statement ‘while … :’ will be checked again. This check is done in the last line of the while-execution part with the input command:

loop=input(‘To stop enter N\n’)

Before the while-condition will be checked again there is this input() operator asking the user to enter a ‘N’ if he/ she wantds to stop. If the user  enters a  ‘N’  in the input line the result of his input will be stored in the variable called ‘loop’ and therefore the variable will have the value ‘==’N” which is different from ‘==’Y”. But what would happen if the user enters something different from ‘N’ and ‘Y’, because ‘Y’ is expected for repetition?

Because the user does not know that he/she has to enter ‘Y’ to continue the program will highly probably stop even if the user does not want to stop. To avoid this unwanted case one should change the code for the while-conition as follows:

while loop!=’N’:

This states that the loop will be true as long as the value of the loop variable is different != from the value ‘N’ which will explicitly asked from the user at the end of the loop.

The main part of the while-loop distinguishes two cases: single word or multiple words. This is realized by a new input() operation:

opt=input(‘Single word =1 or multiple words =2\n’)

The user can enter a ‘1’ or a ‘2’, which will be stored in the variable ‘opt’. Then a construction with an if or an elif will test which one of these both happens. Depending from the option 1 or 2 ther program asks the user again with an input() operation for the specific input (one word or multiple words).

sword(w1)

In the case of the one word input in the variable ‘w1’ w1 contains as value a string input which will be delivered as input argument to the new function ‘sword()’ (explanation see above). In case of input 2 the

w2=w1.split()

‘split()’ operation will be applied to the object ‘w1’ by the dot operator ‘.’. This operation will take every word separated by a ‘blank’ and generates a list ‘[ … ]’ with the individual words as elements.

 

 

PHILOSOPHY LAB

eJournal: uffmm.org

ISSN 2567-6458, July 13,  2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

Changes: July 20.2019 (Rewriting the introduction)

CONTEXT

This Philosophy Lab section of the uffmm science blog is the last extension of the uffmm blog, happening July 2019. It has been provoked by the meta reflections about the AAI engineering approach.

SCOPE OF SECTION

This section deals with  the following topics:

  1. How can we talk about science including the scientist (and engineer!) as the main actors? In a certain sense one can say that science is mainly a specific way how to communicate and to verify the communication content. This presupposes that there is something called knowledge located in the heads of the actors.
  2. The presupposed knowledge usually is targeting different scopes encoded in different languages. The language enables or delimits meaning and meaning objects can either enable or  delimit a certain language. As part of the society and as exemplars of the homo sapiens species scientists participate in the main behavior tendencies to assimilate majority behavior and majority meanings. This can reduce the realm of knowledge in many ways. Biological life in general is the opposite to physical entropy by generating auotopoietically during the course of time  more and more complexity. This is due to a built-in creativity and the freedom to select. Thus life is always oscillating between conformity and experiment.
  3. The survival of modern societies depends highly on the ability   to communicate with maximal sharing of experience by exploring fast and extensively possible state spaces with their pros and cons. Knowledge must be round the clock visible to all, computablemodular, constructive, in the format of interactive games with transparent rules. Machines should be re-formatted as primarily helping humans, not otherwise around.
  4. To enable such new open and dynamic knowledge spaces one has to redefine computing machines extending the Turing machine (TM) concept to a  world machine (WM) concept which offers several new services for social groups, whole cities or countries. In the future there is no distinction between man and machine because there is a complete symbiotic unification because  the machines have become an integral part of a personality, the extension of the body in some new way; probably  far beyond the cyborg paradigm.
  5. The basic creativity and freedom of biological life has been further developed in a fundamental all embracing spirituality of life in the universe which is targeting a re-creation of the whole universe by using the universe for the universe.

 

STARTING WITH PYTHON3 – The very beginning – part 3

Journal: uffmm.org,
ISSN 2567-6458, July 10, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:
gerd@doeben-henisch.de

CONTEXT

This is the next step in the python3 programming project. The overall context is still the python Co-Learning project.

SUBJECT

After a first clearing of the environment for python programming we will now focus a little bit more on the structure of the python programming language. Generally python is not different to any other programming language: there are different kinds of objects and different kinds of operations with these objects, and a certain order how to proceed.

PHILOSOPHICAL CONSIDERATIONS

To be able to write code it is not necessary to do philosophy. But as you will see shortly (and hopefully) it can add some more helpful knowledge by widening your view of what you are doing.

What you want to do while programming is to write some lines of code in the python language to enable some computing process.

Usually you will do this because you have some model in your head which you want to translate (encode, implement) in a python script which can be processed by the python interpreter who talks with the computing machinery.

The computing machinery is some real machine which matches the general (mathematical = philosophical) concept of an automaton called Turing machine.

From a Turing machine we know that one has to distinguish between input values which can be read in and being processed according to a finite set of computable rules and output values of these computations. The output values can also be understood as stored values, which can be read again. Input and output values can have an explicit address of some location where they are stored and a content (= value) at this location. Thus the processing rules can select an address and either read the associated value or write a value into the associated location.

Within this mathematical framework of a Turing machine the values represent objects and the computable rules represent possible operations with these objects.

It is possible to combine elementary values located in individual addresses to more complex values and to combine individual computable rules to more complex operations.

In the first moment this description of a Turing machine can appear as to be too simple to be useful for anything interesting, but as the history of Logic, of Mathematics as well as Computer Science has revealed to us, this simple concept can do anything what we can think of to be computable (a complete different story is that of quantum computers. It has still to be clarified whether the definition of ‘quantum computer’ is compatible with that of a Turing machine).

Taking the journey from a Turing machine to the python programming paradigm as defined in the language then we find a rich set of different types of values as well as a rich set of different types of operations (methods), often object specific.

Let us have a first look to the value (object) types numbers, strings, and sets.

Remark: the following information about numbers you get directly from the python manuals, which you can find associated with the entry for python 3.7.3 if you press the Windows-Button, look to the list of Apps (= programs), and identify the entry for python 3.7.3. If you open the python entry by clicking you see the sub-entry python 3.7.3 Manuals. If you click on this sub-entry the python documentation will open. In this documentation you can find nearly everything you will need. For Beginners you even find a nice tutorial.

VALUES (OBJECTS) AS NUMBERS

In our everyday world numbers occur usually as certain symbolic expressions like ’99’, ‘-62’, ‘6.23’, ‘2.3*10^4’ etc. From Mathematics we have learned that there are different kinds of numbers defined which obey different kinds of rules.

Thus we have in everyday life integers, rational numbers, real numbers, irrational numbers, complex numbers to mention the most common types.

While numbers as such have no special meaning they can be used to quantify certain properties like temperature, weight, length, clock-time, velocity, etc.

In python there are three distinct numeric types built in: integers, floating point numbers, and complex numbers. Integers have internally an unlimited precision. Example:

>>> print(23**23)

20880467999847912034355032910567

>>> print(234**23)

3104307401943398225947002752118451297846365869366575104

>>> print(2345**33)

1639509557347018492896272198387903513810572353466749818375721601077990329493344735781232477165758609771728515625

Information about the precision and internal representation of floating point numbers for the machine on which your program is running is available in sys.float_info:

>>> import sys

>>> print(sys.float_info)

sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)

Complex numbers have a real and imaginary part, which are each a floating point number. To extract these parts from a complex number z, use z.real and z.imag.

>>> z=complex(2.33,-2)

>>> z

(2.33-2j)

>>> z.real

2.33

>>> z.imag

-2.0

>>> z=complex(2.33,-2)

>>> z

(2.33-2j)

>>> z.real

2.33

>>> z.imag

-2.0

There are additional numeric types like fractions and decimals that hold floating-point numbers with user-definable precision.

The different operations with these numeric types are the following ones:

A population p=1200 citizens increases by incoming people migPlus=500 to 12500.

>>> p=12000

>>> migrPlus=500

>>> pnew=p+migrPlus

>>> pnew

12500

With a birth rate br=0.015 and a death rate of dr=0.018 the population will change in a year like

>>> p=12500

>>> br=0.015

>>> dr=0.018

>>> pnew=p+(p*br)-(p*dr)

>>> pnew

12462.5

If one would assume that the birth br and death dr rates are linearly distributed over the year one could compute some average per month like:

>>> (p*br)/12

15.625

>>> (p*dr)/12

18.749999999999996

The floor operator ‘//’ turns a float number into the next integer which is smaller:

>>> (p*br)/12

15.625

>>> (p*br)//12

15.0

>>> (p*dr)/12

18.749999999999996

>>> (p*dr)//12

18.0

>>>

The remainder operator ‘%’ delivers the ‘rest’ of a division instead of the fraction as in a usual division:

>>> 12/8

1.5

>>> 12%8

4

The ‘abs()’ operator abstracts from possible negative signs:

>>> abs(-7)

7

>>> abs(-7.2)

7.2

The ‘int()’ operator turns a float number into an integer:

>>> int(7.2)

7

>>> int(-7.2)

-7

And the float operator ‘float()’ turns an integer into a float:

>>> float(7)

7.0

>>> float(-7)

-7.0

With the power operator ‘pow(x,y)’ one can raise x to the power of y:

>>> pow(2,3)

8

>>> pow(2,5)

32

>>> pow(3,3)

27

Alternatively one can use the expression x**y:

>>> 2**3

8

>>> 2**5

32

>>> 3**3
27

 

STARTING WITH PYTHON3 – The very beginning – part 2

Journal: uffmm.org,
ISSN 2567-6458, July 9, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:
gerd@doeben-henisch.de

CONTEXT

This is the next step in the python3 programming project. The first step can be found here. The overall context is still the python Co-Learning project.

PROGRAMMING TOOLS

First SW-tools to use for programming

In this second session we extend the overview of the possible programming tools, how they are interrelated, and how they work.

In the figure above you can see the windows 10 operating system as the root system for everything else. The win10 system communicates with the PATH-variable and uses this information for many operations. How on can edit this variable has been shown in the last session.

One can activate directly from the win10 system the power-shell with a command-line interface. Entering the right code one can activate from the power-shell either directly a python-shell for python commands or one can activate other programs like the editor ‘notepad’ or ‘notepad++’. With such editors one can edit python scripts, store them, and then run these scripts from the power-shell by calling a python-shell with these scripts as arguments (as shown in the first session).

The python shell allows the direct entering of python commands and gives immediately feedback whether it works and how. Therefore one calls this an interactive shell which is very handy to check quickly some commands and their effects.

Another tool, which we will use in this session, is the integrated script environment (IDLE). This is like the python-shell but with some additional functionalities (see below). The main usage is for editing larger python scripts with a built-in editor and for running these scripts.

THE IDLE TOOL

To use this new tool you can press the windows button to see the list of all apps (programs) available on your computer. Under ‘P’ you will find python 3.7.3 and within python you will find an entry for IDLE. By selecting this item and clicking on the right mouse-button you can select the option to attach this icon to the task bar. If it is there you can use it.

If you start the IDLE tool by clicking on the icon from the task bar it opens as a new python interactive shell with some more options.

A first thing you can do is to ask for the actual path you are in. For this you have to import the python module ‘os’ (operating system) and use the command ‘getcwd()‘ from this module. Entering ‘os.getcwd()‘ in the python command line generates the actual path as output on the next line.

>>> import os
>>> os.getcwd()
‘C:\\Users\\gerd_2\\AppData\\Local\\Programs\\Python\\Python37-32’
>>>

This reveals that the actual path is pointing to the location of the python exe module (on my pc). This is not what I want because I have created in the first session a folder with name ‘code’ in my home directory ‘\Users\gerd_2’. From inside of the IDLE tool it is not possible to change the actual path.  But python as language provides lots of options to do this. One option is described below:

The module os offers several functions. Besides the function ‘os.getcwd()’ which we have used already there is another command ‘os.chdir(pathname)‘. But to directly change the actual path one has to be cautious because the path ‘C:\\Users\gerd_2\code‘ includes the ‘\’-sign, this cannot be read directly by the os.chdir() command. You can surround this problem by using the ‘\’-sign twice: first as an ‘escape sign’ and then as the ‘object sign’, resulting in the following command format: ‘C:\\Users\\gerd_2\\code‘. Entering this nothing is given as a result, and when you repeat the question ‘os.getcwd()’ you will receive as new answer the new path. Here the dialog with the python-shell:

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32

Type “help”, “copyright”, “credits” or “license()” for more information.

>>> import os

>>> os.getcwd()

‘C:\\Users\\gerd_2\\AppData\\Local\\Programs\\Python\\Python37-32’

>>> os.chdir(‘C:\\Users\\gerd_2\\code’)

>>> os.getcwd()

‘C:\\Users\\gerd_2\\code’

>>>

You can see that the python command ‘os.getcwd() has been used twice. If you want to repeat some command you can call-back the command history of the python-shell with the keystrokes ‘ALT+P‘. This recalls the past (P) of the command history.

Comment: In the command

>> os.chdir(‘C:\\Users\\gerd_2\\code’)

I have used the back-slash sign ‘\’ twice to make the string fit as argument for the ‘os.chdir()’ command. As one can learn does python allow another solution, which looks like this:

>> os.chdir(r’C:\Users\gerd_2\code’)

The solution is to use an additional ‘r’ directly before the string ‘…’ telling the python interpreter that the following string has to be understood as a raw string. This works, try it out 🙂

IDLE AND EXECUTION OF A SCRIPT

Now if we are in the target folder for my scripts we can look to all files which are in this folder actually. For this we can use the python command ‘os.listdir()’:

>>> os.listdir()

[‘savesrc.txt’, ‘script1.py’, ‘script1.pyw’, ‘script1b.py’, ‘showargs.py’, ‘threenames.py’, ‘tst1.py’, ‘what.py’, ‘what2.py’, ‘__pycache__’]

>>>

You can detect in this list the python script ‘scrpt1.py’. Entering the name of this script either with .py extension or without will not enable an execution:

>>> script1.py

Traceback (most recent call last):

File “<pyshell#6>”, line 1, in <module>

script1.py

NameError: name ‘script1’ is not defined

From the first session we know that we can start the script within the power-shell directly. For this we have to activate the powershell, have to go into the desired folder ‘code’ …

PS C:\Users\gerd_2> cd code

PS C:\Users\gerd_2\code> dir

Verzeichnis: C:\Users\gerd_2\code

Mode LastWriteTime Length Name

—- ————- —— —-

d—– 04.07.2019 19:03 __pycache__

-a—- 01.07.2019 18:44 182 savesrc.txt

-a—- 01.07.2019 18:41 92 script1.py

-a—- 24.06.2019 23:23 126 script1.pyw

-a—- 24.06.2019 22:43 128 script1b.py

-a—- 04.07.2019 18:51 56 showargs.py

-a—- 28.06.2019 00:29 162 threenames.py

-a—- 24.06.2019 21:16 120 tst1.py

-a—- 24.06.2019 22:49 126 what.py

-a—- 24.06.2019 23:56 136 what2.py

… and then we can start the python-script ‘script1.py’:

PS C:\Users\gerd_2\code> python script1.py

win32

1267650600228229401496703205376

pythonpythonpythonpythonpythonpythonpythonpython

PS C:\Users\gerd_2\code>

But because we will here use the IDLE tool we proceed differently. We open the File-Menue to get the desired file script1.py:

Open file-directory for file search

Then we load  the python-script script1.py in the editor of the IDLE tool:

The text of the script

and then activate the RUN button for execution:

Activate the RUN button to execute the script

The script will then be executed and you will see the effect of the execution in the python shell. This looks the same as when you would have called the script within the power-shell calling  the python-shell.

There is still the other option to get the module running by the import command:

>>> import script1.py

win32

1267650600228229401496703205376

pythonpythonpythonpythonpythonpythonpythonpython

Traceback (most recent call last):

File “<pyshell#7>”, line 1, in <module>

import script1.py

ModuleNotFoundError: No module named ‘script1.py’; ‘script1’ is not a package

>>>

The import call works, but at the same time the python-shell states some error, that ‘script1.py’ is not recognized as a true module. This has to be clarified in the next session.

 

 

 

STARTING WITH PYTHON3 – The very beginning – V2

Journal: uffmm.org,
ISSN 2567-6458, July 5, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

CONTEXT

This is an update of the post ‘STARTING WITH PYTHON3 – The very beginning‘ from July-1, 2019. The original version was not ‘wrong’, but it seems, after a few days later, one can and should improve it. The main motivation for this new version is my experience as a linux programmer working with windows 10: learning by doing I detected a litle more radical approach to begin python programming with win10. This post is part of the overall  topic ‘Co-Learning with python 3‘.

OVERVIEW

In this updated version I will introduce some bits of the win10 environment which you will need for your python programming. Then I demonstrate the very first steps with some lines of code. Very important for all your own activities: in the beginning get you a helpful book to guide your start. After trying many sources I have actually the following recommendations:

  • Mark Lutz, Learn Python, 2013,5th ed.,Sebastopol (CA), O’Reilly
  • To get the sources: https://www.python.org/
  • Documentation: https://docs.python.org/3/
  • Python Software Foundation (PSF): https://www.python.org/psf-landing/
  • Python Community: https://www.python.org/community/

THE WIN10-ENVIRONMENT

When you start programming  you need a direct knowledge about your computing environment, in that case the win10 operating system. While linux is built up with an open mind and tries to make everything transparent, win10 is somehow the opposite: it is a closed box, and to work with it in direct contact with the operating system is not very well supported. Thus to work as a programmer with win10 is not what you ideally want. But now we are there and have to get the programming done.

After my first expriments with win10 I detected the following tools as very helpful to start programming: (i) The editor for the system and environment variables and (ii) the powershell. These tools allow you to define the operating system environment for your python programming  in a minimal way.

The editing of the system and environment variables you can reach by the following key-operations:

Editing System and Environment Variables

  1. Hit the windows key together with the key for ‘R’
  2. This opens a small window with a textfield-entry.
  3. In this field you enter the string ‘control’
  4. This opens a page with different topics for to manipulate some aspects of your system (because my computer is in the German-Mode I have the heading ‘Einstellungen des Computers ändern’, something like ‘Change options of the computer’).
  5. Here you select the topic ‘System and Security’
  6. Then another page opens with several topics, one is ‘System’, which you should select.
  7. On this new page you can see at the left border some more topics. The last one mentions something like ‘Extended System Options’. Select this
  8. Before you see the next page you will be asked to enter the Super-User Password. Thus you must be super-user to do this.  To be a real programmer you must have this rights to get a full understanding of what is going on.
  9. Then  the editor for system and environment variables pops up:
Editor for system and enviroment variables

 

  1. The interesting button is in the right down corner, in German: Umgebungsvariablen (‘environment variables’)
  2. Click this button and you will finally see the editor you are looking for:
Finally the editor to edit private and environment variables
  1. For the upcoming actions we need only the path-variable. One can highlight the Path-entry and select it with ‘Editing’ (German: ‘Bearbeiten’):
The window showing all the entries of the path-variable.
  1. Now you can see all the entries of the path variable nicely ordered one after the  other. This is a special service because the path-variable as such (as you will see later when using the power-shell) is one string. Here this string is splitted up into the different sub-strings. This allow you to add some new string or — also very important — to delete a substring. As You can see in the figure there is as last line an entry including the name Python . This line is the whole directory path on the drive C:\ where my actual python version is stored.

CLEAN UP BEFORE

Now, if You know where and how you can edit the basic system variables it can be a good idea to clean up the whole system with regard to older python installations. In my case I had tried  before — as a complete newbie — several python distributions like WinPython and Anaconda in different versions at different locations in the system, this accompanied with different installations of the python language. You can imagine that this caused finally some confusion what is where and what is causing which  effect.

Thus I decided to start from scratch, removing all the old stuff to get a ‘point zero’ for beginning.

The first step was to use the win10 explorer program with the find option in the small text-field up right.

Part of the win10-explorer window showing a find-operation on the whole PC

After you have entered your search-string, in this case ‘python’, you have to say (left up corner) the region, in which you want the search to happen. I have selected the whole PC.

After some while you see all locations as a complete path where the search-string python could be found. When I started my clean-up action there where lots of locations with different python installations, now there is only one left, which I am actually using.

But caution: If you want to delete the old installations you have (i) to look to the uninstall options/ programs to activate these to remove all stuff; (ii) finally you have to enter the editor for system and environment variables (see above) to delete all entries there, which are now obsolet.

GET YOUR PYTHON

Now, if you have set everything with Python to zero get your python version from the python home page: https://www.python.org/.

This page is a bit confusing. Stay cool. You can detect a field with the header Downloads and a hint to the latest version. In this case it shows 3.7.3. Click this.

Python Home Page for Downloads

The next page is completely confusing. The interesting part of this page is somewhere in the middle listing the different download files:

List of download files

We are interested in the 32-Bit version although I am working on a 64-Bit machine. For the learning the 32-Bit version is more flexibel and completely sufficient.

If you click the windows installer for python (second line from below) then a download notice will be shown asking for confirmation:

Confirm download of python installer

Select ‘datei speichern’ (download file) and the installer will be  loaded in your download directory.

In the list of files you can also see   a colum with the MD5-Checksum. This is an offer to check whether the file you have downloaded is indeed not corrupted in some way (viruses etc.) To use the MD5-Checksum code You need a MD5-software tool. I found a good description at this site: https://www.it-administrator.de/downloads/software/197801/, which points you to the following product page: https://www.novirusthanks.org/products/md5-checksum-tool/.

This looks quite OK. But if you want to apply it you have to surround some difficulties when you try to search for your file to check with the directory browser. In my case it shows the directory of the super-user first. To get my python download file I have to select the main drive C:\, there I have to select from Users my actual role as user gdh, and then I can find my download folder with the python exe file to be checked. From the web site with the files list I have copied the MD5-Checksum:

MD5-checksum tool at work

Luckily the check looks good. This encourages to install python 3.7.3 by clicking on the python installer.

Python Installer Window

Because I have already installe python I can only modify it or repair or uninstall. If you click it the first time you will be able to select the option Install. In that case it will propose a directory and it will install python. Before You say Yes You can also click the flag ‘Set Path Variable‘. I did this but the interesting point is that it had no effect when using the power shell (see below). Only when I added the path again with the aid of the powershell it took effect.

USING THE POWERSHELL

To get the powershell you have to press the windows button, then a list of Apps (programs) appears. Under the letter ‘W’ you see the windows powershell. Clicking this topic you will detect several versions of the power shell: 64-Bit and 32-Bit (indicated by (x86)), and the old standard version as well as a more enhanced version called integrated script environment (ISE).

I have started with the old, simple standard version. By right-clicking with your mouse you can add the option to attach the powershell to the task bar which makes it easy to call it up again later.

Section of my task bar including icons for normal powershell (left) and integrated script environment (right)

If you click on the powershell icon the powershell window will open:

Powershell window with the command python entered

If you would confirm this command by pressing the enter key — and you would not have set the path variable with the path of the python executing modul python.exe before — then there would appear a message that the command ‘python’ is not known (I cannot demonstrate it here because I have set the path variable on account of this message meanwhile).

There exists a workaround without setting the path variable explicitly by give the whole path of the python modul, like this:

Powershell calling python with explicit path

You see, this works fine. To make life easier I have set the environment path variable with this python execution path. Then you can enter the command python alone and a python environement opens up.

But, wait a moment. Setting the path variable with the editor for the environment variable alone (see above) this has no effect for the powershell! Also the powershell can show the content of the path-variable correctly:

Powershell showing content of path-variable

(This is the version of the path variable after I have added the path with the powershell too!)

To add the path variable for the python modul explicitly in the powershell you can enter the following  command:

PS C:\Users\gdh> $Env:PATH +=”;C:\Users\gdh\AppData\Local\Programs\Python\Python37-32″

When I did this everything worked fine. Don’t ask, why it didn’t work before with the editing of the environment variable PATH alone.  This is at a first glance like ‘Software mystik’. With much more time for research there exists perhaps an explanation. My first guess would be, that the communication between the powershell and the environment variable has some hidden factors. For more very detailed explanations about the powershell and the editing of the environment variable you can find a good document from microsoft here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6.

PROGRAMMING PYTHON

For first programming steps look to the first version of this post beginning at the header FIRST PROGRAMMING STEPS somewhere in the middle of the page.

More coding will follow soon.

STARTING WITH PYTHON 3 – The very beginning

eJournal: uffmm.org,
ISSN 2567-6458, July 1, 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

CONTEXT

The idea is to give some advice to start with python 3 programming. In other posts I have used an integrated package using WinPython including the integrated  development package  spyder. While such an integrated package offers lots of nice tools it hides the basic structures of your system and of the language. Therefore I decided to start again at a more basic level using only the python language and the windows command shell (I myself are working with an ubuntu system for the normal python programming and for the work with a python web-framework called ‘django’). Because I myself am not too much experienced with the windows 10 environment it challenges me to investigate the win10 environment to some degree.

GETTING STARTED FROM SCRATCH: DOWNLOAD PYTHON

To get a fresh start from scratch I have removed all python stuff from my machine.  Then I have downloadad the newest pythion version for windows from https://www.python.org/. This is python version 3.7.3 in the 32-Bit version. There exists also a 64-Bit version, but because not all the different modules are already prepared for the 64-Bit version the 32-Bit version is more flexible. To learn python this is more than enough. To switch to a 64-Bit version would be simple.

LOCAL WINDOWS ENVIRONMENT

On my machine the installation path is:

C:\Users\gerd_2\AppData\Local\Programs\Python\Python37-32

To test whether python works on your windows machine you can activate the WindowsPowerShell. You will find this shell by klicking on the Windows Icon in the left corner of your laptown whic opens the list of all Windows-Apps (programs).  At the end of this list there are some windows-Apps including the Windows-Power-Shell. I took the first one. By clicking on the right mouse-button I selected to attach the power-shell on the task bar. This allows me to click once on the icon of the power shell and the power shell will open.

Typing the command ‘python’ the first time into the command line will cause an error message, because Windows does not know where to find the command ‘python’. You can do two things: (i) enter the whole path for python or (ii) inform the PATH-variable about the python path.

Enter the whole path worked out:

PS C:\Users\gerd_2> C:\Users\gerd_2\AppData\Local\Programs\Python\Python37-32\python

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32

Type “help”, “copyright”, “credits” or “license” for more information.

>>

Because this procedure is a bit cumbersom I tried the other proposal, to edit the PATH-variable. One proposal (from the community) goes like this:

  1. Open the Start Search, type in “env”, and choose “Edit the system environment variables”:
  2. Click the “Environment Variables…” button.
  3. Under the “System Variables” section (the lower half), find the row with “Path” in the first column, and click edit.
  4. The “Edit environment variable” UI will appear.

I could edit the PATH-variable this way, but ist showed no effect. Therefore I tried another procedure, where one can modify the PATH-variable directly from the power-shell. The needed command has the following format:

$Env:PATH += “;Wanted Path”

This addresses the PATH variable, let the actual content as it is and adds after a semicolon the needed path. With the command

$Env:PATH

you can check the actual values of the variable PATH and after adding your new path

PS C:\Users\gerd_2> $Env:PATH +=”;C:\Users\gerd_2\AppData\Local\Programs\Python\Python37-32″

youcan check again. It worked, I got my new path added to  the variable. But, even more important, now it worked. Enterin in the power shell only ‘python’ it worked:

PS C:\Users\gerd_2> python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

I also tried the ‘help-option’ like this:

>>> help()

Welcome to Python 3.7’s help utility!

If this is your first time using Python, you should definitely check out

the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing

Python programs and using Python modules. To quit this help utility and

return to the interpreter, just type “quit”.

To get a list of available modules, keywords, symbols, or topics, type

“modules”, “keywords”, “symbols”, or “topics”. Each module also comes

with a one-line summary of what it does; to list the modules whose name

or summary contain a given string such as “spam”, type “modules spam”.

I tried e.g.  the ‘modules option:

help> modules

Please wait a moment while I gather a list of all available modules…

__future__ _tracemalloc glob secrets

_abc _warnings gzip select

_ast _weakref hashlib selectors

_asyncio _weakrefset heapq setuptools

From this I selected the  ‘socket’-option:

help> socket

Help on module socket:

NAME

socket

DESCRIPTION

This module provides socket operations and some related functions.

On Unix, it supports IP (Internet Protocol) and Unix domain sockets.

On other systems, it only supports IP. Functions specific for a

socket are available as methods of the socket object.

Functions:

socket() — create a new socket object

socketpair() — create a pair of new socket objects [*]

fromfd() — create a socket object from an open file descriptor [*]

fromshare() — create a socket object from data received from socket.share() [*]

Thus this function works and looks promising.

FIRST PROGRAMMING STEPS

The main idea of using python is to be able to write some program code which then the machine can run. The basic processing steps are

  1. Start python in the power shell by typing  ‘python’
  2. Enter some python code you want to test.
  3. If you want to edit many python commands together then take a text editor and write some text which looks like python code.
  4. The text you enter directly into a python command line or a edited text in a file which you can load both will be handed out to the python interpreter which translate these pyton commands into a byte code which in turn will be run by the python virtual machine (PVM).

It is helpful befor you start programming to generate at least one folder where you will store your python programs. Following the proposal from Mark Lutz (see below references) I generate in my main directory a folder called ‘code’:

PS C:\> cd $HOME

PS C:\Users\gerd_2> mkdir code

Verzeichnis: C:\Users\gerd_2

Mode LastWriteTime Length Name

—- ————- —— —-

d—– 01.07.2019 18:40 code

To edit a first simple program with name ‘script1.py’ I have called the notepad editor in the power shell like this:

PS C:\Users\gerd_2\code> notepad script1.py

In the editor I have typed the following simple text:

# FILE: script1.py

import sys

print(sys.platform)

print(2**100)

x=’python’

print(x*8)

Then I have stored this file in the ‘code’ folder. Wih the command ‘dir’ one can have a look into the ‘code’ folder:

PS C:\Users\gerd_2\code> dir

Verzeichnis: C:\Users\gerd_2\code

Mode LastWriteTime Length Name

—- ————- —— —-

-a—- 01.07.2019 18:41 92 script1.py

To check what happens when I load this script with the python interpreter one can enter the following command:

PS C:\Users\gerd_2\code> python script1.py

win32

1267650600228229401496703205376

pythonpythonpythonpythonpythonpythonpythonpython

STREAM REDIRECTION

One can also redirect the output of the python interpreter from the console into a file:

PS C:\Users\gerd_2\code> python script1.py >savesrc.txt

Then one can again call an editor like notepad to read the content of this file:

PS C:\Users\gerd_2\code> notepad savesrc.txt

CONTENT savesrc.txt:

win32

1267650600228229401496703205376

pythonpythonpythonpythonpythonpythonpythonpython

MODULES

Like many other programming language python organizes larger programs by putting together  smaller programs like building blocks. These blocks are called modules and this strategy  can only work if one follows some rules. Mark Lutz formulates it as follows:

“… a module is mostly just a package of variable names, known as a namespace, and the names within that package are called attributes. An attribute is simply a variable name that is attached to a specific object (like a module).” (Lutz, Mark. Learning Python (S.70). O’Reilly Media. Kindle-Version)

One possibility to fetch a module is to use the import command, either directly in a python console or indirectly as command in a python program text. Thus with going direct to the console:

PS C:\Users\gerd_2\code> python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import os
>>> os.getcwd()
‘C:\\Users\\gerd_2\\code’

Here the module ‘os’ has been imported and within tis module exists a function ‘getcwd()’ which fetches the actual path you are in. In my case my home directory and there the folder ‘code’. Doing an import with the new file ‘script1.py’ it works like this:

PS C:\Users\gerd_2\code> python

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32

Type “help”, “copyright”, “credits” or “license” for more information.

>>> import script1

win32

1267650600228229401496703205376

pythonpythonpythonpythonpythonpythonpythonpython

Thus the import also causes a run of the script.

If one wants to know which kinds of names are used in the module one can use the command dir():

>>> dir(script1)

[‘__builtins__’, ‘__cached__’, ‘__doc__’, ‘__file__’, ‘__loader__’, ‘__name__’, ‘__package__’, ‘__spec__’, ‘sys’, ‘x’]

TO BE CONTINUED…

Go back to the main page.

SOME HELPFUL REFERENCES

  • Mark Lutz, Learn Python, 2013,5th ed.,Sebastopol (CA), O’Reilly
  • To get the sources: https://www.python.org/
  • Documentation: https://docs.python.org/3/
  • Python Software Foundation (PSF): https://www.python.org/psf-landing/
  • Python Community: https://www.python.org/community/

REVIEWS

eJournal: uffmm.org,
ISSN 2567-6458, 18.Juni 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

CONTEXT

This post is part of the uffmm science blog and collects reviews of books related to the uffmm subject.

COLLECTION OF REVIEWS

  1. Review of Charles R.Gallistel, (1990), The Organization of Learning. Part 1,
    A Review from a Philosophical Point of View: review-gallistel-part1-C1
  2. Review of Peter Gärdenfors (2014), Geometry of Meaning. Semantics Based on Conceptual Spaces, Part 1, A Review from a Philosophical Point of View: review-gaerdenfors2014-c1-2

 

Remark: There have been many more reviews before this review section but these have been written in German and are located in the philosophy blog of G.Doeben Henisch.

DIGITAL SLAVERY OR DIGITAL EMPOWERMENT?

eJournal: uffmm.org,
ISSN 2567-6458, 21.May 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

Change: 26.May 2019 (Extending from two to three selected authors)

CONTEXT

This text is part of the larger text dealing with the Actor-Actor Interaction (AAI)  paradigm.

OBJECTIVE

In the following text the focus is on the global environment for the AAI approach, the cooperation and/ or competition between societies and the strong impact induced by the new digital technologies. Numerous articles and books are dealing with these phenomena. For the actual  focus  I like to mention especially three books: (i) from the point of view of the technology driver the book of Eric Schmidt and Jared Cohen (2013)  — both from google — seems to be an impressive illustration of what will be possible in the near future;  (ii) from the point of a technology-aware historian the book of Yuval Noah Harari (2018) can help to deepen the impressions and pointing to the more and more difficult role of mankind itself; finally (iii) from the point of view of  a society-thriller author Eric Elsberg (2019) who shows within a quite realistic scenario how a global lack of understanding can turn the countries world wide into a desaster which seems to be un-necessary.

The many, many different aspects of the views of the first two mentioned authors I transform  into one confrontation only: Digital Slavery vs. Digital Empowerment.

DIGITAL SLAVERY
Digital slavery as the actual leading trend in the nations worldwide induced by a digital technology which can be used for this, but this is only one of several options.

Stepping back from the stream of events in everyday life, and looking onto the more general structure working behind and implicit in all these events then one can recognize an incredible collecting behavior of only a few services behind the scene. While the individual user is mostly separated from all the others, empowered by a limited individual knowledge, individual experiences, skills, and preferences, mostly unconscious, his/ her behavior will be stored in central cloud spaces which as such are only single, individual data with a bigger importance. People asked about their data usually do not bother too much about questions of security. An often heared argument in this context says, that they have nothing to hide. They are only normal persons.

What they do not see and which  they cannot see because this is completely hided for others is the fact that  there exists hidden algorithms which can synthesize all these individual data, extracting different kinds of patterns, reconstructing time lines, adding divers connotations, and which can compute some dynamics pointing into a possible future. The hidden owners (the ‘dark lords’) of these storage spaces and algorithms can built up  with these individual data of normal users overall pictures of many hundreds of Millions of users, companies, offices, communal institutions etc., which enable very specific plans and actions to exploit economical, political and military opportunities. With this knowledge they can destroy nearly any kind of company at will and they can introduce new companies before anybody elsewhere has the faintiest idea, that there is a new possibility. This pattern concentrates the capital more and more in a decreasing number of owners and turns more and more people into an anonymous mass of being poor.

The individual user does not know about all this. In his/ her Not-Knowing the user is mutating from a free democratic citizen to a formally perhaps still  free, but materially completely manipulated something. This is not limited to the normal citizen but it holds for Managers, mayors and most kinds of politicians too. Traditional societies are sucked out and are turned into more and more zombie-states.

Is there no chance to overcome this destructive overall scenario?

DIGITAL EMPOWERMENT
Digital empowerment as an alternative approach using digital technologies to empower people, groups, whole nations without the hidden ‘dark lords’.

There are alternatives to the actual digital slavery paradigm.  These alternatives try to help the individual user, citizen, manager, mayor etc. to bridge his/ her isolation by supporting a new kind of team-based modeling of the common reality, which is  stored on public storage spaces, reachable 24 hours every day during a year by all. Here too one can add algorithms which can support the contributing users by simulations, playing modes, oracle-computations, connecting different models into one model, and much more. Such an approach frees the individual out of his individual enclosures, sharing creative ideas, searching together for better solutions, and using modeling techniques, simulation techniques, and several kinds of machine learning (ML) and artificial intelligence (AI) to improve the construction of possible futures much beyond the individual capacities alone.

This alternative approach allows real open knowledge and  real informed democracies. This is not slavery by dark lords but common empowerment by free people.

Who has already read some of the texts related to the AAI paradigm will know that the AAI paradigm covers exactly this empowering  view of  a modern open democratic society.

COOPERATIVE SOCIETIES

At a first glance this idea of a digital empowered society may look as an empty procedure: everybody is enabled to communicate and think with others, but what is with the daily economy which organizes the stream of goods, services, and resources? The main mode of interactions in the beginning of the 21st century seems to demonstrate the inability of the actual open liberal societies to fight inequalities really. The political system appears to be too weak to enable efficient structures.

It is known since years based on mahematical models that a truly cooperative society is much, much more stable as any other kind of a system and even much, much more productive. These insights are not at work world wide. The reason is that the financial and political systems follow models in their heads which are different and which until now are opposing any kind of a change. Several cultural and emotional factors stand against different views, different practices, different procedures. Here improved communication and planning capabilites can be of help.

REFERENCES
  • Marc Elsberg. Gier. Wie weit würdest Du gehen? Blanvalet Publisher (part of  Random House), Munich, 2019
  • Yuval Noah Harari. 21 Lessons for the 21st Century. Spiegel & Grau,
    Penguin Random House, New York, 2018.
  • Eric Schmidt and Jared Cohen. The New Digital Age. Reshaping the
    Future of People, Nations and Business. John Murray, London (UK),
    1 edition, 2013. URL https://www.google.com/search?client=
    ubuntu&channel=fs&q=eric+schmidt+the+new+digital+age+pdf&
    ie=utf-8&oe=utf-8 .

AAI V3 FRONTPAGE

eJournal: uffmm.org,
ISSN 2567-6458, 12.May 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

HISTORY OF THIS PAGE

See end of this page.

CONTEXT

This Theory of Engineering section is part of the uffmm science blog.

OBJECTIVE

This text describes the general procedure how engineers turn a problem into a functioning solution. Usually known under the label of Systems Engineering (SE) the focus in this text is on the first phase of this process where some experts try to analyse a given problem with a first vision of a possible solution to enable a complete solution. This analysis centers around the interaction between different kinds of executive actors (eA) which have to do the job and different kinds of assistive actors (aA) which shall support the executive actors. Historically these interactions have been analyzed under headings like Humanc-Computer Interaction (HCI) or Human-Machine Interaction (HMI). It is due to the developments during the beginning of the 21st century that the author of this text recently has introduced the wording Actor-Actor Interaction (AAI) to cope with the explosion of different kinds of actors on the side of the executive as well as assistive actors. As a consequence the nature of the interactions changed as well.These changes induced a  general re-writing of the traditional HCI/ HMI subject which is not yet finished.

HISTORY OF AAI-TEXT

After a previous post of the new AAI approach I started the first  re-formulation of the general framework of  the AAI theory, which later has been replaced by a more advanced AAI version V2. But even this version became a change candidate and mutated to the   Actor-Cognition Interaction (ACI) paradigm, which still was not the endpoint. Then new arguments grew up to talk rather from the Augmented Collective Intelligence (ACI). Because even this view on the subject can  change again I stopped following the different aspects of the general Actor-Actor Interaction paradigm and decided to keep the general AAI paradigm as the main attractor capable of several more specialized readings.

HISTORY OF UPDATES

(Most recent text at the end of the list)

ACTOR ACTOR INTERACTION [AAI]. Version: June 17, 2019 – V.7: aaicourse-17june2019-incomplete

Change: June 19, 2019 (Update  to version 8; chapter 5 has been rewritten completely).

ACTOR ACTOR INTERACTION [AAI]. Version: June 19, 2019 – V.8: aaicourse-june 19-2019-v8-incomplete

Change: June 19, 2019 (Update to version 8.1; minor corrections in chapter 5)

ACTOR ACTOR INTERACTION [AAI]. Version: June 19, 2019 – V.8.1: aaicourse-june19-2019-v8.1-incomplete

Change: June 23, 2019 (Update to version 9; adding chapter 6 (Dynamic AS) and chapter 7 (Example of dynamic AS with two actors)

ACTOR ACTOR INTERACTION [AAI]. Version: June 23, 2019 – V.9: aaicourse-June-23-2019-V9-incomplete

Change: June 25, 2019 (Update to version 9.1; minor corrections in chapters 1+2)

ACTOR ACTOR INTERACTION [AAI]. Version: June 25, 2019 – V.9.1aaicourse-June25-2019-V9-1-incomplete

Change: June 29, 2019 (Update to version 10; )rewriting of chapter 4 Actor Story on account of changes in the chapters 5-7)

ACTOR ACTOR INTERACTION [AAI]. Version: June 29, 2019 – V.10: aaicourse-June-29-2019-V10-incomplete

Change: June 30, 2019 (Update to version 11; ) completing  chapter  3 Problem Definition)

ACTOR ACTOR INTERACTION [AAI]. Version: June 30, 2019 – V.11: aaicourse-June30-2019-V11-incomplete

Change: June 30, 2019 (Update to version 12; ) new chapter 5 for normative actor stories (NAS) Problem Definition)

ACTOR ACTOR INTERACTION [AAI]. Version: June 30, 2019 – V.12: aaicourse-June30-2019-V12-incomplete

Change: June 30, 2019 (Update to version 13; ) extending chapter 9 with the section about usability testing)

ACTOR ACTOR INTERACTION [AAI]. Version: June 30, 2019 – V.13aaicourse-June30-2019-V13-incomplete

Change: July 8, 2019 (Update to version 13.1 ) some more references to chapter 4; formatting the bibliography alphabetically)

ACTOR ACTOR INTERACTION [AAI]. Version: July 8, 2019 – V.13.1: aaicourse-July8-2019-V13.1-incomplete

Change: July 15, 2019 (Update to version 13.3 ) (In chapter 9 Testing an AS extending the description of Usability Testing with more concrete details to the test procedure)

ACTOR ACTOR INTERACTION [AAI]. Version: July 15, 2019 – V.13.3: aaicourse-13-3

Change: Aug 7, 2019 (Only some minor changes in Chapt. 1 Introduction, pp.15ff, but these changes make clear, that the scope of the AAI analysis can go far beyond the normal analysis. An AAI analysis without explicit actor models (AMs) corresponds to the analysis phase of a systems engineering process (SEP), but an AAI analysis including explicit actor models will cover 50 – 90% of the (logical) design phase too. How much exactly could only be answered if  there would exist an elaborated formal SEP theory with quantifications, but there exists  no such theory. The quantification here is an estimate.)

ACTOR ACTOR INTERACTION [AAI]. Version: Aug 7, 2019 – V.14:aaicourse-14

HISTORY OF CHANGES OF THIS PAGE

Change: May 20, 2019 (Stopping Circulating Acronyms :-))

Change: May 21,  2019 (Adding the Slavery-Empowerment topic)

Change: May 26, 2019 (Improving the general introduction of this first page)

ACI – TWO DIFFERENT READINGS

eJournal: uffmm.org
ISSN 2567-6458, 11.-12.May 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de
Change: May-17, 2019 (Some Corrections, ACI associations)
Change: May-20, 2019 (Reframing ACI with AAI)
CONTEXT

This text is part of the larger text dealing with the Actor-Actor Interaction (AAI)  paradigm.

HCI – HMI – AAI ==> ACI ?

Who has followed the discussion in this blog remembers several different phases in the conceptual frameworks used here.

The first paradigm called Human-Computer Interface (HCI) has been only mentioned by historical reasons.  The next phase Human-Machine Interaction (HMI) was the main paradigm in the beginning of my lecturing in 2005. Later, somewhere 2011/2012, I switched to the paradigm Actor-Actor Interaction (AAI) because I tried to generalize over  the different participating machines, robots, smart interfaces, humans as well as animals. This worked quite nice and some time I thought that this is now the final formula. But reality is often different compared to  our thinking. Many occasions showed up where the generalization beyond the human actor seemed to hide the real processes which are going on, especially I got the impression that very important factors rooted in the special human actor became invisible although they are playing decisive role in many  processes. Another punch against the AAI view came from application scenarios during the last year when I started to deal with whole cities as actors. At the end  I got the feeling that the more specialized expressions like   Actor-Cognition Interaction (ACI) or  Augmented Collective Intelligence (ACI) can indeed help  to stress certain  special properties  better than the more abstract AAI acronym, but using structures like ACI  within general theories and within complex computing environments it became clear that the more abstract acronym AAI is in the end more versatile and simplifies the general structures. ACI became a special sub-case

HISTORY

To understand this oscillation between AAI and  ACI one has to look back into the history of Human Computer/ Machine Interaction, but not only until the end of the World War II, but into the more extended evolutionary history of mankind on this planet.

It is a widespread opinion under the researchers that the development of tools to help mastering material processes was one of the outstanding events which changed the path of  the evolution a lot.  A next step was the development of tools to support human cognition like scripture, numbers, mathematics, books, libraries etc. In this last case of cognitive tools the material of the cognitive  tools was not the primary subject the processes but the cognitive contents, structures, even processes encoded by the material structures of the tools.

Only slowly mankind understood how the cognitive abilities and capabilities are rooted in the body, in the brain, and that the brain represents a rather complex biological machinery which enables a huge amount of cognitive functions, often interacting with each other;  these cognitive functions show in the light of observable behavior clear limits with regard to the amount of features which can be processed in some time interval, with regard to precision, with regard to working interconnections, and more. And therefore it has been understood that the different kinds of cognitive tools are very important to support human thinking and to enforce it in some ways.

Only in the 20th century mankind was able to built a cognitive tool called computer which could show   capabilities which resembled some human cognitive capabilities and which even surpassed human capabilities in some limited areas. Since then these machines have developed a lot (not by themselves but by the thinking and the engineering of humans!) and meanwhile the number and variety of capabilities where the computer seems to resemble a human person or surpasses human capabilities have extend in a way that it has become a common slang to talk about intelligent machines or smart devices.

While the original intention for the development of computers was to improve the cognitive tools with the intend  to support human beings one can  get today  the impression as if the computer has turned into a goal on its own: the intelligent and then — as supposed — the super-intelligent computer appears now as the primary goal and mankind appears as some old relic which has to be surpassed soon.

As will be shown later in this text this vision of the computer surpassing mankind has some assumptions which are

What seems possible and what seems to be a promising roadmap into the future is a continuous step-wise enhancement of the biological structure of mankind which absorbs the modern computing technology by new cognitive interfaces which in turn presuppose new types of physical interfaces.

To give a precise definition of these new upcoming structures and functions is not yet possible, but to identify the actual driving factors as well as the exciting combinations of factors seems possible.

COGNITION EMBEDDED IN MATTER
Actor-Cognition Interaction (ACI): A simple outline of the whole paradigm
Cognition within the Actor-Actor Interaction (AAI)  paradigm: A simple outline of the whole paradigm

The main idea is the shift of the focus away from the physical grounding of the interaction between actors looking instead more to the cognitive contents and processes, which shall be mediated  by the physical conditions. Clearly the analysis of the physical conditions as well as the optimal design of these physical conditions is still a challenge and a task, but without a clear knowledge manifested in a clear model about the intended cognitive contents and processes one has not enough knowledge for the design of the physical layout.

SOLVING A PROBLEM

Thus the starting point of an engineering process is a group of people (the stakeholders (SH)) which identify some problem (P) in their environment and which have some minimal idea of a possible solution (S) for this problem. This can be commented by some non-functional requirements (NFRs) articulating some more general properties which shall hold through the whole solution (e.g. ‘being save’, ‘being barrier-free’, ‘being real-time’ etc.). If the description of the problem with a first intended solution including the NFRs contains at least one task (T) to be solved, minimal intended users (U) (here called executive actors (eA)), minimal intended assistive actors (aA) to assist the user in doing the task, as well as a description of the environment of the task to do, then the minimal ACI-Check can be passed and the ACI analysis process can be started.

COGNITION AND AUGMENTED COLLECTIVE INTELLIGENCE

If we talk about cognition then we think usually about cognitive processes in an individual person.  But in the real world there is no cognition without an ongoing exchange between different individuals by communicative acts. Furthermore it has to be taken into account that the cognition of an individual person is in itself partitioned into two unequal parts: the unconscious part which covers about 99% of all the processes in the body and in the brain and about 1% which covers the conscious part. That an individual person can think somehow something this person has to trigger his own unconsciousness by stimuli to respond with some messages from his before unknown knowledge. Thus even an individual person alone has to organize a communication with his own unconsciousness to be able to have some conscious knowledge about its own unconscious knowledge. And because no individual person has at a certain point of time a clear knowledge of his unconscious knowledge  the person even does not really know what to look for — if there is no event, not perception, no question and the like which triggers the person to interact with its unconscious knowledge (and experience) to get some messages from this unconscious machinery, which — as it seems — is working all the time.

On account of this   logic of the individual internal communication with the individual cognition  an external communication with the world and the manifested cognition of other persons appears as a possible enrichment in the   interactions with the distributed knowledge in the different persons. While in the following approach it is assumed to represent the different knowledge responses in a common symbolic representation viewable (and hearable)  from all participating persons it is growing up a possible picture of something which is generally more rich, having more facets than a picture generated by an individual person alone. Furthermore can such a procedure help all participants to synchronize their different knowledge fragments in a bigger picture and use it further on as their own picture, which in turn can trigger even more aspects out of the distributed unconscious knowledge.

If one organizes this collective triggering of distributed unconscious knowledge within a communication process not only by static symbolic models but beyond this with dynamic rules for changes, which can be interactively simulated or even played with defined states of interest then the effect of expanding the explicit and shared knowledge will be boosted even more.

From this background it makes some sense to turn the wording Actor-Cognition Interaction into the wording Augmented Collective Intelligence where Intelligence is the component of dynamic cognition in a system — here a human person –, Collective means that different individual person are sharing their unconscious knowledge by communicative interactions, and Augmented can be interpreted that one enhances, extends this sharing of knowledge by using new tools of modeling, simulation and gaming, which expands and intensifies the individual learning as well as the commonly shared opinions. For nearly all problems today this appears to be  absolutely necessary.

ACI ANALYSIS PROCESS

Here it will be assumed that there exists a group of ACI experts which can supervise  other actors (stakeholders, domain experts, …) in a process to analyze the problem P with the explicit goal of finding a satisfying solution (S+).

For the whole ACI analysis process an appropriate ACI software should be available to support the ACI experts as well as all the other domain experts.

In this ACI analysis process one can distinguish two main phases: (1) Construct an actor story (AS) which describes all intended states and intended changes within the actor story. (2) Make several tests of the actor story to exploit their explanatory power.

ACTOR STORY (AS)

The actor story describes all possible states (S) of the tasks (T) to be realized to reach intended goal states (S+). A mapping from one state to a follow-up state will be described by a change rule (X). Thus having start state (S0) and appropriate change rules one can construct the follow-up states from the actual state (S*)  with the aid of the change rules. Formally this computation of the follow-up state (S’) will be computed by a simulator function (σ), written as: σ: S* x X  —> S.

SEVERAL TESTS

With the aid of an explicit actor story (AS) one can define the non-functional requirements (NFRs) in a way that it will become decidable whether  a NFR is valid with regard to an actor story or not. In this case this test of being valid can be done as an automated verification process (AVP). Part of this test paradigm is the so-called oracle function (OF) where one can pose a question to the system and the system will answer the question with regard to all theoretically possible states without the necessity to run a (passive) simulation.

If the size of the group is large and it is important that all members of the group have a sufficient similar knowledge about the problem(s) in question (as it is the usual case in a city with different kinds of citizens) then is can be very helpful to enable interactive simulations or even games, which allow a more direct experience of the possible states and changes. Furthermore, because the participants can act according to their individual reflections and goals the process becomes highly uncertain and nearly unpredictable. Especially for these highly unpredictable processes can interactive simulations (and games) help to improve a common understanding of the involved factors and their effects. The difference between a normal interactive simulation and a game is given in the fact that a game has explicit win-states whereas the interactive simulations doesn’t. Explicit win-states can improve learning a lot.

The other interesting question is whether an actor story AS with a certain idea for an assistive actor (aA) is usable for the executive actors. This requires explicit measurements of the usability which in turn requires a clear norm of reference with which the behavior of an executive actor (eA) during a process can be compared. Usually is the actor Story as such the norm of reference with which the observable behavior of the executing actors will be compared. Thus for the measurement one needs real executive actors which represent the intended executive actors and one needs a physical realization of the intended assistive actors called mock-up. A mock-up is not yet  the final implementation of the intended assistive actor but a physical entity which can show all important physical properties of the intended assistive actor in a way which allows a real test run. While in the past it has been assumed to be sufficient to test a test person only once it is here assumed that a test person has to be tested at least three times. This follows from the assumption that every executive (biological) actor is inherently a learning system. This implies that the test person will behave differently in different tests. The degree of changes can be a hint of the easiness and the learnability of the assistive actor.

COLLECTIVE MEMORY

If an appropriate ACI software is available then one can consider an actor story as a simple theory (ST) embracing a model (M) and a collection of rules (R) — ST(x) iff x = <M,R> –which can be used as a kind of a     building block which in turn can be combined with other such building blocks resulting in a complex network of simple theories. If these simple theories are stored in a  public available data base (like a library of theories) then one can built up in time a large knowledge base on their own.

 

 

ENGINEERING AND SOCIETY: The Role of Preferences

eJournal: uffmm.org,
ISSN 2567-6458, 4.May 2019
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

FINAL HYPOTHESIS

This suggests that a symbiosis between creative humans and computing algorithms is an attractive pairing. For this we have to re-invent our official  learning processes in schools and universities to train the next generation of humans in a more inspired and creative usage of algorithms in a game-like learning processes.

CONTEXT

The overall context is given by the description of the Actor-Actor Interaction (AAI) paradigm as a whole.  In this text the special relationship between engineering and the surrounding society is in the focus. And within this very broad and rich relationship the main interest lies in the ethical dimension here understood as those preferences of a society which are more supported than others. It is assumed that such preferences manifesting themselves  in real actions within a space of many other options are pointing to hidden values which guide the decisions of the members of a society. Thus values are hypothetical constructs based on observable actions within a cognitively assumed space of possible alternatives. These cognitively represented possibilities are usually only given in a mixture of explicitly stated symbolic statements and different unconscious factors which are influencing the decisions which are causing the observable actions.

These assumptions represent  until today not a common opinion and are not condensed in some theoretical text. Nevertheless I am using these assumptions here because they help to shed some light on the rather complex process of finding a real solution to a stated problem which is rooted in the cognitive space of the participants of the engineering process. To work with these assumptions in concrete development processes can support a further clarification of all these concepts.

ENGINEERING AND SOCIETY

DUAL: REAL AND COGNITIVE

The relationship between an engineering process and the preferences of a society
The relationship between an engineering process and the preferences of a society

As assumed in the AAI paradigm the engineering process is that process which connects the  event of  stating a problem combined with a first vision of a solution with a final concrete working solution.

The main characteristic of such an engineering process is the dual character of a continuous interaction between the cognitive space of all participants of the process with real world objects, actions, and processes. The real world as such is a lose collection of real things, to some extend connected by regularities inherent in natural things, but the visions of possible states, possible different connections, possible new processes is bound to the cognitive space of biological actors, especially to humans as exemplars of the homo sapiens species.

Thus it is a major factor of training, learning, and education in general to see how the real world can be mapped into some cognitive structures, how the cognitive structures can be transformed by cognitive operations into new structures and how these new cognitive structures can be re-mapped into the real world of bodies.

Within the cognitive dimension exists nearly infinite sets of possible alternatives, which all indicate possible states of a world, whose feasibility is more or less convincing. Limited by time and resources it is usually not possible to explore all these cognitively tapped spaces whether and how they work, what are possible side effects etc.

PREFERENCES

Somehow by nature, somehow by past experience biological system — like the home sapiens — have developed   cultural procedures to induce preferences how one selects possible options, which one should be selected, under which circumstances and with even more constraints. In some situations these preferences can be helpful, in others they can  hide possibilities which afterwards can be  re-detected as being very valuable.

Thus every engineering process which starts  a transformation process from some cognitively given point of view to a new cognitively point of view with a following up translation into some real thing is sharing its cognitive space with possible preferences of  the cognitive space of the surrounding society.

It is an open case whether the engineers as the experts have an experimental, creative attitude to explore without dogmatic constraints the   possible cognitive spaces to find new solutions which can improve life or not. If one assumes that there exist no absolute preferences on account of the substantially limit knowledge of mankind at every point of time and inferring from this fact the necessity to extend an actual knowledge further to enable the mastering of an open unknown future then the engineers will try to explore seriously all possibilities without constraints to extend the power of engineering deeper into the heart of the known as well as unknown universe.

EXPLORING COGNITIVE POSSIBILITIES

At the start one has only a rough description of the problem and a rough vision of a wanted solution which gives some direction for the search of an optimal solution. This direction represents also a kind of a preference what is wanted as the outcome of the process.

On account of the inherent duality of human thinking and communication embracing the cognitive space as well as the realm of real things which both are connected by complex mappings realized by the brain which operates  nearly completely unconscious a long process of concrete real and cognitive actions is necessary to materialize cognitive realities within a  communication process. Main modes of materialization are the usage of symbolic languages, paintings (diagrams), physical models, algorithms for computation and simulations, and especially gaming (in several different modes).

As everybody can know  these communication processes are not simple, can be a source of  confusions, and the coordination of different brains with different cognitive spaces as well as different layouts of unconscious factors  is a difficult and very demanding endeavor.

The communication mode gaming is of a special interest here  because it is one of the oldest and most natural modes to learn but in the official education processes in schools and  universities (and in companies) it was until recently not part of the official curricula. But it is the only mode where one can exercise the dimensions of preferences explicitly in combination with an exploring process and — if one wants — with the explicit social dimension of having more than one brain involved.

In the last about 50 – 100 years the term project has gained more and more acceptance and indeed the organization of projects resembles a game but it is usually handled as a hierarchical, constraints-driven process where creativity and concurrent developing (= gaming) is not a main topic. Even if companies allow concurrent development teams these teams are cognitively separated and the implicit cognitive structures are black boxes which can not be evaluated as such.

In the presupposed AAI paradigm here the open creative space has a high priority to increase the chance for innovation. Innovation is the most valuable property in face of an unknown future!

While the open space for a real creativity has to be executed in all the mentioned modes of communication the final gaming mode is of special importance.  To enable a gaming process one has explicitly to define explicit win-lose states. This  objectifies values/ preferences hidden   in the cognitive space before. Such an  objectification makes things transparent, enables more rationality and allows the explicit testing of these defined win-lose states as feasible or not. Only tested hypothesis represent tested empirical knowledge. And because in a gaming mode whole groups or even all members of a social network can participate in a  learning process of the functioning and possible outcome of a presented solution everybody can be included.  This implies a common sharing of experience and knowledge which simplifies the communication and therefore the coordination of the different brains with their unconsciousness a lot.

TESTING AND EVALUATION

Testing a proposed solution is another expression for measuring the solution. Measuring is understood here as a basic comparison between the target to be measured (here the proposed solution) and the before agreed norm which shall be used as point of reference for the comparison.

But what can be a before agreed norm?

Some aspects can be mentioned here:

  1. First of all there is the proposed solution as such, which is here a proposal for a possible assistive actor in an assumed environment for some intended executive actors which has to fulfill some job (task).
  2. Part of this proposed solution are given constraints and non-functional requirements.
  3. Part of this proposed solution are some preferences as win-lose states which have to be reached.
  4. Another difficult to define factor are the executive actors if they are biological systems. Biological systems with their basic built in ability to act free, to be learning systems, and this associated with a not-definable large unconscious realm.

Given the explicit preferences constrained by many assumptions one can test only, whether the invited test persons understood as possible instances of the  intended executive actors are able to fulfill the defined task(s) in some predefined amount of time within an allowed threshold of making errors with an expected percentage of solved sub-tasks together with a sufficient subjective satisfaction with the whole process.

But because biological executive actors are learning systems they  will behave in different repeated  tests differently, they can furthermore change their motivations and   their interests, they can change their emotional commitment, and because of their   built-in basic freedom to act there can be no 100% probability that they will act at time t as they have acted all the time before.

Thus for all kinds of jobs where the process is more or less fixed, where nothing new  will happen, the participation of biological executive actors in such a process is questionable. It seems (hypothesis), that biological executing actors are better placed  in jobs where there is some minimal rate of curiosity, of innovation, and of creativity combined with learning.

If this hypothesis is empirically sound (as it seems), then all jobs where human persons are involved should have more the character of games then something else.

It is an interesting side note that the actual research in robotics under the label of developmental robotics is struck by the problem how one can make robots continuously learning following interesting preferences. Given a preference an algorithm can work — under certain circumstances — often better than a human person to find an optimal solution, but lacking such a preference the algorithm is lost. And actually there exists not the faintest idea how algorithms should acquire that kind of preferences which are interesting and important for an unknown future.

On the contrary, humans are known to be creative, innovative, detecting new preferences etc. but they have only limited capacities to explore these creative findings until some telling endpoint.

This suggests that a symbiosis between creative humans and computing algorithms is an attractive pairing. For this we have to re-invent our official  learning processes in schools and universities to train the next generation of humans in a more inspired and creative usage of algorithms in a game-like learning processes.