Quantcast

Internal Actions customization

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Internal Actions customization

Alberto Signoretti
Hi,

i'm using some customized internal actions in a Jason Project. I have a doubt about the relationship of the Jason interpreter with the class that implements my customized internal action.

I'm using 15 diferent agents that, in diferent points of the simulation, need to call the customized IA. When the Jason starts, it will creat 15 diferent instances (one for each individual agent) of the class that implements the IA? Can I use the instance of the IA to keep some state variables belonging to a particular agent? 

Best regards.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Internal Actions customization

Jomi Hubner
<base href="x-msg://1094/">Hi Alberto,

the default implementation creates one instance of the internal action for each agent (15 instances in your case). If you want the agents in the same JVM to share the instance, you have to include 

    private static InternalAction singleton = null;
    public static InternalAction create() {
        if (singleton == null
            singleton = new println(); // replace println for your class name
        return singleton;
    }

in your class.

HTH,

Jomi
 
On 07/06/2011, at 19:29, Alberto Signoretti wrote:

Hi,

i'm using some customized internal actions in a Jason Project. I have a doubt about the relationship of the Jason interpreter with the class that implements my customized internal action.

I'm using 15 diferent agents that, in diferent points of the simulation, need to call the customized IA. When the Jason starts, it will creat 15 diferent instances (one for each individual agent) of the class that implements the IA? Can I use the instance of the IA to keep some state variables belonging to a particular agent? 

Best regards.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users

-- 
Jomi Fred Hubner
Federal University of Santa Catarina
Department of Automation and Systems Engineering
PO Box 476, Florianópolis, SC
88040-900 Brazil


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Internal Actions customization

Francisco Grimaldo Moreno

Hi all,

Regarding this issue, do ArithFunctions work the same way?

Thanks,
Francisco Grimaldo


A Dimecres, 8 de juny de 2011 14:37:38, Jomi Hubner va escriure:

> Hi Alberto,
>
> the default implementation creates one instance of the internal action for
>  each agent (15 instances in your case). If you want the agents in the same
>  JVM to share the instance, you have to include
>
>     private static InternalAction singleton = null;
>     public static InternalAction create() {
>         if (singleton == null)
>             singleton = new println(); // replace println for your class
>  name return singleton;
>     }
>
> in your class.
>
> HTH,
>
> Jomi
>
> On 07/06/2011, at 19:29, Alberto Signoretti wrote:
> > Hi,
> >
> > i'm using some customized internal actions in a Jason Project. I have a
> > doubt about the relationship of the Jason interpreter with the class that
> > implements my customized internal action.
> >
> > I'm using 15 diferent agents that, in diferent points of the simulation,
> > need to call the customized IA. When the Jason starts, it will creat 15
> > diferent instances (one for each individual agent) of the class that
> > implements the IA? Can I use the instance of the IA to keep some state
> > variables belonging to a particular agent?
> >
> > Best regards.
> > -------------------------------------------------------------------------
> >----- EditLive Enterprise is the world's most technically advanced content
> > authoring tool. Experience the power of Track Changes, Inline Image
> > Editing and ensure content is compliant with Accessibility Checking.
> > http://p.sf.net/sfu/ephox-dev2dev________________________________________
> >_______ Jason-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/jason-users
>

--
-------------------------------------------
Dr. Francisco Grimaldo Moreno (PhD)
(Id. GnuPG: 0xBAEC75A7)

Departament d'Informàtica
Escola Tècnica Superior d'Enginyeria (ETSE)
Universitat de València
Avda. Vicent Andrés Estellés, s/n
46100 Burjassot-València (SPAIN)

Tel: +34 96 354 44 87 (+34 96 354 45 65)
Fax: +34 96 354 47 68
Email: [hidden email]
Web: http://www.uv.es/grimo
-------------------------------------------

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Internal Actions customization

Jomi Hubner
Hi Francisco,

For user defined functions, we have one instance for each agent. For some predefined functions (as abs, floor, ...) the instance is shared by all agents in the same JVM.

The current version of Jason does not provide an (easy) way to change that. If need such a feature, we can discuss it implementation.

Cheers,

Jomi

On 08/06/2011, at 13:37, Francisco Grimaldo Moreno wrote:

>
> Hi all,
>
> Regarding this issue, do ArithFunctions work the same way?
>
> Thanks,
> Francisco Grimaldo
>
>
> A Dimecres, 8 de juny de 2011 14:37:38, Jomi Hubner va escriure:
>> Hi Alberto,
>>
>> the default implementation creates one instance of the internal action for
>> each agent (15 instances in your case). If you want the agents in the same
>> JVM to share the instance, you have to include
>>
>>    private static InternalAction singleton = null;
>>    public static InternalAction create() {
>>        if (singleton == null)
>>            singleton = new println(); // replace println for your class
>> name return singleton;
>>    }
>>
>> in your class.
>>
>> HTH,
>>
>> Jomi
>>
>> On 07/06/2011, at 19:29, Alberto Signoretti wrote:
>>> Hi,
>>>
>>> i'm using some customized internal actions in a Jason Project. I have a
>>> doubt about the relationship of the Jason interpreter with the class that
>>> implements my customized internal action.
>>>
>>> I'm using 15 diferent agents that, in diferent points of the simulation,
>>> need to call the customized IA. When the Jason starts, it will creat 15
>>> diferent instances (one for each individual agent) of the class that
>>> implements the IA? Can I use the instance of the IA to keep some state
>>> variables belonging to a particular agent?
>>>
>>> Best regards.
>>> -------------------------------------------------------------------------
>>> ----- EditLive Enterprise is the world's most technically advanced content
>>> authoring tool. Experience the power of Track Changes, Inline Image
>>> Editing and ensure content is compliant with Accessibility Checking.
>>> http://p.sf.net/sfu/ephox-dev2dev________________________________________
>>> _______ Jason-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/jason-users
>>
>
> --
> -------------------------------------------
> Dr. Francisco Grimaldo Moreno (PhD)
> (Id. GnuPG: 0xBAEC75A7)
>
> Departament d'Informàtica
> Escola Tècnica Superior d'Enginyeria (ETSE)
> Universitat de València
> Avda. Vicent Andrés Estellés, s/n
> 46100 Burjassot-València (SPAIN)
>
> Tel: +34 96 354 44 87 (+34 96 354 45 65)
> Fax: +34 96 354 47 68
> Email: [hidden email]
> Web: http://www.uv.es/grimo
> -------------------------------------------
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users

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


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Loading...