Skip to content

save_agent

Tushar Semwal edited this page Oct 15, 2017 · 1 revision

Syntax:

save_agent(GUID, FileName) % Saves the predicates associated to the specified agent into a file. %

Agent_name: <atom + > FileName: <atom + >

Description:

This predicate is used to save all the predicates, payload and facts associated with the agent named Agent_name specified by a user. The definitions are stored in the file with name FileName.

Example:

Let the agent handler code be:

agent_handler(guid,(IP,Port),main):-
writeln("I am the handler"),
N is 1,
writeln(N).
?- agent_save(myagent,'E:\\save_agent_state.txt').

On successful execution of above predicate, a text file is created in the specified location containing agent code. The save_agent_state .txt file will save the agent state as:

agent_handler(myagent,(__ , __),main):-
writeln("I am the handler"),
N is 1,
writeln(N).

The user can use the desired file type (eg. .pl, .txt).

Clone this wiki locally