From f116033fe33fa116daac2121a7a26d3a9ca46362 Mon Sep 17 00:00:00 2001 From: Chris Stasiak Date: Thu, 25 Jun 2015 17:41:20 +0200 Subject: [PATCH 1/7] Commented human abilities --- population/pvp.go | 19 +++++++++++++------ population/trait/ability.go | 11 +++++++++++ population/trait/behaviour.go | 9 ++++++++- population/trait/decision.go | 9 ++++++++- population/trait/fact.go | 10 +++++++++- population/trait/habit.go | 8 +++++++- population/trait/location.go | 8 +++++++- population/trait/mood.go | 11 ++++++++++- 8 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 population/trait/ability.go diff --git a/population/pvp.go b/population/pvp.go index d4ba3ae..e28b215 100644 --- a/population/pvp.go +++ b/population/pvp.go @@ -5,6 +5,10 @@ package population * Private Virtual Personality * *********************************** + ******************************* + * Virtual Human Surrogate * + ******************************* + https://en.wikipedia.org/wiki/Talk%3APrivate_virtual_personality VI vs AI @@ -38,7 +42,6 @@ func (this *PVPController) Train() { /* PVP LEARNS VIA HUMAN TEACHING - CARROT/STICK METHOD - - MOOD DETECTION - ... */ } @@ -47,13 +50,17 @@ func (this *PVPController) Query() { /* QUESTION WITH LOGIC ANSWER: YES/NO - QUESTION WITH PROBABILITY ANSWER: MAYBE YES, MAYBE NOT + QUESTION WITH PROBABILITY ANSWER: MOST LIKELY, MAYBE, PROBABLY YES/NO QUESTION ABOUT LIKENESS OF SUBJECT: LIKE/DISLIKE - QUESTION ABOUT LIKENESS OF PRICE: LIKE/DISLIKE + QUESTION ABOUT LIKENESS OF PRICE: CHEAP/LUXURY QUESTION ABOUT MOOD: GOOD, BAD, SAD + + QUESTION ABOUT BEHAVIOUR TODAY/TOMORROW: IDLE, SHOPPING, READING... + + QUESTION ABOUT ABILITY TO LEARN: LOW/MEDIUM/HIGH */ } @@ -75,10 +82,10 @@ func (this *PVPController) GetAI() { THE COMBINATION OF: - TRAINING USING CURRENT SENSORS + - TRAINING USING CURRENT DECISIONS - CURRENT BRAIN STATE - - CURRENT INDICES - - CURRENT METRICS OF ACTIONS, BEHAVIOURS - - CURRENT HABITS + - CURRENT KNOWLEDGE/INDICES + - CURRENT METRICS OF BEHAVIOURS, HABITS, ABILITIES, MOODS - ... ******************************************** */ diff --git a/population/trait/ability.go b/population/trait/ability.go new file mode 100644 index 0000000..d0b173b --- /dev/null +++ b/population/trait/ability.go @@ -0,0 +1,11 @@ +package trait + +type AbilityController struct { + /* + - FAST LEARN + - IGNORANT + - OPTIMISTIC + - PESIMISTIC + - ... + */ +} diff --git a/population/trait/behaviour.go b/population/trait/behaviour.go index d8a3c89..1470bef 100644 --- a/population/trait/behaviour.go +++ b/population/trait/behaviour.go @@ -1,3 +1,10 @@ package trait -type BehaviourController struct {} +type BehaviourController struct { + /* + - CLICKING FROM LEFT ONLY + - CLICKING FROM RIGHT ONLY + - CLICKING TOP ONLY + - CLICKING BOTTOM ONLY + */ +} diff --git a/population/trait/decision.go b/population/trait/decision.go index a4aebc0..f32df88 100644 --- a/population/trait/decision.go +++ b/population/trait/decision.go @@ -1,3 +1,10 @@ package trait -type DecisionController struct {} +type DecisionController struct { + + /* + - ACTIONS: click, skip, like, scroll-back, returned + - TIME AXIS BASED + */ + +} diff --git a/population/trait/fact.go b/population/trait/fact.go index 5b5e940..661ae47 100644 --- a/population/trait/fact.go +++ b/population/trait/fact.go @@ -1,3 +1,11 @@ package trait -type FactController struct {} +type FactController struct { + /* + - AGE + - SEX + - HEIGHT + - WEIGHT + - ... + */ +} diff --git a/population/trait/habit.go b/population/trait/habit.go index 1c741a5..8193c80 100644 --- a/population/trait/habit.go +++ b/population/trait/habit.go @@ -1,3 +1,9 @@ package trait -type HabitController struct {} +type HabitController struct { + /* + - CLICKING ORDER + - TIME TO VISIT + - ... + */ +} diff --git a/population/trait/location.go b/population/trait/location.go index 2af8c28..8d8b611 100644 --- a/population/trait/location.go +++ b/population/trait/location.go @@ -1,3 +1,9 @@ package trait -type LocationController struct {} +type LocationController struct { + /* + - NETWORK: 3G, Wifi + - PLACE: HOME, OFFICE + - ... + */ +} diff --git a/population/trait/mood.go b/population/trait/mood.go index 2334cfa..dfc51cb 100644 --- a/population/trait/mood.go +++ b/population/trait/mood.go @@ -1,3 +1,12 @@ package trait -type MoodController struct {} +type MoodController struct { + /* + - EROTIC + - NATURE + - CAR + - FASHION + - MOTO + - ... + */ +} From 62d6c12a4293dd80be12ddace92e0a0d4536edc9 Mon Sep 17 00:00:00 2001 From: Chris Stasiak Date: Thu, 25 Jun 2015 17:45:33 +0200 Subject: [PATCH 2/7] More comments --- population/pvp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/population/pvp.go b/population/pvp.go index e28b215..d64601c 100644 --- a/population/pvp.go +++ b/population/pvp.go @@ -43,6 +43,12 @@ func (this *PVPController) Train() { PVP LEARNS VIA HUMAN TEACHING - CARROT/STICK METHOD - ... + + TRAIN PACKAGE: + - HUMAN ENVIRONMENT SENSORS STATUS + - SUBJECT KNOWLEDGE + - HUMAN DECISION + - LIFETIME ACTIVITY&KNOWLEDGE */ } From 1115129ed6ba2a0a8f375312986549e10a6e348c Mon Sep 17 00:00:00 2001 From: Chris Stasiak Date: Thu, 25 Jun 2015 17:53:38 +0200 Subject: [PATCH 3/7] Extended PVP --- population/pvp.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/population/pvp.go b/population/pvp.go index d64601c..9d24110 100644 --- a/population/pvp.go +++ b/population/pvp.go @@ -52,7 +52,7 @@ func (this *PVPController) Train() { */ } -func (this *PVPController) Query() { +func (this *PVPController) Query() interface{} { /* QUESTION WITH LOGIC ANSWER: YES/NO @@ -68,6 +68,22 @@ func (this *PVPController) Query() { QUESTION ABOUT ABILITY TO LEARN: LOW/MEDIUM/HIGH */ + + return map[string]interface{}{ + "query": "response", + } +} + +func (this *PVPController) AskMood(time int) interface{} { + return this.Query() +} + +func (this *PVPController) AskLike(subject interface{}) interface{} { + return this.Query() +} + +func (this *PVPController) AskPriceAcceptance(subject interface{}, price int) interface{} { + return this.Query() } // SUPER GOAL: Artificial Intelligence From cc5a43dbb17f13bc25774ef53fdf0461b5d79c3a Mon Sep 17 00:00:00 2001 From: Chris Stasiak Date: Thu, 25 Jun 2015 21:49:12 +0200 Subject: [PATCH 4/7] - added Virtual Human Surrogate - refactored Private Virtual Personality - added communicators/stdio for VHS --- population/hvs.go | 28 +++++++++++++++++++ population/pvp.go | 12 +------- population/{ => pvp}/trait/ability.go | 0 population/{ => pvp}/trait/behaviour.go | 0 population/{ => pvp}/trait/decision.go | 0 population/{ => pvp}/trait/fact.go | 0 population/{ => pvp}/trait/habit.go | 0 population/{ => pvp}/trait/location.go | 0 population/{ => pvp}/trait/mood.go | 0 .../vhs/communicator/elasticfeed_protocol.go | 0 population/vhs/communicator/http_server.go | 0 population/vhs/communicator/stdio.go | 0 population/vhs/stdio/stdin.go | 6 ++++ population/vhs/stdio/stdout.go | 6 ++++ 14 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 population/hvs.go rename population/{ => pvp}/trait/ability.go (100%) rename population/{ => pvp}/trait/behaviour.go (100%) rename population/{ => pvp}/trait/decision.go (100%) rename population/{ => pvp}/trait/fact.go (100%) rename population/{ => pvp}/trait/habit.go (100%) rename population/{ => pvp}/trait/location.go (100%) rename population/{ => pvp}/trait/mood.go (100%) create mode 100644 population/vhs/communicator/elasticfeed_protocol.go create mode 100644 population/vhs/communicator/http_server.go create mode 100644 population/vhs/communicator/stdio.go create mode 100644 population/vhs/stdio/stdin.go create mode 100644 population/vhs/stdio/stdout.go diff --git a/population/hvs.go b/population/hvs.go new file mode 100644 index 0000000..7a25de4 --- /dev/null +++ b/population/hvs.go @@ -0,0 +1,28 @@ +package population + +/* + + ******************************* + * Virtual Human Surrogate * + ******************************* + + + - SHOULD DEFINE PRIVATE VIRTUAL PERSONALITY + - SHOULD DEFINE INPUT LANGUAGE AND CHANNEL + - SHOULD DEFINE OUTPUT LANGUAGE AND CHANNEL + - SHOULD DEFINE MOBILITY FEATURES + - ... + +*/ + +type VHSController struct { + pvp *PVPController +} + +func (this *VHSController) GetPVP() *PVPController { + return this.pvp +} + +func NewVirtualHumanSurrogate() *VHSController { + return &VHSController{nil} +} diff --git a/population/pvp.go b/population/pvp.go index 9d24110..1287763 100644 --- a/population/pvp.go +++ b/population/pvp.go @@ -1,21 +1,11 @@ package population /* + *********************************** * Private Virtual Personality * *********************************** - ******************************* - * Virtual Human Surrogate * - ******************************* - - https://en.wikipedia.org/wiki/Talk%3APrivate_virtual_personality - - VI vs AI - - A VI is restricted to certain responses and actions, and can't become self-aware, - while an AI is free to think how it likes and is self-aware. - */ type PVPController struct { diff --git a/population/trait/ability.go b/population/pvp/trait/ability.go similarity index 100% rename from population/trait/ability.go rename to population/pvp/trait/ability.go diff --git a/population/trait/behaviour.go b/population/pvp/trait/behaviour.go similarity index 100% rename from population/trait/behaviour.go rename to population/pvp/trait/behaviour.go diff --git a/population/trait/decision.go b/population/pvp/trait/decision.go similarity index 100% rename from population/trait/decision.go rename to population/pvp/trait/decision.go diff --git a/population/trait/fact.go b/population/pvp/trait/fact.go similarity index 100% rename from population/trait/fact.go rename to population/pvp/trait/fact.go diff --git a/population/trait/habit.go b/population/pvp/trait/habit.go similarity index 100% rename from population/trait/habit.go rename to population/pvp/trait/habit.go diff --git a/population/trait/location.go b/population/pvp/trait/location.go similarity index 100% rename from population/trait/location.go rename to population/pvp/trait/location.go diff --git a/population/trait/mood.go b/population/pvp/trait/mood.go similarity index 100% rename from population/trait/mood.go rename to population/pvp/trait/mood.go diff --git a/population/vhs/communicator/elasticfeed_protocol.go b/population/vhs/communicator/elasticfeed_protocol.go new file mode 100644 index 0000000..e69de29 diff --git a/population/vhs/communicator/http_server.go b/population/vhs/communicator/http_server.go new file mode 100644 index 0000000..e69de29 diff --git a/population/vhs/communicator/stdio.go b/population/vhs/communicator/stdio.go new file mode 100644 index 0000000..e69de29 diff --git a/population/vhs/stdio/stdin.go b/population/vhs/stdio/stdin.go new file mode 100644 index 0000000..91416fd --- /dev/null +++ b/population/vhs/stdio/stdin.go @@ -0,0 +1,6 @@ +package stdio + +type Stdin interface { + + Write() +} diff --git a/population/vhs/stdio/stdout.go b/population/vhs/stdio/stdout.go new file mode 100644 index 0000000..ecec9c1 --- /dev/null +++ b/population/vhs/stdio/stdout.go @@ -0,0 +1,6 @@ +package stdio + +type Stdout interface { + + Read() +} From 0dc6bd1aeb1e4963ef6d5364add448fd80344a5d Mon Sep 17 00:00:00 2001 From: Chris Stasiak Date: Thu, 25 Jun 2015 22:01:15 +0200 Subject: [PATCH 5/7] Added Surrogate Service as bridge to Private Virtual Personality via Virtual Human Surrogate --- service/service.go | 10 +++- service/surrogate/surrogate.go | 26 ++++++++++ service/surrogate/v1/controller/default.go | 24 ++++++++++ service/surrogate/v1/controller/status.go | 17 +++++++ service/surrogate/v1/router/query.go | 10 ++++ service/surrogate/v1/router/status.go | 10 ++++ service/surrogate/v1/router/train.go | 10 ++++ service/surrogate/v1/template/const.go | 12 +++++ service/surrogate/v1/template/default.go | 29 +++++++++++ service/surrogate/v1/template/request.go | 9 ++++ service/surrogate/v1/template/response.go | 56 ++++++++++++++++++++++ 11 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 service/surrogate/surrogate.go create mode 100644 service/surrogate/v1/controller/default.go create mode 100644 service/surrogate/v1/controller/status.go create mode 100644 service/surrogate/v1/router/query.go create mode 100644 service/surrogate/v1/router/status.go create mode 100644 service/surrogate/v1/router/train.go create mode 100644 service/surrogate/v1/template/const.go create mode 100644 service/surrogate/v1/template/default.go create mode 100644 service/surrogate/v1/template/request.go create mode 100644 service/surrogate/v1/template/response.go diff --git a/service/service.go b/service/service.go index 830dfd1..ba47a25 100644 --- a/service/service.go +++ b/service/service.go @@ -5,6 +5,7 @@ import ( "github.com/feedlabs/elasticfeed/service/stream" "github.com/feedlabs/elasticfeed/service/system" "github.com/feedlabs/elasticfeed/service/predict" + "github.com/feedlabs/elasticfeed/service/surrogate" "github.com/feedlabs/elasticfeed/elasticfeed/model" ) @@ -18,6 +19,7 @@ type ServiceManager struct { stream *stream.StreamService system *system.SystemService predict *predict.PredictService + surrogate *surrogate.SurrogateService } func (this *ServiceManager) Init() { @@ -25,6 +27,7 @@ func (this *ServiceManager) Init() { this.stream.Init() this.store.Init() this.predict.Init() + this.surrogate.Init() } func (this *ServiceManager) GetDbService() *store.DbService { @@ -43,12 +46,17 @@ func (this *ServiceManager) GetPredictService() *predict.PredictService { return this.predict } +func (this *ServiceManager) GetSurrogateService() *surrogate.SurrogateService { + return this.surrogate +} + func NewServiceManager(engine model.Elasticfeed) *ServiceManager { store := store.NewDbService() stream := stream.NewStreamService() system := system.NewSystemService() predict := predict.NewPredictService() + surrogate := surrogate.NewSurrogateService() - return &ServiceManager{engine, store, stream, system, predict} + return &ServiceManager{engine, store, stream, system, predict, surrogate} } diff --git a/service/surrogate/surrogate.go b/service/surrogate/surrogate.go new file mode 100644 index 0000000..cf47eae --- /dev/null +++ b/service/surrogate/surrogate.go @@ -0,0 +1,26 @@ +package surrogate + +import ( + "github.com/feedlabs/elasticfeed/service/surrogate/v1/router" +) + +/* + TODO: + - THIS SERVICE SHOULD ALLOW FOR WORKFLOW files + - WORKFLOW SHOULD be: + - SCENARIO -> YES (learning) + - PIPELINE -> YES (prediction) + - SENSOR/INDEXER/CRAWLER/HELPER -> NO (no pre-learning, no environment) + */ + +type SurrogateService struct {} + +func (this *SurrogateService) Init() { + router.InitStatusRouters() + router.InitQueryRouters() + router.InitTrainRouters() +} + +func NewSurrogateService() *SurrogateService { + return &SurrogateService{} +} diff --git a/service/surrogate/v1/controller/default.go b/service/surrogate/v1/controller/default.go new file mode 100644 index 0000000..fe583aa --- /dev/null +++ b/service/surrogate/v1/controller/default.go @@ -0,0 +1,24 @@ +package controller + +import ( + "github.com/feedlabs/feedify" +) + +type DefaultController struct { + feedify.Controller +} + +func (this *DefaultController) Get() { + this.Data["json"] = map[string]string{"succes": "ok"} + this.Controller.ServeJson() +} + +func (this *DefaultController) ServeJson(data interface{}, status int) { + this.Data["json"] = data + this.SetResponseStatusCode(status) + this.Controller.ServeJson() +} + +func (this *DefaultController) SetResponseStatusCode(code int) { + this.Controller.Ctx.Output.SetStatus(code) +} diff --git a/service/surrogate/v1/controller/status.go b/service/surrogate/v1/controller/status.go new file mode 100644 index 0000000..ce3a067 --- /dev/null +++ b/service/surrogate/v1/controller/status.go @@ -0,0 +1,17 @@ +package controller + +import ( + "github.com/feedlabs/feedify" +) + +type StatusController struct { + feedify.Controller +} + +func (this *StatusController) Get() { + this.Data["json"] = map[string]interface{}{ + "enabled": true, + } + + this.Controller.ServeJson() +} diff --git a/service/surrogate/v1/router/query.go b/service/surrogate/v1/router/query.go new file mode 100644 index 0000000..019c0c9 --- /dev/null +++ b/service/surrogate/v1/router/query.go @@ -0,0 +1,10 @@ +package router + +import ( + "github.com/feedlabs/feedify" + "github.com/feedlabs/elasticfeed/service/surrogate/v1/controller" +) + +func InitQueryRouters() { + feedify.Router("/v1/surrogate/query", &controller.DefaultController{}, "get:Get") +} diff --git a/service/surrogate/v1/router/status.go b/service/surrogate/v1/router/status.go new file mode 100644 index 0000000..a86be83 --- /dev/null +++ b/service/surrogate/v1/router/status.go @@ -0,0 +1,10 @@ +package router + +import ( + "github.com/feedlabs/feedify" + "github.com/feedlabs/elasticfeed/service/surrogate/v1/controller" +) + +func InitStatusRouters() { + feedify.Router("/v1/surrogate/status", &controller.StatusController{}, "get:Get") +} diff --git a/service/surrogate/v1/router/train.go b/service/surrogate/v1/router/train.go new file mode 100644 index 0000000..daec3e8 --- /dev/null +++ b/service/surrogate/v1/router/train.go @@ -0,0 +1,10 @@ +package router + +import ( + "github.com/feedlabs/feedify" + "github.com/feedlabs/elasticfeed/service/surrogate/v1/controller" +) + +func InitTrainRouters() { + feedify.Router("/v1/surrogate/train", &controller.DefaultController{}, "get:Get") +} diff --git a/service/surrogate/v1/template/const.go b/service/surrogate/v1/template/const.go new file mode 100644 index 0000000..8e811ae --- /dev/null +++ b/service/surrogate/v1/template/const.go @@ -0,0 +1,12 @@ +package template + +const HTTP_CODE_VALID_REQUEST = 200 +const HTTP_CODE_ENTITY_CREATED = 201 +const HTTP_CODE_ENTITY_NOEXIST = 404 +const HTTP_CODE_ENTITY_CONFLICT = 409 +const HTTP_CODE_INVALID_REQUEST = 400 +const HTTP_CODE_ACCESS_UNAUTHORIZED = 401 +const HTTP_CODE_ACCESS_FORBIDDEN = 403 +const HTTP_CODE_NOALLOWED_REQUEST = 405 +const HTTP_CODE_TOOMANY_REQUEST = 429 +const HTTP_CODE_SERVER_ERROR = 500 diff --git a/service/surrogate/v1/template/default.go b/service/surrogate/v1/template/default.go new file mode 100644 index 0000000..eeac146 --- /dev/null +++ b/service/surrogate/v1/template/default.go @@ -0,0 +1,29 @@ +package template + +func Error(err error) (entry map[string]interface{}, code int) { + entry = make(map[string]interface{}) + entry["result"] = err.Error() + entry["status"] = "error" + + return entry, HTTP_CODE_ENTITY_NOEXIST +} + +func Success(msg string) (entry map[string]string, code int) { + return map[string]string{"result": msg, "status": "ok"}, HTTP_CODE_VALID_REQUEST +} + +func GetOK() int { + return HTTP_CODE_VALID_REQUEST +} + +func PostOK() int { + return HTTP_CODE_ENTITY_CREATED +} + +func PutOK() int { + return HTTP_CODE_ENTITY_CREATED +} + +func DeleteOK() int { + return HTTP_CODE_VALID_REQUEST +} diff --git a/service/surrogate/v1/template/request.go b/service/surrogate/v1/template/request.go new file mode 100644 index 0000000..52a8849 --- /dev/null +++ b/service/surrogate/v1/template/request.go @@ -0,0 +1,9 @@ +package template + +import ( + net "net/url" +) + +func QueryParamsCount(url *net.URL) int { + return len(url.Query()) +} diff --git a/service/surrogate/v1/template/response.go b/service/surrogate/v1/template/response.go new file mode 100644 index 0000000..4e3fe81 --- /dev/null +++ b/service/surrogate/v1/template/response.go @@ -0,0 +1,56 @@ +package template + +import ( + "strconv" + "github.com/feedlabs/feedify/context" +) + +type ResponseDefinition struct { + orderby string + orderdir string + page int + limit int +} + +func (this *ResponseDefinition) GetOrderBy() string { + return this.orderby +} + +func (this *ResponseDefinition) GetOrderDir() string { + return this.orderdir +} + +func (this *ResponseDefinition) GetPage() int { + return this.page +} + +func (this *ResponseDefinition) GetLimit() int { + return this.limit +} + +func NewResponseDefinition(input *context.Input) *ResponseDefinition { + orderby := input.Request.URL.Query().Get("orderby") + if orderby == "" { + orderby = "id" + } + + orderdir := input.Request.URL.Query().Get("orderdir") + if orderdir == "" { + orderdir = "asc" + } + + page := input.Request.URL.Query().Get("page") + if page == "" { + page = "0" + } + + limit := input.Request.URL.Query().Get("limit") + if limit == "" { + limit = "100" + } + + pageInt, _ := strconv.Atoi(page) + limitInt, _ := strconv.Atoi(limit) + + return &ResponseDefinition{orderby, orderdir, pageInt, limitInt} +} From 56c315379b8d9b4ac5176092bb4d384794352376 Mon Sep 17 00:00:00 2001 From: Chris Stasiak Date: Thu, 25 Jun 2015 22:02:48 +0200 Subject: [PATCH 6/7] SOME COMMENTS --- service/surrogate/surrogate.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/service/surrogate/surrogate.go b/service/surrogate/surrogate.go index cf47eae..2647719 100644 --- a/service/surrogate/surrogate.go +++ b/service/surrogate/surrogate.go @@ -6,11 +6,9 @@ import ( /* TODO: - - THIS SERVICE SHOULD ALLOW FOR WORKFLOW files - - WORKFLOW SHOULD be: - - SCENARIO -> YES (learning) - - PIPELINE -> YES (prediction) - - SENSOR/INDEXER/CRAWLER/HELPER -> NO (no pre-learning, no environment) + - SHOULD BE A BRIDGE TO PVP + - SHOULD BE A BRIDGE VIA VHS + - .. */ type SurrogateService struct {} From 0a1975627c8086acd557462254703766b59ddacd Mon Sep 17 00:00:00 2001 From: Chris Stasiak Date: Sun, 28 Jun 2015 17:34:00 +0200 Subject: [PATCH 7/7] Evolved VHS, PVP, AI frameworks --- ai/framework.go | 33 ++++++++++++------- population/hvs.go | 22 +++++++++++-- population/pvp.go | 20 ++++++----- population/pvp/{trait => }/decision.go | 2 +- .../pvp/{trait/location.go => environment.go} | 4 +-- population/pvp/{trait => }/fact.go | 2 +- population/pvp/knowledge.go | 3 ++ population/pvp/system_big3/approach.go | 10 ++++++ population/pvp/system_big3/avoidance.go | 10 ++++++ population/pvp/system_big3/behavior.go | 14 ++++++++ population/pvp/system_big3/situation_goal.go | 9 +++++ .../pvp/system_big3/situation_resource.go | 9 +++++ population/vhs/communicator.go | 7 ++++ population/vhs/communicator/audio.go | 1 + .../vhs/communicator/elasticfeed_protocol.go | 1 + population/vhs/communicator/http_server.go | 0 population/vhs/communicator/stdio.go | 0 population/vhs/communicator/video_audio.go | 1 + population/vhs/stdio/stdin.go | 6 ---- population/vhs/stdio/stdout.go | 6 ---- 20 files changed, 122 insertions(+), 38 deletions(-) rename population/pvp/{trait => }/decision.go (89%) rename population/pvp/{trait/location.go => environment.go} (57%) rename population/pvp/{trait => }/fact.go (86%) create mode 100644 population/pvp/knowledge.go create mode 100644 population/pvp/system_big3/approach.go create mode 100644 population/pvp/system_big3/avoidance.go create mode 100644 population/pvp/system_big3/behavior.go create mode 100644 population/pvp/system_big3/situation_goal.go create mode 100644 population/pvp/system_big3/situation_resource.go create mode 100644 population/vhs/communicator.go create mode 100644 population/vhs/communicator/audio.go delete mode 100644 population/vhs/communicator/http_server.go delete mode 100644 population/vhs/communicator/stdio.go create mode 100644 population/vhs/communicator/video_audio.go delete mode 100644 population/vhs/stdio/stdin.go delete mode 100644 population/vhs/stdio/stdout.go diff --git a/ai/framework.go b/ai/framework.go index dae1f34..91fe029 100644 --- a/ai/framework.go +++ b/ai/framework.go @@ -8,18 +8,27 @@ package ai SHOULD PROVIDE ABSTRACTION FOR ELASTICFEED ENGINE AND SERVER-PLUGIN LOGIC. - Support for ANN: new, train, predict, grow, optimise - - Support for GA: new, simulate - - - Recognition: Photo, Songs, Video - - Transformations: FFT, ... - - - Filtering - - Sorting - - Aggregation - - - Compressing - - Export/Import - - Transcoding + - unidirectional + - bidirectional / RNN (recurrent) + - ******************************** + - Continuous-time Recurrent Neural Network CTRNN + - Multiple Timescales Recurrent Neural Network MTRNN + - ******************************** + - steps: network architecture, learning rule, activation updating function + + - Support for Genethic Algorithms: new, simulate + + - Requirements: + - Recognition: Photo, Songs, Video + - Transformations: FFT, ... + - ******************************** + - Filtering + - Sorting + - Aggregation + - ******************************** + - Compressing + - Export/Import + - Transcoding */ func init() {} diff --git a/population/hvs.go b/population/hvs.go index 7a25de4..3fd88ec 100644 --- a/population/hvs.go +++ b/population/hvs.go @@ -1,5 +1,9 @@ package population +import ( + "github.com/feedlabs/elasticfeed/population/vhs" +) + /* ******************************* @@ -17,12 +21,26 @@ package population type VHSController struct { pvp *PVPController + + communicator vhs.Communicator +} + +func (this *VHSController) Query(query interface {}) interface {} { + return this.communicator.Query(this.pvp, query) +} + +func (this *VHSController) Train(train interface {}) interface {} { + return this.communicator.Query(this.pvp, train) } func (this *VHSController) GetPVP() *PVPController { return this.pvp } -func NewVirtualHumanSurrogate() *VHSController { - return &VHSController{nil} +func (this *VHSController) GetCommunicator() vhs.Communicator { + return this.communicator +} + +func NewVirtualHumanSurrogate(communicator vhs.Communicator) *VHSController { + return &VHSController{nil, communicator} } diff --git a/population/pvp.go b/population/pvp.go index 1287763..203a8d2 100644 --- a/population/pvp.go +++ b/population/pvp.go @@ -28,7 +28,7 @@ type PVPController struct { } -func (this *PVPController) Train() { +func (this *PVPController) Train(train interface{}) interface{} { /* PVP LEARNS VIA HUMAN TEACHING - CARROT/STICK METHOD @@ -40,9 +40,13 @@ func (this *PVPController) Train() { - HUMAN DECISION - LIFETIME ACTIVITY&KNOWLEDGE */ + + return map[string]interface{}{ + "train": "success", + } } -func (this *PVPController) Query() interface{} { +func (this *PVPController) Query(query interface{}) interface{} { /* QUESTION WITH LOGIC ANSWER: YES/NO @@ -64,16 +68,16 @@ func (this *PVPController) Query() interface{} { } } -func (this *PVPController) AskMood(time int) interface{} { - return this.Query() +func (this *PVPController) AskMood(query interface{}) interface{} { + return this.Query(query) } -func (this *PVPController) AskLike(subject interface{}) interface{} { - return this.Query() +func (this *PVPController) AskLike(query interface{}) interface{} { + return this.Query(query) } -func (this *PVPController) AskPriceAcceptance(subject interface{}, price int) interface{} { - return this.Query() +func (this *PVPController) AskPriceAcceptance(query interface{}) interface{} { + return this.Query(query) } // SUPER GOAL: Artificial Intelligence diff --git a/population/pvp/trait/decision.go b/population/pvp/decision.go similarity index 89% rename from population/pvp/trait/decision.go rename to population/pvp/decision.go index f32df88..1f62be2 100644 --- a/population/pvp/trait/decision.go +++ b/population/pvp/decision.go @@ -1,4 +1,4 @@ -package trait +package pvp type DecisionController struct { diff --git a/population/pvp/trait/location.go b/population/pvp/environment.go similarity index 57% rename from population/pvp/trait/location.go rename to population/pvp/environment.go index 8d8b611..54a191e 100644 --- a/population/pvp/trait/location.go +++ b/population/pvp/environment.go @@ -1,6 +1,6 @@ -package trait +package pvp -type LocationController struct { +type EnvironmentController struct { /* - NETWORK: 3G, Wifi - PLACE: HOME, OFFICE diff --git a/population/pvp/trait/fact.go b/population/pvp/fact.go similarity index 86% rename from population/pvp/trait/fact.go rename to population/pvp/fact.go index 661ae47..cbb7120 100644 --- a/population/pvp/trait/fact.go +++ b/population/pvp/fact.go @@ -1,4 +1,4 @@ -package trait +package pvp type FactController struct { /* diff --git a/population/pvp/knowledge.go b/population/pvp/knowledge.go new file mode 100644 index 0000000..6ffaa14 --- /dev/null +++ b/population/pvp/knowledge.go @@ -0,0 +1,3 @@ +package pvp + +type KnowledgeController struct {} diff --git a/population/pvp/system_big3/approach.go b/population/pvp/system_big3/approach.go new file mode 100644 index 0000000..0ff6ea0 --- /dev/null +++ b/population/pvp/system_big3/approach.go @@ -0,0 +1,10 @@ +package big3 + +type ApproachController struct { + /* + - help + - intimacy + - success + - dominance + */ +} diff --git a/population/pvp/system_big3/avoidance.go b/population/pvp/system_big3/avoidance.go new file mode 100644 index 0000000..496e676 --- /dev/null +++ b/population/pvp/system_big3/avoidance.go @@ -0,0 +1,10 @@ +package big3 + +type AvoidanecController struct { + /* + - avoid harm + - avoid disappointment + - avoid failure + - avoid financial loss + */ +} diff --git a/population/pvp/system_big3/behavior.go b/population/pvp/system_big3/behavior.go new file mode 100644 index 0000000..816aeab --- /dev/null +++ b/population/pvp/system_big3/behavior.go @@ -0,0 +1,14 @@ +package big3 + +type BehaviorController struct { + /* + - help + - intimacy + - success + - dominance + - avoid harm + - avoid disappointment + - avoid failure + - avoid financial loss + */ +} diff --git a/population/pvp/system_big3/situation_goal.go b/population/pvp/system_big3/situation_goal.go new file mode 100644 index 0000000..bae1314 --- /dev/null +++ b/population/pvp/system_big3/situation_goal.go @@ -0,0 +1,9 @@ +package big3 + +type SituationGoalController struct { + /* + - S1 + - ... + - S8 + */ +} diff --git a/population/pvp/system_big3/situation_resource.go b/population/pvp/system_big3/situation_resource.go new file mode 100644 index 0000000..34adcc2 --- /dev/null +++ b/population/pvp/system_big3/situation_resource.go @@ -0,0 +1,9 @@ +package big3 + +type SituationResourceController struct { + /* + - R1 + - ... + - R8 + */ +} diff --git a/population/vhs/communicator.go b/population/vhs/communicator.go new file mode 100644 index 0000000..3b232c0 --- /dev/null +++ b/population/vhs/communicator.go @@ -0,0 +1,7 @@ +package vhs + +type Communicator interface { + + Query(interface {}, interface {}) interface {} + Train(interface {}, interface {}) interface {} +} diff --git a/population/vhs/communicator/audio.go b/population/vhs/communicator/audio.go new file mode 100644 index 0000000..211f475 --- /dev/null +++ b/population/vhs/communicator/audio.go @@ -0,0 +1 @@ +package communicator diff --git a/population/vhs/communicator/elasticfeed_protocol.go b/population/vhs/communicator/elasticfeed_protocol.go index e69de29..211f475 100644 --- a/population/vhs/communicator/elasticfeed_protocol.go +++ b/population/vhs/communicator/elasticfeed_protocol.go @@ -0,0 +1 @@ +package communicator diff --git a/population/vhs/communicator/http_server.go b/population/vhs/communicator/http_server.go deleted file mode 100644 index e69de29..0000000 diff --git a/population/vhs/communicator/stdio.go b/population/vhs/communicator/stdio.go deleted file mode 100644 index e69de29..0000000 diff --git a/population/vhs/communicator/video_audio.go b/population/vhs/communicator/video_audio.go new file mode 100644 index 0000000..211f475 --- /dev/null +++ b/population/vhs/communicator/video_audio.go @@ -0,0 +1 @@ +package communicator diff --git a/population/vhs/stdio/stdin.go b/population/vhs/stdio/stdin.go deleted file mode 100644 index 91416fd..0000000 --- a/population/vhs/stdio/stdin.go +++ /dev/null @@ -1,6 +0,0 @@ -package stdio - -type Stdin interface { - - Write() -} diff --git a/population/vhs/stdio/stdout.go b/population/vhs/stdio/stdout.go deleted file mode 100644 index ecec9c1..0000000 --- a/population/vhs/stdio/stdout.go +++ /dev/null @@ -1,6 +0,0 @@ -package stdio - -type Stdout interface { - - Read() -}