Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited

Artificial Intelligence

Hoping this will spark a huge discussion on what everyone is looking for when it comes to their robot's AI.

AI is something I've been working on since before I even learned of EZ-Robots. My JARVIS replica from IronMan is coming up to being 3 years old come December and, while not started in EZ-Builder, over the last few months I've been porting parts over to ARC and those which are beyond the capabilities of ARC are integrated via Telnet. These include such things as voice controlled media playback, voice activated control of appliances, lights etc. and, well to be honest, far more than I can really explain right now.

Basically, up until now it is entirely built around home automation and automated media acquisition, storage, playback and logging. Recently I have been integrating and porting over parts of it in to ARC and where ARC is not capable of carrying out the actions, integration via Telnet so that ARC (and it's scripts) are aware of everything they need to be aware of (i.e. if media playback starts, EventGhost sends ARC a script command $mediaplayback = 1, when it's finished it sends $mediaplayback = 0 (that's a very simple example, it also sends more info on the media). This will be demonstrated soon by Melvin when I get around to making the video of him knowing what's on TV.

Like I said, so far it's mainly based around Media and Home Automation. What I want to discuss is...

What do you want in your robot's AI?

What do you want him/her to be able to do without human interaction?
What do you want him/her to react or respond to?
What do you want the AI to enhance?
Why do you want AI?

And, for anyone who already has some kind of AI running;
What does your AI add to your robot?

Hopefully this will spark up some interesting conversation, get some ideas out there, inspire others (and myself) to push on with the AI and make robots more intelligent:)


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
PRO
Synthiam
#109  
Something for you to consider... I know the PandoraBot control has been scrutinized due to the limitations of Speech Recognition. However, if you pause the PandoraBot module, then it will stop receiving speech recognition. This allows you to use the ControlCommand() syntax to send text to it. By doing this, you can have a collection of "YES" / "NO" responses embedded in the scripts to send to PandoraBot using ControlCommand()

There's two ways to do it...

1) Use the speech recognition module which sends ControlCommand("PandoraBot" SetPhrase, "yes"), etc... on the response yes.

2) Use the WaitForSpeech() command and send the ControlCommand("PandoraBot", SetPhrase, "xxxx")

This allows you to take further advantage of the PandoraBot module. You would need to create your own personality that accepts more specific commands.
#110  
OK, Richard, you will have fun with this. Here is one thing I forgot to mention that is VERY Important in regards to making decisions.

In the book How to Build Your own working Robot Pet , the author talks about making good decisions through having confidence levels.

Here is an example:

Select a random number. Based on (0-3) four random numbers.

If confidence level is not equal to zero, go in that direction.

The robot goes forward after selecting the move through a random number.

He has a Confidence Level =3.

He bumps into a wall.

His confidence level drops to 2.

Then he goes forward again.

It goes to 1, then 0.

Once it is Zero, the robot knows the wall is there, so He will not go in that direction until his confidence builds up in that direction.

ALWAYS LET THE ROBOT DECIDE WHICH TASK TO DO. HE WILL ALSO SELECT THIS WAY FOR ACTIONS OR FOR DIRECTIONS, ETC. Give him a group of actions say (0-15) and let HIM decide which action to take. At any given point he will NOT be told what to do, Only that HE MUST DO SOMETHING. And, HE will decide. It will be HIS choice.

At the same time, if he has a success in that direction, the number 1 is added to his
confidence level until it gets to 3.

So, you see, the decisions are intelligent based on experimental information.

If you wanted to have a higher resolution, you could have levels of up to 16 (being 0-15). this would be more accurate, but at the same time much much slower.

NOTE : we MUST keep THIS Thread Alive!
Hope that this helps or inspires someone.
#111  
I have that book, "How to Build Your own working Robot Pet" along with some other old ones. I don't know of any example where a setup like that is used in the past 30 years. The closest comparison I can think of for this threshold and confidence levels are for neural nets.

