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.

 

 

ACTOR-ACTOR INTERACTION [AAI] WITHIN A SYSTEMS ENGINEERING PROCESS (SEP). An Actor Centered Approach to Problem Solving

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

ATTENTION: The actual Version  you will find HERE.

Draft version 22.June 2018

Update 26.June 2018 (Chapter AS-AM Summary)

Update 4.July 2018 (Chapter 4 Actor Model; improving the terminology of environments with actors, actors as input-output systems, basic and real interface, a first typology of input-output systems…)

Update 17.July 2018 (Preface, Introduction new)

Update 19.July 2018 (Introduction final paragraph!, new chapters!)

Update 20.July 2018 (Disentanglement of chapter ‘Simulation & Verification’ into two independent chapters; corrections in the chapter ‘Introduction’; corrections in chapter ‘AAI Analysis’; extracting ‘Simulation’ from chapter ‘Actor Story’ to new chapter ‘Simulation’; New chapter ‘Simulation’; Rewriting of chapter ‘Looking Forward’)

Update 22.July 2018 (Rewriting the beginning of the chapter ‘Actor Story (AS)’, not completed; converting chapter ‘AS+AM Summary’ to ‘AS and AM Philosophy’, not completed)

Update 23.July 2018 (Attaching a new chapter with a Case Study illustrating an actor story (AS). This case study is still unfinished. It is a case study of  a real project!)

Update 7.August 2018 (Modifying chapter Actor Story, the introduction)

Update 8.August 2018 (Modifying chapter  AS as Text, Comic, Graph; especially section about the textual mode and the pictorial mode; first sketch for a mapping from the textual mode into the pictorial mode)

Update 9.August 2018 (Modification of the section ‘Mathematical Actor Story (MAS) in chapter 4).

Update 11.August 2018 (Improving chapter 3 ‘Actor Story; nearly complete rewriting of chapter 4 ‘AS as text, comic, graph’.)

Update 12.August 2018 (Minor corrections in the chapters 3+4)

Update 13.August 2018 (I am still catched by the chapters 3+4. In chapter  the cognitive structure of the actors has been further enhanced; in chapter 4 a complete example of a mathematical actor story could now been attached.)

Update 14.August 2018 (minor corrections to chapter 4 + 5; change-statements define for each state individual combinatorial spaces (a little bit like a quantum state); whether and how these spaces will be concretized/ realized depends completely from the participating actors)

Update 15.August 2018 (Canceled the appendix with the case study stub and replaced it with an overview for  a supporting software tool which is needed for the real usage of this theory. At the moment it is open who will write the software.)

Update 2.October 2018 (Configuring the whole book now with 3 parts: I. Theory, II. Application, III. Software. Gerd has his focus on part I, Zeynep will focus on part II and ‘somebody’ will focus on part III (in the worst case we will — nevertheless — have a minimal version :-)). For a first quick overview about everything read the ‘Preface’ and the ‘Introduction’.

Update 4.November 2018 (Rewriting the Introduction (and some minor corrections in the Preface). The idea of the rewriting was to address all the topics which will be discussed in the book and pointing out to the logical connections between them. This induces some wrong links in the following chapters, which are not yet updated. Some chapters are yet completely missing. But to improve the clearness of the focus and the logical inter-dependencies helps to elaborate the missing texts a lot. Another change is the wording of the title. Until now it is difficult to find a title which is exactly matching the content. The new proposal shows the focus ‘AAI’ but lists the keywords of the main topics within AAA analysis because these topics are usually not necessarily associated with AAI.)

ACTOR-ACTOR INTERACTION [AAI]. An Actor Centered Approach to Problem Solving. Combining Engineering and Philosophy

by

GERD DOEBEN-HENISCH in cooperation with  LOUWRENCE ERASMUS, ZEYNEP TUNCER

LATEST  VERSION AS PDF

BACKGROUND INFORMATION 19.Dec.2018: Application domain ‘Communal Planning and e-Gaming’

BACKGROUND INFORMATION 24.Dec.2018: The AAI-paradigm and Quantum Logic

PRE-VIEW: NEW EXPANDED AAI THEORY 23.January 2019: Outline of the new expanded  AAI Paradigm. Before re-writing the main text with these ideas the new advanced AAI theory will first be tested during the summer 2019 within a lecture with student teams as well as in  several workshops outside the Frankfurt University of Applied Sciences with members of different institutions.

