jacamo-lang / jacamo

This project aims to promote the MultiAgent Oriented Programming (MAOP) approach by providing a suitable integration of tools and languages for programming agents, their environment and organisation.
https://jacamo-lang.github.io
GNU Lesser General Public License v3.0
77 stars 31 forks source link

Configure environment within a Jason module #7

Closed lcpz closed 7 years ago

lcpz commented 7 years ago

Hello, is it possible to give an environment to agents created within a Jason module?

I'd like to know how to correctly use CArtAgO and Moise within Jason namespaces.

Following is a test case where I fail to create a workspace into a module.

example.jcm

mas example {

    agent alice

    // agent source path
    asl-path: src/agt, src/agt/inc

}

alice.asl

!start.

+!start <- .include("instantiator.asl", N).

instantiator.asl

!start.

+!start <- .create_agent("bob", "bob.asl").

bob.asl

!start.

+!start <- createWorkspace("myworkspace").

-!start[error(E), error_msg(M)]
<-
    .print("error '", E, "' while executing 'start' goal: ", M).

Console output:

CArtAgO Http Server running on http://127.0.0.1:3273
Jason Http Server running on http://127.0.0.1:3272
[alice] creating a namespace with 'instantiator' functionalities
[alice] instantiating agent bob
[bob] trying to create a workspace
[bob] error 'action_failed' while executing 'start' goal: no environment configured!

I attach the test case project: example.zip

Could you please tell me what am I doing wrong? Thanks in advance.

jomifred commented 7 years ago

Hi, thanks for reporting this issue. The problem is indeed in the use of .create_agent internal action. We will try to fix it soon. Meanwhile, you can solve the problem by replacing

  .create_agent("bob", "bob.asl").

by

  jacamo.create_agent("bob", "bob.asl").
jomifred commented 7 years ago

The bug is fixed in Jason GIT repository.

lcpz commented 7 years ago

I'm glad I've been of help indirectly. Thanks for the quick fix.

While we are at it, I'd like to ask for a couple of things.

How can we dispose of a namespace? My project involves creating an open MAS with the possibility of having multiple concurrent instances of an organisation. To avoid problems, I thought to use namespaces for incapsulation, but once an instance has concluded its execution, how can we free memory from it?

Also, open MAS are very appealing for the industry, but there are no demos/examples here. In my humble opinion, it'd be nice to have some templates shocasing good habits for concurrency and scalability.

jomifred commented 7 years ago

Hi Luke,

indeed, namespaces can be a useful tool to deal with big/open applications. It is quite new in Jason/JaCaMo and we are still exploring this feature.

for the first question, to remove all beliefs of a namespace, the simplest way is

.abolish(nsdemo::_);

for the second..... unfortunately we still do not have those examples, despite their importance. I hope we can provide them soon.

All the best.

lcpz commented 7 years ago

Thanks again for your time.

I could submit my project to you once completed. If you like it, it could be a start for those examples.

jomifred commented 7 years ago

Good, that will be great!!!

On 3 de jul de 2017, at 14:32, Luke Bonham notifications@github.com wrote:

Thanks again for your time.

I could submit my project to you once completed. If you like it, it could be a start for those examples.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

-- Jomi Fred Hubner Federal University of Santa Catarina Department of Automation and Systems Engineering PO Box 476, Florianópolis, SC 88040-900 Brazil http://jomi.das.ufsc.br