I think the method in the book could be useful, but compared to newer decision making methods, do you think this method still holds value?
#112  
@Mel.... Here is your dream learning algorithm ... I did not write this... Although written for the Arduino, it should be easy enough to port to an ARC script, but would probably take a bit of time... I have run this on one of my Arduinos and it works very well... I also have the arduino *ino file if someone wants to take a crack at porting it to an ARC script...

Stochastic Learning Automaton:

A stochastic learning automaton is used to obtain supervised machine learning. The robot has a given set of possible actions, and every of these actions is tagged with the same probability at start-up. An action is then randomly selected when an according event occurs and the the robot waits for input from the user or evaluates by itself by given targets as to whether it was a good action or not. If it was good, this action will be tagged with a higher probability while the other actions will be tagged with a lower probability to be chosen if this even occurs again and vice versa.

Beside learning to avoid obstacles the algorithm will be used in the chat mode. Instead of actions the robot chooses randomly topics. According to your response the robot learns after a while, about which topics you want to talk and about which topics not so much.


I have attached a first draft of the Arduino source code and added it below. You can test it by just using the serial monitor. I am sure the code can still be simplified and cleaned up. For bug reports and suggestions, feel free to post a comment.

Code:


/*****************************************************************************************************
* Interactive AI program based on a variable structure stochastic learning automaton (VSLA) *
* For more information visit: *
* http://scholar.lib.vt.edu/theses/available/etd-5414132139711101/unrestricted/ch3.pdf *
* *
* Arduino IDE 1.0 *
* Arduino Mega 2560 Rev. 3 *
* Written by Markus Bindhammer, 2013 *
******************************************************************************************************/


//********************************************* Libraries *********************************************
#include <Entropy.h> // http://forum.arduino.cc/index.php/topic,108380.0.html

//***************************************** Global variables ******************************************
int beta; //variable for the environment input
long randomnumber; //variable for generated random number
float t_1; //define initial denominators and numerators of probability value for action alpha_1
float y_1;
float t_2; //define initial denominators and numerators of probability value for action alpha_2
float y_2;
float t_3; //define initial denominators and numerators of probability value for action alpha_3
float y_3;
float t_4; //define initial denominators and numerators of probability value for action alpha_4
float y_4;
float p_total; //sum of all probabilities
float p_1; //probabilities as floating-point numbers
float p_2;
float p_3;
float p_4;
float euclid; //variable for the gcd (greatest common divisor)

//***************************************** Global constants ******************************************
float u=1.0; //numerator of learning parameter. u must be a natural number >0
float v=2.0; //denominator of learning parameter. v must be a natural number >0
float a=u/v; //define learning parameter a as a fraction of u and v. a must be >0 and <1
int r=4; //number of desired actions

void setup() {
Serial.begin(9600); //open the serial port at 9600 bps
Entropy.Initialize(); //initialize random function
t_1 = 1.0; //define initial denominators and numerators of probability values
t_2 = 1.0;
t_3 = 1.0;
t_4 = 1.0;
y_1 = 4.0;
y_2 = 4.0;
y_3 = 4.0;
y_4 = 4.0;
}

