what are your thoughts about mode based algorithms ?

  • 3 Replies
  • 157 Views
*

yotamarker

  • Trusty Member
  • *********
  • Terminator
  • *
  • 766
    • battle programming
what are your thoughts about mode based algorithms ?
« on: March 29, 2020, 09:17:29 AM »
input :
/*
       * the input function contains a trigger list for different modes where
       * different input conditions cause different modes and mode counters
       * modifications
       */

output :

/*
       * modes summon different algorithms modes also contain mode changes such as
       * mode reset (mode 0)
       */

*

Hopefully Something

  • Trusty Member
  • *********
  • Terminator
  • *
  • 880
  • no seriously where are these cookies
Re: what are your thoughts about mode based algorithms ?
« Reply #1 on: March 29, 2020, 06:32:52 PM »
I like the idea. I'll think about it.

*

krayvonk

  • Electric Dreamer
  • ****
  • 125
Re: what are your thoughts about mode based algorithms ?
« Reply #2 on: March 29, 2020, 11:42:24 PM »
I like the idea myself, and I bet other people do as well,  because its a good simple one that might have benefits.
If you crossed it with *deep learning*  the more states it had the nets it would have (if you look at it that way)  And you would take n times longer to learn, but it wouldn't confuse its states by trying to learn them all at once, and it would forget less,  I think.  Because if it hits another mode,  it only trains that mode whilst being in that mode.

If you had a killer watch dog that did the dishes,  why bother confusing the two tasks together if you can learn them separately.

*

yotamarker

  • Trusty Member
  • *********
  • Terminator
  • *
  • 766
    • battle programming
Re: what are your thoughts about mode based algorithms ?
« Reply #3 on: March 30, 2020, 06:01:25 AM »
https://streamable.com/wlgmx

note

in the demo she outputs the distance from home

updated classes for this skill :

https://github.com/yotamarker/public-livinGrimoire

unrelated : I added code871 to DSpeller class, though that voice file will be used for
automatic programming
chobit : the class is equiped to recognize standby phases
new class : TimeGate : time based boolean gate : will stay closed for set
amount of time after closing.
kokoro : can convey standby stage to skills (I call skills using this class soulistics)
DIHomer : uses mode algorithm to return AI home after she finishes tasks (see class doc)

Code
package chobit;

import java.util.ArrayList;

public class DIHomer extends DISkill {
 private Coordinate homeXY = new Coordinate(51.4045, 30.0542);
 // 51.4045, 30.0542
 private int mode = 0;
 private int c2 = 0; // standBy counter;

 public DIHomer(Kokoro kokoro) {
 super(kokoro);
 // DB load home coordinates or default value
 }

 @Override
 public void input(String ear, String skin, String eye) {
 /*
 * the input function contains a trigger list for different modes where
 * different input conditions cause different modes and mode counters
 * modifications
 */
 if (ear.contains("this is home")) {
 this.homeXY = new Coordinate(Tokoro.lat, Tokoro.lon);
 mode = 3; // confirmation alg
 return;
 // DB save home coordinates
 }
 if (ear.contains("homer")) {
 mode = 4;
 return;
 }
 // external mode triggers :
 if (this.kokoro.standBy) {
 if (measure(this.homeXY.getX(), this.homeXY.getY(), Tokoro.lat, Tokoro.lon) < 2000) {
 mode = 0;
 // else if mode !2 mode 1
 } else {
 if (mode != 2) {
 mode = 1;
 } else {
 c2++;
 }
 }
 }

 }

 @Override
 public void output(Neuron noiron) {
 /*
 * modes summon different algorithms modes also contain mode changes such as
 * mode reset (mode 0)
 */
 switch (mode) {
 case 1:
 noiron.algParts.add(verbatimGorithm(new APVerbatim("i wanna go home")));
 mode = 2;

 break;
 case 2:
 if (c2 > 1) {
 c2 = 0;
 noiron.algParts.add(verbatimGorithm(new APVerbatim("take me home")));
 }
 break;
 case 3:
 noiron.algParts.add(verbatimGorithm(new APVerbatim("yes your majesty")));
 mode = 0;

 break;
 case 4:
 // measure(this.homeXY.getX(), this.homeXY.getY(), Tokoro.lat, Tokoro.lon)
 Double distance = measure(51.4045, 30.0542, 51.4050, 30.06);
 String s1 = String.format("%.02f kilometer", distance / 1000);
 noiron.algParts.add(verbatimGorithm(new APVerbatim(s1)));
 mode = 0;
 break;
 default:
 break;
 }
 }

 @Override
 public Boolean auto() {
 return true;
 }

 private Algorithm verbatimGorithm(AbsAlgPart itte) {
 // returns a simple algorithm for saying sent parameter
 // AbsAlgPart itte = new APVerbatim("I am");
 String representation = "about";
 ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
 algParts1.add(itte);
 Algorithm algorithm = new Algorithm("about", representation, algParts1);
 return algorithm;
 }

 public Double measure(double lat1, double lon1, double lat2, double lon2) { // generally used geo measurement
 // function
 double R = 6378.137; // Radius of earth in KM
 double dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180;
 double dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180;
 double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180)
 * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
 double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
 double d = R * c;
 return d * 1000; // meters
 }
}


note this mode algorithm enables easy upgrades in which changes can be made to triggers and
algorithms fired up by modes.

trigger ->mode -> alg

for example for updatind to include visual data.

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

alg beef up plan :

{var location:=null //home
var homeDefcon}
alterHomesList(sorted)
*hotels

manual setHome

input : plain(shaded) : add to possible alter homeList
(night)time ?
check defcon
set algMode
home?
set algMode
else default mode

*********************************************
purchase/rent (depends on resources)
build
go to new explore location
********************************************
explore mode?
count standbys while defcon ok
if >x, set home and alterhome 2hours
update defcon
if bad defcon delete explore location(set to home var), go home, default mode
************************************************
defend
***************************************************
vacation mode
***************************************************
default mode
c2=0

standby?{bot at home?{mode=1;c2=0}else

switch mode:

1: go home;mode=2 //*home not null ?

2:if c2>x{c2=0;go home}

 


Users Online

91 Guests, 0 Users

Most Online Today: 93. Most Online Ever: 340 (March 26, 2019, 09:47:57 PM)

Articles