swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swarm-Support] Having Problems in loading saved agents from a .scm file


From: Mervin Chan
Subject: [Swarm-Support] Having Problems in loading saved agents from a .scm file.
Date: Mon, 18 Oct 2004 03:50:35 +0800

 

 

 

I have been trying to save my agents in a .scm file and loading them again in a new simulation.

 

I saved my agents in this manner (in ModelSwarm.java):

 

           

Archiver archiver = (new LispArchiverImpl(Globals.env.globalZone, "machine.scm"));

aMachine = new Machine(Globals.env.globalZone, factorySpace,i,false,'N',1,proc_time,aBuffer,aOutBuffer);

            archiver.putShallow$object("Machine", aMachine);

archiver.sync ();

 

The contents of my machine.scm

 

(list

  (cons 'Machine

    

                        (make-instance 'Machine

                                    #:myFactorySpace nil

                                    #:buffername nil

                                    #:obuffername nil

                                    #:factorynumber 3

                                    #:state #f

                                    #:timestamp 1

                                    #:process_time 2

                                    #:flag #\N

                        )

            )          

)

 

My code to load the agents in a new simulation is as follows:

 

            aMachine = (Machine)archiver.getObject("Machine");

 

 

The compilation went ok, but upon running, I had an error like this:

 

***event raised for error: SourceMessage

*** function: _i_JavaProxy__createJavaCounterpart_(), file:/src/Swarm/swarm/src

/defobj/JavaProxy.m, line 72

 

Could not find constructor for ‘Machine’

***execution terminating due to error

/src/Swarm/swarm/scr/defobj/Symbol.m:187 –[Error(c) _raiseEvent:]

Signal 6

 

What went wrong?  There is nothing wrong with my Machine.java, as I had successfully created Machine agents in the past.

 

I create Machine agents normally by doing:

 

aMachine = new Machine(Globals.env.globalZone, factorySpace,1,false,'N',1,proc_time,aBuffer,aOutBuffer);

           

Problems arose only when I attempt to save them in a file, and loading them.

 

My code for Machine.java :

 

public class Machine extends SwarmObjectImpl

 

{

….

….

 

public Machine(Zone aZone, FactorySpace fSpace,int Factorynum,boolean FactoryState,char Factoryflag,int Factorytime,int Processing_time,Buffer bname,OutBuffer oname)

    {

            // Call the contructor for the Factory's parent class.

            super(aZone);

           

           

            machineList = new ListImpl(aZone);

            myFactorySpace = fSpace;

            factorynumber = Factorynum;

            state = FactoryState;

            timestamp = Factorytime;

            process_time = Processing_time;

            buffername = bname;

            obuffername = oname;

            flag=Factoryflag;          //E = Emergency N=Normal

           

    }

 

 

 

}

 

 

 

 

 

 

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]