void loop() {
//======================================== Calculating results ========================================
p_1=t_1/y_1;
p_2=t_2/y_2;
p_3=t_3/y_3;
p_4=t_4/y_4;
p_total=t_1/y_1+t_2/y_2+t_3/y_3+t_4/y_4;

//========================================= Printing results ==========================================
Serial.println("current probability values:");
Serial.print("p_1 = ");
Serial.println(p_1,4);
Serial.print("p_2 = ");
Serial.println(p_2,4);
Serial.print("p_3 = ");
Serial.println(p_3,4);
Serial.print("p_4 = ");
Serial.println(p_4,4);
Serial.println("________________");
Serial.print("p_total = ");
Serial.println(p_total,4);
Serial.println(" ");

//========================================= Choice algorithm ==========================================
//selection sorting algorithm
float maxprob[]={p_1,p_2,p_3,p_4, 3}; //create according array
//the number '3' must be always kept in the array to prevent wrong ranking in case probabilities are equal to 0
float temp;
int mini; //variable used to hold the assumed minimum element
int i;
int j;
for(i=0; i<r; i++) { //outer FOR loop
mini=i; //first pass of FOR loop assumes 0th element as minimum, second pass assumes 1st element as minimum and so on
for(j=0; j<r; j++) { //inner FOR loop
if(maxprob[mini]>maxprob[j]) { //compares the minimum element with all, other members using inner FOR loop
temp=maxprob[j]; //exchanges the elements
maxprob[j]=maxprob[mini];
maxprob[mini]=temp;
}
}
}
int k=0; //identifier which action was chosen
for (i=0; i<r; i++) {
if (maxprob[i]==p_1&&maxprob[i+1]!=p_1) {
randomnumber=Entropy.random(1,y_1+1);
if (randomnumber<=t_1) {
Serial.println("action alpha_1 chosen");
Serial.println(" ");
k=1;
break;
}
} if (maxprob[i]==p_2&&maxprob[i+1]!=p_2) {
randomnumber=Entropy.random(1,y_2+1);
if (randomnumber<=t_2) {
Serial.println("action alpha_2 chosen");
Serial.println(" ");
k=2;
break;
}
} if (maxprob[i]==p_3&&maxprob[i+1]!=p_3) {
randomnumber=Entropy.random(1,y_3+1);
if (randomnumber<=t_3) {
Serial.println("action alpha_3 chosen");
Serial.println(" ");
k=3;
break;
}
} if (maxprob[i]==p_4&&maxprob[i+1]!=p_4) {
randomnumber=Entropy.random(1,y_4+1);
if (randomnumber<=t_4) {
Serial.println("action alpha_4 chosen");
Serial.println(" ");
k=4;
break;
}
} // Add here statements from p_5 to p_... if desired
}
if (k==0) {
if (maxprob[r-1]==p_1) {
Serial.println("action alpha_1 chosen");
Serial.println(" ");
k=1;
} else if (maxprob[r-1]==p_2) {
Serial.println("action alpha_2 chosen");
Serial.println(" ");
k=2;
} else if (maxprob[r-1]==p_3) {
Serial.println("action alpha_3 chosen");
Serial.println(" ");
k=3;
} else if (maxprob[r-1]==p_4) {
Serial.println("action alpha_4 chosen");
Serial.println(" ");
k=4;
} // Add here statements from p_5 to p_... if desired
}

//======================================= Input from environment ======================================
Serial.println("please decide if chosen action was favorable or unfavorable"); //instructions for the user
Serial.println("send 0 if action was favorable");
Serial.println("send 1 if action was unfavorable");
Serial.println(" ");
check_input: //check input from serial monitor. If input is not equal to 0 or 1, go back to 'check_input' label
char ser = Serial.read();
if(ser=='0') {
beta=0;
Serial.println("b = 0, action was favorable");
Serial.println(" ");
} else if(ser=='1') {
beta=1;
Serial.println("b = 1, action was unfavorable");
Serial.println(" ");
} else {
goto check_input;
}

//========================================== Updating rule T ==========================================
//updating rule for probability action alpha_1
if (k==1&&beta==0) {
t_1=((v*t_1)+(u*(y_1-t_1))); //according updating rule when action alpha_1 was chosen and beta=0 (j=i)
y_1=(v*y_1);
} if (k==1&&beta==1) {
t_1=(t_1*(v-u)); //according updating rule when action alpha_1 was chosen and beta=1 (j=i)
y_1=(v*y_1);
} if (k!=1&&beta==0) {
t_1=(t_1*(v-u)); //according updating rule when action alpha_1 was not chosen and beta=0 (j?i)
y_1=(v*y_1);
} if (k!=1&&beta==1) {
t_1=((y_1*u)+(t_1*(r-1)*(v-u))); //according updating rule when action alpha_1 was not chosen and beta=1 (j?i)
y_1=(y_1*v*(r-1));
}
//updating rule for probability action alpha_2
if (k==2&&beta==0) {
t_2=((v*t_2)+(u*(y_2-t_2))); //according updating rule when action alpha_2 was chosen and beta=0 (j=i)
y_2=(v*y_2);
} if (k==2&&beta==1) {
t_2=(t_2*(v-u)); //according updating rule when action alpha_2 was chosen and beta=1 (j=i)
y_2=(v*y_2);
} if (k!=2&&beta==0) {
t_2=(t_2*(v-u)); //according updating rule when action alpha_2 was not chosen and beta=0 (j?i)
y_2=(v*y_2);
} if (k!=2&&beta==1) {
t_2=((y_2*u)+(t_2*(r-1)*(v-u))); //according updating rule when action alpha_2 was not chosen and beta=1 (j?i)
y_2=(y_2*v*(r-1));
}
//updating rule for probability action alpha_3
if (k==3&&beta==0) {
t_3=((v*t_3)+(u*(y_3-t_3))); //according updating rule when action alpha_3 was chosen and beta=0 (j=i)
y_3=(v*y_3);
} if (k==3&&beta==1) {
t_3=(t_3*(v-u)); //according updating rule when action alpha_3 was chosen and beta=1 (j=i)
y_3=(v*y_3);
} if (k!=3&&beta==0) {
t_3=(t_3*(v-u)); //according updating rule when action alpha_3 was not chosen and beta=0 (j?i)
y_3=(v*y_3);
} if (k!=3&&beta==1) {
t_3=((y_3*u)+(t_3*(r-1)*(v-u))); //according updating rule when action alpha_3 was not chosen and beta=1 (j?i)
y_3=(y_3*v*(r-1));
}
//updating rule for probability action alpha_4
if (k==4&&beta==0) {
t_4=((v*t_4)+(u*(y_4-t_4))); //according updating rule when action alpha_4 was chosen and beta=0 (j=i)
y_4=(v*y_4);
} if (k==4&&beta==1) {
t_4=(t_4*(v-u)); //according updating rule when action alpha_4 was chosen and beta=1 (j=i)
y_4=(v*y_4);
} if (k!=4&&beta==0) {
t_4=(t_4*(v-u)); //according updating rule when action alpha_4 was not chosen and beta=0 (j?i)
y_4=(v*y_4);
} if (k!=4&&beta==1) {
t_4=((y_4*u)+(t_4*(r-1)*(v-u))); //according updating rule when action alpha_4 was not chosen and beta=1 (j?i)
y_4=(y_4*v*(r-1));
} // Add here statements from p_5 to p_... if desired

//========================================== gcd calculation ==========================================
euclid=(gcd(y_1, t_1)); //find greatest common divisor (gcd) and devide denominators and numerators by gcd to reduce fraction
y_1=y_1/euclid;
t_1=t_1/euclid;
euclid=(gcd(y_2, t_2));
y_2=y_2/euclid;
t_2=t_2/euclid;
euclid=(gcd(y_3, t_3));
y_3=y_3/euclid;
t_3=t_3/euclid;
euclid=(gcd(y_4, t_4));
y_4=y_4/euclid;
t_4=t_4/euclid;
} // Add here statements from p_5 to p_... if desired

