gama-platform / gama.clients Goto Github PK
View Code? Open in Web Editor NEWGama Client - Repository dedicated to development of different Gama Client and the corresponding GAMA API
Gama Client - Repository dedicated to development of different Gama Client and the corresponding GAMA API
We currently have two repositories:
Repository dedicated to development of different Gama Client and the corresponding GAMA API
Gama-client is a python wrapper for interacting with the headless mode (called gama-server) of the multi-agent modeling platform
Now this is confusing !
gama.client
is the repository for developing different GAMA clients, why is the python version in its own repository ?gama DOT client
vs. gama MINUS client ...
?It needs to be changed as soon as possible (i.e. before too many people begin to use these clients) so that we prevent more mess to appear.
gama-client-python
into it and call the repository gama.clients
or gama.server.clients
, with sub-folders in it corresponding to the different languages. This solution has my favor for a question of management (and also because it would provide one place where the API of the server is documented, etc. )gama.client.python
, gama.client.json
... etc. We might keep a gama.clients
or gama.server.clients
around for common things if necessary (but I'm not sure).Gama Client
alone.@lesquoyb @hqnghi88 I think you are the two more concerned here. Can you make sure one of the first 2 options can be done quickly ? It is absolutely essential that we do not maintain messy situations like this one too long.
the traffic simulation is not present on the html file
Add a function to call the fetch command
I am trying to make the client architecture working with my own model (that use to work in the 1.8)
In order to plug it to Gama
var ABSOLUTE_PATH_TO_GAMA = '/Users/hqn88/git/';
var modelPath = ABSOLUTE_PATH_TO_GAMA + 'gama/msi.gama.models/models/Tutorials/Road Traffic/models/Model 05.gaml';
var experimentName = 'road_traffic';
var species1Name = 'people';
var attribute1Name = 'objective';
var species2Name = 'building';
var attribute2Name = 'type';
and uncomment this one (be sure it's poiting to the right folder where you have downloaded ReAgent
const modelPath = '/Users/arno/Projects/GitHub/UD_ReAgent_ABM/ReAgent/models/Gratte_Ciel_Demo.gaml';
const experimentName = 'Demo';
const species1Name = 'people';
const attribute1Name = 'type';
//const species2Name = 'building';
//const attribute2Name = 'type';
After few iteration I have the following error in my browser console
> Error: J"... is not valid JSON
at JSON.parse (<anonymous>)
at Object.callback (gama_client.js:93:20)
at wSocket.onmessage (GAMA.js:53:48)
Hi great people!
Thanks for investing in my issues.
I found the GAMA headless server https://gama-platform.org/wiki/HeadlessServer#hello-world-visualization-in-mapbox and tried to run a copy on my local machine. I had not been successful yet (elaboration below). I assume this server and the JS client allow me to run and show GAMA simulation results on the web. Have there been any successful examples deployed on the web that I can click and see?
For the issue I ran into, here is an elaboration:
I am using a MacOS M1 Chip computer, with a M1 chip GAMA installation. I followed the steps in this webpage: https://gama-platform.org/wiki/HeadlessServer#hello-world-visualization-in-mapbox to start a headless server and try to run the HellowWorld Visualization in Mapbox (JS client).
To start the server, I entered the following codes in my terminal:
cd Gama.app/Contents/headless
bash gama-headless.sh -socket 6868
The server seems to start fine:
Then, I go to the gama.client.js to modify the path of the library model file (highlighted). The path is found by opening the specific library model in local GAMA software, going to File -> Properties -> Location.
I uncommented the example that is on road traffic and commented out all other examples (see below).
Then in the same gama_client.js, I modify the local path to Websocket to ws://localhost:6868/, because that is the port in the server.
That are ALL the changes I made. Then, I opened the index.html file in my browser and it shows this: The base map is rendered correctly, but no simulation is rendered (I am expecting something from gama_client.js).
Once I loaded the index.html, the terminal says:
0:0:0:0:0:0:0:1 entered the room!
And there are no other error messages. I am not sure how to interpret the error warnings in the browser inspector.
I tried the following approaches, and it did not solve the problem:
- Change to a different port
- Change to a different html (e.g., syntax.html)
- Change to a different browser
Any idea of what to go next will be appreciated because I am clueless. Thanks!
bash gama-headless.sh -socket 6868 -v doesn't work so far.
When run in verbose the client doesn't run
Describe the bug
Using python to run a gama model on a local gama headless sever 5 times, it keep running with no more respond after 2-3 model loaded.
To Reproduce
The python code:
import asyncio
from typing import Dict
from gama_client.base_client import GamaBaseClient
load_command_secret_id = 123
other_id = 1
async def message_handler(message: Dict):
if "command" in message.keys() and "my_secret_id" in message['command'] and message['command']["my_secret_id"] == load_command_secret_id:
print("\nanswer for the load command we wanted to retrieve received:", message)
else:
print("\nother kind of message", message)
async def main(gaml_file, experiment):
client = GamaBaseClient("localhost", 6868, message_handler)
await client.connect(False)
await client.load(gaml_file, experiment, additional_data={"my_secret_id": other_id})
await client.load(gaml_file, experiment, additional_data={"my_secret_id": other_id})
await client.load(gaml_file, experiment, additional_data={"my_secret_id": other_id})
await client.load(gaml_file, experiment, additional_data={"my_secret_id": other_id})
await client.load(gaml_file, experiment, additional_data={"my_secret_id": other_id})
# # this is the command we want to retrieve the answer to
# await client.load(gaml_file, experiment, additional_data={"my_secret_id": load_command_secret_id})
# # this is not the command we want to retrieve
# await client.load(gaml_file, experiment, additional_data={"my_secret_id": other_id})
while True:
pass
gaml_file = r"C:\Users\DUNG DO\Gama_Workspace\test\models\test.gaml"
experiment = "exp"
if __name__ == "__main__":
asyncio.run(main(gaml_file=gaml_file, experiment=experiment))
Gama file at "C:\Users\DUNG DO\Gama_Workspace\test\models\test.gaml":
model test
global
{
reflex stop when: cycle > 5
{
do pause;
}
reflex save_test
{
save cycle to: "C:/Test/Output/test1.txt" format: txt;
}
}
experiment exp type: gui until:cycle >1
{
output
{
display "display"
{
chart "log"
{
data "log" value: log(cycle+1);
}
}
}
}
Information:
Summarizing a previous discussion, I would like to request the ability to transfter attribute tables of (filtered) species/agents to and from GAMA
Describe the bug
The documentation is currently out sync with the repo itsel
https://gama-platform.org/wiki/HeadlessServer#hello-world-visualization-in-mapbox
Javascript/gama_client.js
is now in js/gama_client.js
chain_messages.js
and Javascript/message_example
do not exist anymore
We just need to converge between the doc and the code. To discuss with @hqnghi88
Currently every time I want to publish a new version of the python wrapper I have to follow the list of instructions at the end of the readme but @RoiArthurB pointed out that I could simplify the process by creating a gh action to do it
Does the GAMA client support running 3D agents?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.