jason-lang / jason

Jason is a fully-fledged interpreter for an extended version of AgentSpeak, a BDI agent-oriented logic programming language.
http://jason-lang.github.io
GNU Lesser General Public License v3.0
223 stars 67 forks source link

Command-line arguments to Jason project #97

Open nmontesg opened 2 years ago

nmontesg commented 2 years ago

Hi,

Is it possible to pass command-line arguments when calling the jason script?

I would like to have command-line arguments when running jason $jason project.mas2j that are passed to the MAS file:

MAS project {

    environment:
        ProjectEnv($1, $2, ...)

    agents:
        ...
}

Is it possible to do such a thing?

jomifred commented 2 years ago

Hi, unfortunately this feature is not implemented yet! But, for sure, it would be a valuable improvement for future releases.

nmontesg commented 2 years ago

Hi, a somewhat related question is whether a custom agent class can accept arguments. In my case, I want to have a custom agent class with an array of "back up" belief bases. I would like the number of back ups to be an argument provided at runtime. Is this possible? If so, what methods should be overriden (constructor of initAg())?

jomifred commented 2 years ago

Hi Nives,

All arguments informed for an agent in the .mas2j are stored and available at runtime. They are inside the classe Settings (called UserParameters), that belongs to TransitionSystem, that every agent has one.

I wrote an example:

https://github.com/jason-lang/jason/tree/develop/demos/custom-ag

HTH,

Jomi

On 7 Jun 2022, at 05:35, Nieves Montes Gómez @.***> wrote:

Hi, a somewhat related question is whether a custom agent class can accept arguments. In my case, I want to have a custom agent class with an array of "back up" belief bases. I would like the number of back ups to be an argument provided at runtime. Is this possible? If so, what methods should be overriden (constructor of initAg())?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

nmontesg commented 2 years ago

Hi Jomi,

thanks for the response, it was very helpful!