//********************************************* Functions *********************************************
//======================================== Euclidean algorithm ========================================
int32_t gcd(int32_t a, int32_t b) {
if (b == 0) {
return a;
} if (b == 1) {
return 1;
} return gcd(b, a % b);
}
#113  
Well, looking through the code , I don't see how this would work. But, I will trust you on that. I would like the arduino info file. I guess from looking at it, it is an arduino "c" file. I have removed the happy faces and replaced them with ")" bracket.

I think this method still applies but, if we could find a reasonable "Fuzzy Logic" algorithm it might work better.

Thank You on this.

Mel
#114  
Ooops post the wrong code snippet... Corrected above... Now the code works perfectly Mel... As mentioned it will need to be ported and tweaked to use in ARC and in individual projects... The code above is written for the Arduino.... It is a decent "learning" algorithm that has many uses in our robotics....
#115  
That is a LOT of converting/porting. For some reason (maybe I need medical intervention?) it sounds like a fun project to port it over and apply the basic functions in ARC. I'm starting to port it. Anyone else want to help?
#116  
This type of AI is call a Knowledge base, first publicly known as a program called Animals. Where the computer would guess the animal you were thinking of. I know this is not the same application but it is using Decent Knowledge base flow.

If you are wanting to make a port you may want to search for a program called Animals , it has been ported to almost every language known to man.