AAI – Actor-Actor Interaction. A Toy-Example, No.1

eJournal: uffmm.org, ISSN 2567-6458
13.Dec.2017
Email: info@uffmm.org

Author: Gerd Doeben-Henisch
Email: gerd@doeben-henisch.de

Contents

1 Problem ….. 3
2 AAI-Check ….. 3
3 Actor-Story (AS) …..  3
3.1 AS as a Text . . . . . . . . . . . . . . . . . .3
3.2 Translation of a Textual AS into a Formal AS …… 4
3.3 AS as a Formal Expression . . . . . . . . . .4
3.4 Translation of a Formal AS into a Pictorial AS… 5
4 Actor-Model (AM) …..  5
4.1 AM for the User as a Text . . . . . . . . . . . . . . . . . . . . . . . . . .  . . . .6
4.2 AM for the System as a Text . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5 Combined AS and AM as a Text …..  6
5.1 AM as an Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6 Simulation …..  7
6.1 Simulating the AS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
6.2 Simulating the AM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
6.3 Simulating AS with AM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
7 Appendix: Formalisms ….. 8
7.1 Set of Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
7.2 Predicate Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
8 Appendix: The Meaning of Expressions …11
8.1 States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
8.2 Changes by Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Abstract

Following the general concepts of the paper ’AAI – Actor-Actor Interaction. A Philosophy of Science View’ from 3.Oct.2017 this paper illustrates a simple application where the difference as well as the
interaction between an actor story and several actor models is shown. The details of interface-design as well as the usability-testing are not part of this example.(This example replaces the paper with the title
’AAI – Case Study Actor Story with Actor Model. Simple Grid-Environment’ from 15.Nov.2017). One special point is the meaning of the formal expressions of the actor story.

Attention: This toy example is not yet in fully conformance with the newly published Case-Study-Template

To read the full text see PDF

Clearly, one can debate whether a ‘toy-example’ makes sens, but the complexity of the concepts in this AAI-approach is to great to illustrate these in the beginning  with a realistic example without loosing the idea. The author of the paper has tried many — also very advanced — versions in the last years and this is the first time that he himself has the feeling that at least the idea is now clear enough. And from teaching students it is very clear, if you cannot explain an idea in a toy-example you never will be able to apply it to real big problems…

 

INTELLIGENT MACHINES – INTRODUCTION

Scientific Workplace For an Integrated Engineering of the Future
eJournal uffmm.org ISSN 2567-6458 (info@uffmm.org)

by
Gerd Doeben-Henisch
(gerd@doeben-henisch.de)

PDF

OVERVIEW

A short story telling You, (i) how we interface the intelligent machines (IM) part with the actor-actor interaction (AAI) part, (ii) a first working definition of intelligent machines (IM) in this text, and (iii) defining intelligence and how one can this measure.

IM WITHIN AAI

In this blog we see IM not isolated, as a stand alone endeavor, but as embedded in a discipline called actor-actor interaction (AAI)(Comment: For a more detailed description see the AAI-part in this blog). AAI investigates complex tasks and looks how different kinds of actors are interacting in these contexts with technical systems. As far as the participating systems have been technical systems one spoke here of a system interface (SI) as that part of a technical system, which is interacting with the human actor. In the case of biological systems (mostly humans, but it could be animals as well), one spoke of the user interface (UI). In this text we generalize both cases by the general concept of an actor — biological and non-biological –, which has some actor interface (ActI), and this actor interface embraces all properties which are relevant for the interactions of the actor.

For the analysis of the behavior of actors in such task-environments one can distinguish two important concepts: the actor story (AS) describing the context as an observable process, as well as different actor models (AM). Actor models are special extensions of an actor story because an actor model describes the observable behavior of actors as a behavior function (BF) with a set of assumptions about possible internal states of the actors. The assumptions about possible internal states (IS) are either completely arbitrary or empirically motivated.

The embedding of IM within AAI can be realized through the concept of an actor model (UM) and the actor story (AS). Whatever is important for something which is called an intelligent machine application (IMA) can be defined as an actor model within an actor story. This embedding of IM within AAI offers many advantages.

This has to be explained with some more details.

