acsicuib / YAFS

Yet Another Fog Simulator (YAFS)
MIT License
98 stars 72 forks source link

Run different algorithm within YAFS example #56

Closed subwayi closed 2 years ago

subwayi commented 2 years ago

Hi @wisaaco ,

I would like to implement specific algorithms on YAFS examples/ and /tutorial_scenarios. Should I replace the default algorithm of yafs.application / yafs.population / yafs.placement / yafs.selection directly? Or, Is there another easier way to implement new algorithms into YAFS examples? I am afraid of messing up the structure of the examples.

Thanks.

Sub.

wisaaco commented 2 years ago

Hi Sub,

In general, these files are not necessary to modify. If you need a new app you can define it using the json file and the yafs.application will support it. The same happens with the initial position of the users. You only need to modify the json file. New algorithms can be implemented in external files as a DES process. These DES processes can have all the information of the simulation (the "sim/s" variable) and modify whatever internal variable.

You can find a "good" skeleton project from our last work: https://github.com/acsicuib/MARIO/tree/SI-SoSs (from this paper: https://onlinelibrary.wiley.com/doi/full/10.1002/smr.2405). The idea is to use YAFS as a library, extending some functionalities.

The main file is in multi-agent-policies/main.py. And it loads basic information (topology, initial user placement, initial service placement, and so on) from scenarios/ folders. As you can see, this data is based on JSON files. it is very convenient/easy to have the information in this format. You can even design scripts to generate it if your structure is larger. In this project, the service placement is controlled dynamically by a specific DES process (defined at multi-agent-policies/environment/node_manager.py). It does some operations such as migrate, replicate,... on the deployed services during the simulation.

In any case, feel free to modify some files from yafs to achieve your modelling!!! :) Best

subwayi commented 2 years ago

Hi @wisaaco,

Yes, I find the "MARIO" project and that is pretty cool. I studied the JSON file under MARIO as well. I thought that JSON file just only "data" for the main.py or another python scrip.(Sorry I had not found node_manager.py of MARIO for the present.) Can I just modify JSON file to implement kind of algorithm (such like "Ant Colony Optimization") into YAFS tutorial_scenarios or MARIO ? Please correct me if any misunderstood.

Thank you.

Best Sub

wisaaco commented 2 years ago

Of course, you can generate your models (topology, placement, ...) into JSON files using other scripts and check/compare the performance between indicators of each model. Really, It is not necessary to modify "the simulator" to test different alternatives. The tutorial is a good starting point. Best, Isaac

subwayi commented 2 years ago

Great! I'll do it. Many thanks. :)

Best Sub