and you will have more references to base your port on.
#117  
I didn't draw the conclusion that its a Knowledge Base type of program. I use knowledge base type logic at work often and I consider it more structurally similar to IF/THEN where you front load information. Or like an Expert System.

For example, if I recall the Animals program (the one I remember seeing an example of) asked questions like "Does the Animal have 4 legs?". Depending on the answer y/n it would then pose a follow up questions and each time narrow down the list of possible animals from a given list.

Can you explain what you see in the code that makes it appear like a knowledge base?
#118  
First stab at a port to ARC. It's not finished!

My questions for the next steps are what to replace the Serial.Print in/out with and I'm not sure what to replace "RETURN" with. Looks like Return might be used as a print command? And then the gcd function Ardiuno, Greatest Common Divisor...not sure what to use there.

Last Updated 9/5/14

Code:


# Interactive AI program based on a variable structure stochastic learning automaton (VSLA)
# http:scholar.lib.vt.edu/theses/available/etd-5414132139711101/unrestricted/ch3.pdf
# include <Entropy.h> http:forum.arduino.cc/index.php/topic,108380.0.html
# Originally Written by Markus Bindhammer, 2013 for Arduino
#
# Ported to EZ-Robot Script by Justin Ratliff (and other EZ-Robot Forum Members) 2014

#************ Global variables ************
$beta = "0" #variable for the environment input
$randomnumber = "0" #variable for generated random number
$t_1 = "0" #define initial denominators and numerators of probability value for action alpha_1
$y_1 = "0"
$t_2 = "0" #define initial denominators and numerators of probability value for action alpha_2
$y_2 = "0"
$t_3 = "0" #define initial denominators and numerators of probability value for action alpha_3
$y_3 = "0"
$t_4 = "0" #define initial denominators and numerators of probability value for action alpha_4
$y_4 = "0"
$p_total = "0" #sum of all probabilities
$p_1 = "0" #probabilities as floating-point numbers
$p_2 = "0"
$p_3 = "0"
$p_4 = "0"
$euclid = "0" #variable for the gcd (greatest common divisor)

#************ Global constants ************
$u = "1.0" #numerator of learning parameter. u must be a natural number >0
$v = "2.0" #denominator of learning parameter. v must be a natural number >0
$a = ABS($u / $v) #define learning parameter a as a fraction of u and v. a must be >0 and <1
$r = "4" #number of desired actions

:setup
#Entropy.Initialize()
#initialize random function - need to re-write the above line for a random function process
$t_1 = "1.0" #define initial denominators and numerators of probability values
$t_2 = "1.0"
$t_3 = "1.0"
$t_4 = "1.0"
$y_1 = "4.0"
$y_2 = "4.0"
$y_3 = "4.0"
$y_4 = "4.0"


:loop
#===== Calculating results =====
$p_1 = ABS($t_1 / $y_1)
$p_2 = ABS($t_2 / $y_2)
$p_3 = ABS($t_3 / $y_3)
$p_4 = ABS($t_4 / $y_4)
$p_total = ABS($t_1 / $y_1 + $t_2 / $y_2 + $t_3 / $y_3 + $t_4 / $y_4)

#===== Printing results =====
PRINT("current probability values:")
#old example PRINT($p_1, 4)
#ardiuno example of why ,4 is in there to show the decimal spot 4 spaces
#Example: Serial.println(1.23456, 4) would print "1.2346"
#ARC can do this with the ROUND() command
$szp_1 = Round($p_1, 4)
$szp_2 = Round($p_2, 4)
$szp_3 = Round($p_3, 4)
$szp_4 = Round($p_4, 4)
PRINT("p_1 = " + $szp_1)
PRINT("p_2 = " + $szp_2)
PRINT("p_3 = " + $szp_3)
PRINT("p_4 = " + $szp_4)
PRINT("________________")
PRINT("p_total = " + $p_total)
PRINT(" ")