An Intelligent Machine (IM) in an Actor Story

Let us assume that there exists a mathematical-graph representation of an actor story written as AS_{L_{ε}}. Such a graph has nodes which represent situations. Formally these are sets of properties, probably more fine-grained by subsets which represent different kinds of actors embedded in this situation as well as different kinds of non-actors.

Actors can be classified (as introduced above) as either biological actors (BA) or non-biological actors (NBA). Both kinds of actors can — in another reading — be subsumed under the general term of input-output-systems (IO-SYS). An input-output system can be a learning system or non-learning. Another basic property is that of being intelligent or non-intelligent. Being a learning system and being an intelligent system is usually strongly connected, but this must not necessarily be so. Being a learning system can be associated with being non-intelligent and being intelligent can be connected with being non-learning.(cf. Figure 1)

Classification of input-output systems according to learning, intelligence and beeing biological or not biological
Classification of input-output systems according to learning, intelligence and being biological or non-biological

While biological systems are always learning and intelligent, one can find non-biological systems of all types: non-learning and non-intelligent, non-intelligent and learning, non-learning and intelligent, and learning and intelligent.

Learning System

To classify a system as a learning system this requires the general ability to change the behavior of this system in time thus that there exists a time-span (t1,t2) after which the behavior to certain critical stimuli has changed compared to the time before (cf. Shettleworth (1994)). From this requirement it follows, that a learning system is an input-output system with at least one internal state which can change. Thus we have the general assumption:

Def: Learning System (LS)

  1. LS(x) iff
  2. x=<I, O, IS, phi >
  3. phi: I x IS —> IS x O
  4. I := Input
  5. O := Output
  6. IS := Internal statesSome x is a learning system (LS) if it is a structure containing sets for input (I), Output (O), as well as internal states (IS). These sets are operated by a behavior function \phi which maps inputs and actual internal states to output as well as back to internal states. The set of possible learning functions is infinite.

    Intelligent System

    The term ‘intelligent’ and ‘intelligence’ is until now not standardized. This means that everybody is using it at little bit arbitrarily.

    In this text we take the basic idea of a scientific usage of the term ‘intelligence’ from experimental psychology, which has developed clearly defined operational concepts since the end of the 19. Century which have been proved as quite stable in their empirical applications.\footnote{For an introduction in the field of psychological intelligence concepts see HilgardEt:1979, Rost:2009, Rost:2013

    The central idea of the psychological concept of the usage of the term ‘intelligence’ is to associate the usage of the term ‘intelligence’ with observable behavior of those actors, which shall be classified according defined methods of measurement.

    In the case of experimental psychology the actors have been biological systems, mainly humans, in the first years of the research school children of certain ages. Because nobody did know what ‘intelligence’ means ‘as such’ one agreed to accept the observable behavior of children in certain task environments as ‘manifestations’ of a ‘presupposed unknown intelligence’. Thus the ability of children to solve defined tasks in a certain defined manner became a norm for what is called ‘intelligence’. Solving the tasks in a certain time with less than a certain amount of errors was used as a ‘baseline’ and all behavior deviating from the baseline was ‘better’ or ‘poorer’.

    Thus the ‘content’ of the ‘meaning’ of the term ‘intelligence’ has been delegated to historical patterns of behavior which were common in a certain time-span in a certain geographical and cultural region.

    While these behavior patterns can change during the course of time the general method of measurement is invariant.

    In the time since then experimental psychology has modified and elaborated this first concept in some directions.

    One direction is the modification of the kind of tasks which are used for the tests. With regard to the cultural context one has modified the content, thereby looking to find such kinds of task which seem to be ‘invariant’ with regard to the presupposed intelligence factor. This is an ongoing process.

    The other direction is the focus on the actors as such. Because biological systems like humans change the development of their intelligence with age one has tried to find out ‘typical tasks for every age’. This too is an ongoing process.

    This history of experimental psychology gives very interesting examples how one can approach the problem of the usage and the measurement of some X which we call ‘intelligence’.

    In the context of an AAI-approach we have not only biological systems, but also non-biological systems. Thus most of the elaborated parameters of psychology for human actors are not general enough.

    One possible strategy to generalize the intelligence-paradigm of experimental psychology could be to ‘free’ the selection of task sets from the narrow human cultures of the past and require only ‘clearly defined task sets with defined interfaces and defined contexts’. All these tasks sets can be arranged either in one super-set or in a parametrized field of sets. The sum of all these sets defines then a space of possible behavior and associated with this a space of possible measurable intelligence.

    A task has then to be given as an actor story according to the AAI-paradigm. Such a specified actor story allows the formal definition of a complexity measure which can be used to measure the ‘amount of intelligence necessary to solve such a task’.

    With such a more general and extendable approach to the measurement of observable intelligence one can compare all kinds of systems with each other. With such an approach one can further show objectively, where biological and non-biological systems differ, where they are similar, and to which extend they differ.

    Measuring Intelligence by Actor Stories

    Presupposing actor stories (AS) (ideally formalized as mathematical graphs) on can define a first operational general measurement of intelligence.

    Def: Task-Intelligence of a task τ (TInt(τ))

        1. Every defined task τ represents a graph g with one shortest path pmin(τ)= π_{min} from a start node to a goal node.
        2. Every such shortest path π_{min} has a certain number of nodes path-nodes(π_{min})=ν.
        3. The number of solved nodes (ν_{solved}) can become related against the total number of nodes ν as ν_{solved}/ν. We take TInt(τ)= ν_{solved}/ν. It follows that TInt(τ) is between 0 and 1: 0 ≤ TInt(τ)≤ 1.
        4. To every task is attached a maximal duration Δ_{max}; all nodes which are solved within this maximal duration time Δ_{max} are declared as ‘solved’, all the others as ‘un-solved’.

    The usual case will require more than one task to be realized. Thus we introduce the concept of a task field (TF).

    Def: Task-Field of type x (TF_{x})
    Def: Task-Field Intelligence (TFInt)

    A task-field TF of type x includes a finite set of individual tasks like TF_{x} = { τ{x.1}, τ{x.2}, … , τ{x.n} } with n ≥ 2. The sum of all individual task intelligence values TInt(τ{x.i}) has to be normalized to 1, i.e. (TInt(τ{x.1}) + TInt(τ{x.2}) + … + TInt(τ{x.n}))/ n (with 0 in the nominator not allowed). Thus the value of the intelligence of a task field of type x TFInt(TF_{x}) is again in the domain of [0,1].

    Because the different tasks in a task field TF can be of different difficulty it should be possible to introduce some weighting for the individual task intelligence values. This should not change the general mechanism.

    Def: Combined Task-Fields (TF)

    In face of the huge variety of possible task fields in this world it can make sens to introduce more general layers by grouping task fields of different types together to larger combined fields, like TF_{x,…,z} = TF_{x} ∪ TF_{y} ∪ … ∪ TF_{z}. The task field intelligence TFInt of such combined task fields would be computed as before.

    Def: Omega Task-Field at time t (TF_{ω}(t))

    The most comprehensive assembly of such combinations shall here be called the Omega-Task-Field at time t TF_{ω}(t). This indicates the known maximum of intelligence measurements at that point of time.

    Measurement Comments

    With these assumptions the term intelligence will be restricted to clearly defined domains either to an individual task, to a task-field of type x, or to some grouped task-fields or being related to the actual omega task-field. In every such domain the intelligence value is in the realm of [0,1] or written as some value between 0 or 100%.

    Independent of the type of an actor — biological or not — one can measure the intelligence of such an actor with the same domains of defined tasks. As a result one can easily compare all known actors with regard to such defined task domains.

    Because the acting actors can be quite different by their input-output capabilities it follows that every actor has to organize some interface which enables him to use the defined task. There are no special restrictions to the format of such an interface, but there is one requirement which has to be observed strictly: the interface as such is not allowed to do any kind of computation beyond providing only the necessary input from the task domain or to provide the necessary output to the domain. Only then are the different tests able to reveal some difference between the different actors.

    If the tests show differences between certain types of actors with regard to a certain task or a task-field then this is a chance to develop smart assistive interfaces which can help the actor in question to overcome his weakness compared to the other type of actor. Thus this kind of measuring intelligence can be a strong supporter for a better world in the future.

    Another consequence of the differing intelligence values can be to look to the inner structure of an actor with weaker values and asking how one could improve his capabilities. This can be done e.g. by different kinds of trainings or by improving his system structures.