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

Interoperability among Jason, Cartago, and C4Jason #38

Open gciatto opened 3 years ago

gciatto commented 3 years ago

I need to use Cartago + Jason. Similarly to what discussed here, I need to create a self-configuring Gradle project.

I set my dependencies as follows:

dependencies {
    implementation("org.jason-lang", "jason", "2.5-SNAPSHOT")
    implementation("org.jacamo", "cartago", "2.5")
    implementation("org.jacamo", "c4jason", "2.0.2")
}

and my repositories as follows:

repositories {
    maven("http://jacamo.sourceforge.net/maven2")
    maven("https://jade.tilab.com/maven")
    mavenCentral()
}

My mas2j file is as simple as the following one:

MAS helloworld {
  infrastructure: Centralised
  environment: c4jason.CartagoEnvironment
  agents: hello_agent agentArchClass c4jason.CAgentArch;
  aslSourcePath: "src/main/asl";
}

so I barely exploit a CartagoEnvironment, and my hello_agent.asl is as follows:

!hello.

+!hello : true
  <- .my_name(Name);
     println("Hello, world! by ",Name).

However, if launch the MAS, get the following error: cartago1 After a bit of debugging, I figured out that c4jason is looking for the cartago.security.AgentCredential class which has been moved to cargago.AgentCredential somewhere before cartago:2.0.2 (which is the earilest one available on http://jacamo.sourceforge.net/maven2). So there is no version of cartago on that repository which seems to be compatible with c4jason:2.0.2, and only that version of c4jason is available on that repository. (Here, by "compatible with" I mean "having a class named cartago.security.AgentCredential").

So, I tried with the following dependencies:

dependencies {
    implementation("org.jason-lang", "jason", "2.5-SNAPSHOT")
    implementation("org.jacamo", "cartago", "2.5")
    implementation("org.jacamo", "jaca", "2.5")
}

but this time I get the following error: cartago2 and I was not able to figure out why.

So my question here is: which set of artifacts should I use to ley my project exploit Cartago from Jason? And which versions of those?

robertacalegari commented 3 years ago

i would be interested in this feature as well

jomifred commented 3 years ago

The integration of Jason and Cartago is not well supported indeed.

I can try to figure out the problem, but... I'd suggest you to use JaCaMo instead, it aims to properly integrate jason and cartago. In the case of cartago 2.5, the jacamo 0.10 should be used.

More at https://github.com/jacamo-lang/jacamo

sabbatinif commented 3 years ago

I would be interested in this feature as well

gciatto commented 3 years ago

@jomifred thanks for the hint. I tried with the following dependencies:

dependencies {
    implementation("org.jacamo", "jacamo", "1.0-SNAPSHOT")
}

The second message error is apparently still there: cartago

I don't know what to do.

jomifred commented 3 years ago

In the case of Jason+Cartago (no JaCaMo), the cartago package was renamed from c4 to jaca, I guess that is the main issue.

I committed and example (using gradle) at https://github.com/jason-lang/jason/tree/hotfix/demos/basic-cartago

Notice that it uses RunCentralisedMAS (I still do not fix the it for RunJasonProject).

robertacalegari commented 3 years ago

Thank you so much @jomifred, I manage to run the gradle project with jaca!

gciatto commented 3 years ago

Apparently, @robertacalegari retried with:

dependencies {
    implementation("org.jason-lang", "jason", "2.5-SNAPSHOT")
    implementation("org.jacamo","cartago", "2.5")
    implementation("org.jacamo", "jaca", "2.5")
}

and it works now. Did you, @jomifred, changed something in any of the artifacts? Otherwise, I may have mistaken some test of mine. In that case, I apologise.

jomifred commented 3 years ago

I didn't change cartago. I guess the issue is to use c4jason instead of jaca.... (I am not a great expert about cartago, sorry)