#===== Choice algorithm =====
#selection sorting algorithm
#not sure about this array setup
$maxprob($p_1, $p_2, $p_3, $p_4, 3) #create according array
#the number '3' must be always kept in the array to prevent wrong ranking in case probabilities are equal to 0
$temp = ""
$mini = "" #variable used to hold the assumed minimum element
$i = ""
$j = ""
RepeatWhile($i=0 $i < $r $i++) #outer FOR loop
$mini = $i #first pass of FOR loop assumes 0th element as minimum, second pass assumes 1st element as minimum and so on
RepeatWhile($j=0 $j < $r $j++) #inner FOR loop
IF($maxprob[$mini] > $maxprob[$j]) #compares the minimum element with all, other members using inner FOR loop
$temp=$maxprob[$j] #exchanges the elements
$maxprob[$j] = $maxprob[$mini]
$maxprob[$mini] = $temp
ENDIF
EndRepeatWhile
EndRepeatWhile



$k = "0" #identIFier which action was chosen
RepeatWhile($i = 0 $i < $r i++)
IF ($maxprob[$i] == $p_1 && $maxprob[$i+1] != $p_1)
$randomnumber = $Entropy.random(1, $y_1 + 1)
ENDIF
IF ($randomnumber <= $t_1)
PRINT("action alpha_1 chosen")
PRINT(" ")
$k=1
ENDIF
EndRepeatWhile

IF ($maxprob[$i] == $p_2 && $maxprob [$i + 1] != $p_2)
$randomnumber = $Entropy.random(1, $y_2 + 1)
ENDIF
IF ($randomnumber <= $t_2)
PRINT("action alpha_2 chosen")
PRINT(" ")
$k=2
ENDIF

IF ($maxprob[$i] == $p_3 && $maxprob [$i + 1] != $p_3)
$randomnumber = $Entropy.random(1, $y_3 + 1)
ENDIF
IF ($randomnumber <= $t_3)
PRINT("action alpha_3 chosen")
PRINT(" ")
$k=3
ENDIF

IF ($maxprob [$i] == $p_4 && $maxprob [$i + 1] != $p_4)
$randomnumber = $Entropy.random(1, $y_4 + 1)
ENDIF
IF ($randomnumber <= $t_4)
PRINT("action alpha_4 chosen")
PRINT(" ")
$k=4
ENDIF

# Add here statements from p_5 to p_... IF desired

RepeatWhile($k == 0)
IF($maxprob [$r - 1] == $p_1)
PRINT("action alpha_1 chosen")
PRINT(" ")
$k=1
elseIF ($maxprob [$r - 1] == $p_2)
PRINT("action alpha_2 chosen")
PRINT(" ")
$k=2
elseIF ($maxprob [$r -1] == $p_3)
PRINT("action alpha_3 chosen")
PRINT(" ")
$k=3
else
$maxprob [$r - 1] == $p_4
PRINT("action alpha_4 chosen")
PRINT(" ")
$k=4
ENDIF
EndRepeatWhile

# Add here statements from p_5 to p_... IF desired


#===== Input from environment =====
PRINT(please decide IF chosen action was favorable or unfavorable) #instructions for the user
PRINT(send 0 IF action was favorable)
PRINT(send 1 IF action was unfavorable)
PRINT(" ")

:check_input #check input from serial monitor. IF input is not equal to 0 or 1, go back to 'check_input' label
#Serial.read needs to be replaced with a scripted input for testing
$ser = "function to wait for input"
IF($ser == "0")
$beta = "0"
PRINT(b = 0, action was favorable)
PRINT(" ")
elseIF($ser == "1")
$beta = "1"
PRINT(b = 1, action was unfavorable)
PRINT(" ")
else
goto(check_input)
ENDIF


#===== Updating rule T =====
#updating rule for probability action alpha_1
IF ($k == "1" && $beta == "0")
$t_1 = ABS(($v * $t_1) + ($u * ($y_1 - $t_1))) #according updating rule when action alpha_1 was chosen and beta=0 (j=i)
$y_1 = ABS($v * $y_1)
ENDIF
IF ($k == "1" && $beta == "1")
$t_1 = ABS(t_1 * ($v - $u)) #according updating rule when action alpha_1 was chosen and beta=1 (j=i)
$y_1 = ABS($v * $y_1)
ENDIF
IF ($k! = "1" && $beta == "0")
$t_1 = ABS($t_1 * ($v - $u)) #according updating rule when action alpha_1 was not chosen and beta=0 (j?i)
$y_1 = ABS($v * $y_1)
ENDIF
IF ($k! = "1" && $beta == "1")
$t_1 = ABS(($y_1 * $u) + ($t_1 * ($r - 1) * ($v - $u))) #according updating rule when action alpha_1 was not chosen and beta=1 (j?i)
$y_1 = ABS($y_1 * $v * ($r - 1))
ENDIF

#updating rule for probability action alpha_2
IF ($k == "2" && $beta == "0")
$t_2 = ABS(($v * $t_2) + ($u * ($y_2 - $t_2))) #according updating rule when action alpha_2 was chosen and beta=0 (j=i)
$y_2 = ABS($v * $y_2)
ENDIF
IF ($k == "2" && $beta == "1")
$t_2 = ABS($t_2 * ($v - $u)) #according updating rule when action alpha_2 was chosen and beta=1 (j=i)
$y_2 = ABS($v * $y_2)
ENDIF
IF ($k! = "2" && $beta == "0")
$t_2 = ABS($t_2 * ($v - $u)) #according updating rule when action alpha_2 was not chosen and beta=0 (j?i)
$y_2 = ABS($v * $y_2)
ENDIF
IF ($k! = "2" && $beta == "1")
$t_2 = ABS(($y_2 * $u) + ($t_2 * ($r - 1) * ($v - $u))) #according updating rule when action alpha_2 was not chosen and beta=1 (j?i)
$y_2 = ABS($y_2 * $v* ($r - 1))
ENDIF

#updating rule for probability action alpha_3
IF ($k == "3" && $beta == "0")
$t_3 = ABS(($v * t_3) + ($u * ($y_3 - $t_3))) #according updating rule when action alpha_3 was chosen and beta=0 (j=i)
$y_3 = ABS($v * $y_3)
ENDIF
IF ($k == "3" && $beta == "1")
$t_3 = ABS($t_3 * ($v - $u)) #according updating rule when action alpha_3 was chosen and beta=1 (j=i)
$y_3 = ABS($v * $y_3)
ENDIF
IF ($k! ="3" && $beta == "0")
$t_3 = ABS($t_3 * ($v - $u)) #according updating rule when action alpha_3 was not chosen and beta=0 (j?i)
$y_3 = ABS($v * $y_3)
ENDIF
IF ($k! = "3" && $beta == "1")
$t_3 = ABS(($y_3 * $u) + ($t_3 * ($r - 1) * ($v - $u))) #according updating rule when action alpha_3 was not chosen and beta=1 (j?i)
$y_3 = ABS($y_3 * $v * ($r - 1))
ENDIF

#updating rule for probability action alpha_4
IF ($k == "4" && $beta == "0")
$t_4 = ABS(($v * $t_4) + ($u * ($y_4 - $t_4))) #according updating rule when action alpha_4 was chosen and beta=0 (j=i)
$y_4 = ABS($v * $y_4)
ENDIF
IF ($k == "4" && $beta == "1")
$t_4 = ABS($t_4 * ($v - $u)) #according updating rule when action alpha_4 was chosen and beta=1 (j=i)
$y_4 = ABS($v * $y_4)
ENDIF
IF ($k! = "4" && $beta == "0")
$t_4 = ABS($t_4 * ($v - $u)) #according updating rule when action alpha_4 was not chosen and beta=0 (j?i)
$y_4 = ABS($v * $y_4)
ENDIF
IF ($k! = "4" && $beta == "1")
$t_4 = ABS(($y_4 * $u) + ($t_4 * ($r - 1) *($v - $u))) #according updating rule when action alpha_4 was not chosen and beta=1 (j?i)
$y_4 = ABS($y_4 * $v * ($r - 1))
ENDIF

# Add here statements from p_5 to p_... IF desired

#===== gcd calculation ======
$euclid = (gcd($y_1, $t_1)) #find greatest common divisor (gcd) and devide denominators and numerators by gcd to reduce fraction
$y_1 = ABS($y_1 / $euclid)
$t_1 = ABS($t_1 / $euclid)
$euclid = (gcd($y_2, $t_2))
$y_2 = ABS($y_2 / $euclid)
$t_2 = ABS($t_2 / $euclid)
$euclid = (gcd($y_3, $t_3))
$y_3 = ABS($y_3 / $euclid)
$t_3 = ABS($t_3 / $euclid)
$euclid = (gcd($y_4, $t_4))
$y_4 = ABS($y_4 / $euclid)
$t_4 = ABS($t_4 / $euclid)

# Add here statements from p_5 to p_... IF desired

#************ Functions ************
#===== Euclidean algorithm ======
#need a function to find greatest common divisor
#Need a function for this - gcd($a, $b)
IF ($b == "0")
#return a
PRINT(a)
ENDIF
IF ($b == "1")
#return 1
PRINT(1)
#return gcd(b, a % b)
PRINT $gcd($b, $a % $b)
ENDIF
#119  
Wow Justin, you got some serious patience.... I am glad you're attempting it though... If you have an arduino, try it out... or if you get it ported and try it.... I can see a real use for a basic learning algorithm...
#120  
Just learned Serial.print is like ARC Print. Serial.println does the same, but adds a carriage return. Serial.read is meant to read in data on the serial port...I'm going to chuck that and replicate input via script to virtually represent incoming data. So that's not so awful.

Some of the math is a little if-e right now. The part I'm pondering is "gcd" which should not be a variable like I have it listed. It appears to be a math function in the Arduino to find the Greatest Common Divisor. I could probably use some help tackling how to do that.
#121  
I updated the code 2 posts back. It should be a little closer and also has notes on the problem areas. The biggest is an euclidean algorithm in ARC to find the greatest or least common divisor. Many other A.I. processes use this type of function (I wish they wouldn't use math! I hate MATH!)

If a Euclidean magically appeared in the next release that would swell! :D

As a work around, I suppose it might be possible to create a Euclidean script that compares other values from other scripts, then it could be used by anybody for anything. It makes me very sad (lol) to think of scripting that process though (Whaaaaaa!)
#122  
@Justin...LOL I hate math too, that's why I let you tackle this....:P
#123  
If you go back to post #119 in this thread you'll see I have updated the script. The only thing it does is get past a syntax check. Its not functional yet, but it looks pretty.
#124  
As Homer Simpson would say "I am so smart...S, M, R, T...I mean S, M, A, R, T"

I don't know if anyone has used this, or maybe everyone knew this....but I did not think ARC had the ability to divide or multiple or subtract. But it can do all of these things with the ABS()

The Script manual only show the example of converting a negative number:
" Abs( value )
Returns the absolute value of a number
Converts a negative into a positive number
Example: $x = Abs(-22)"

But does a LOT more! With some luck I might have a functional script soon.

Code:


$div = ABS(4 / 1)
#ABS can be used to divide

$multiply = ABS(2 * 2)
#ABS can be used to Multiply

$add = ABS(2 + 2)
#ABS can be used to Add

$Subtract = ABS(4 - 2)
#ABS can be used to subtract


And you can mix together operations:

Code:


$p_total = ABS(2 / 1 + 3 / 2 + 2 / 1 + 4 / 2)
#125  
Oh man... "order of operations".... I am getting dizzy *sick*
#126  
ok, you are smart, I am so tired. T I R D, tired.
#127  
You nailed it Richard, it also obeys order of operations.

Code:


$OrderOfProcess = ABS(2 * (6-4))
PRO
USA
#128  
Looking through old posts and found this one. Was the script ever completed and functional within the EzB environment?