Here we present COSMOS (Continuum Optimization for Swarm-based Multitier Orchestration System), a novel simulation framework for evaluating self-organizing scheduling algorithms in edge-fog-cloud ecosystems. Unlike conventional schedulers that rely on centralized optimization, COSMOS implements swarm intelligence principles inspired by decentralized biological systems, enabling emergent coordination across distributed nodes.
The framework extends Mesa’s agent-based modeling toolkit to simulate:
- Multi-tier resource dynamics: Agent populations representing edge devices, fog nodes, and cloud servers with configurable behavioral policies
- Constraint-aware scheduling: Integration of answer set programming (ASP) for hard constraints and metaheuristic optimization for soft constraints
- Network-aware orchestration: Evaluation of communication costs and dependencies across continuum layers
Developed in Lakeside Labs in scope of Myrtus (Multi-layer 360 dynamic orchestration and interoperable design environment for compute-continuum systems) project.
Make sure that python
binary is of the correct version. For Windows users, Python 3.10 can be installed from Microsoft Store.
Linux users already know how to install Python on their system.
The simulation framework was tested with Python 3.10
and Mesa 3.0.3
(with corresponding dependencies). To check the version of your binary, execute the following command:
python --version
The following Python modules are required for this project. Ensure that you have the specified versions installed:
- mesa (3.0.3)
- matplotlib (3.5.1)
- numpy (1.21.5)
- networkx (3.3)
- protobuf (3.12.4)
- pyyaml (6.0)
- pandas (2.0.3)
- tqdm (4.66.4)
- python-dateutil (2.8.2)
To install the required dependencies, run:
python3.10 -m pip install -r requirements.txt
Or:
python3.10 -m pip install mesa==3.0.3 matplotlib==3.5.1 numpy==1.21.5 networkx==3.3 protobuf==3.12.4 pyyaml==6.0
In case of issues with installing pyyaml
, the following steps can be taken:
python3.10 -m pip install "cython<3.0.0"
# then run:
pip install --no-build-isolation pyyaml==6.0
Proceed further with the installation of the remaining dependencies from requirements.txt
.
To run the simulation:
- adjust the configuration file named
config.yml
in theconfig
directory - navigate to the
modules
directory:
cd modules
- execute the following command:
python3.10 EFC_main.py
The directory structure of the simulation framework is as follows:
modules
: contains the source code structured in modules.config
: contains the configuration file.generated/data
contains the generated dataset of the EFC network graphs/models.trained_mlp
contains the configuration files of the trained MLP models.interfaces
contains compiled protocol buffer files.evaluation
contains the scripteval.py
for evaluation of the trained MLP models.
proto
: contains the protocol buffer files describing the inter-process communication with the FREVO training framework. Is not needed for running the simulation.
The configuration file config.yml
contains the following parameters:
num_pods
: number of pods in the network. Must be bigger or equal to sim_steps.sim_steps
: number of simulation steps. The number of pods entering the network at each step is calculated as:num_pods / sim_steps
num_edge_devices
: number of edge devices in the network. Thenum_
parameters are not considered when the graph is imported withimport_graph: True
.num_fog_nodes
: number of fog nodes in the network.num_cloud_servers
: number of cloud servers in the network.behaviour_type
: type of decision-making behaviour ('random_walk', 'aco' or 'mlp'). The 'mlp' behaviour requires a trained MLP model to be imported ifmode: normal
is set.import_graph
: whether to import a graph from thegenerated/data
directory.graph_sample
: name of the graph to import. The graph must be in thegenerated/data
directory. For example, if the file is namedEFC1.graphml
, the value ofgraph_sample
should beEFC1
. The right format is.graphml
.nn_sample
: name of the MLP configuration file to import. The file must be in thetrained_mlp
directory. For example, if the file is namedmlp_config.yml
, the value ofnn_sample
should bemlp_config.yml
.plot_all
: whether to plot the simulation results. Is disabled during the training phase.gen_samples_num
: number of samples to generate. Is only used whenmode: gen
is set.mode
: mode of the simulation ('normal', 'gen' or 'train'). The 'train' mode trains an MLP model using the FREVO training framework. The 'gen' mode generates a dataset of EFC network graphs/models.path_to_dataset
: path to the dataset. Is only used whenmode: gen
is set or when the graph is imported. The following parameters are only used whenbehaviour_type: mlp
andmode: normal
are set:frevo_port
: port number of the FREVO training framework to connect to.candidate_evals
: number of inference requests to evaluate a candidate.training_results_path
: path to save the best trained model.evaluate_best_candidate
: whether to evaluate the best trained model at the end of training+exporting.randomized_pod_interval
: whether to randomize the interval between the pods entering the network. If set toFalse
, the interval is equal to1
and number of issued pods is always predictable.mu
: parameterµ ∈ (0, 1]
defining the frequency of randomly arriving pods. The value is only used whenrandomized_pod_interval: True
is set.
Typical configuration:
num_pods: 500
sim_steps: 10
num_edge_devices: 35
num_fog_nodes: 10
num_cloud_servers: 5
behaviour_type: 'aco'
import_graph: True
graph_sample: EFC1
nn_sample: 'mlp_config.yml'
plot_all: True
gen_samples_num: 50
mode: 'normal'
path_to_dataset: 'generated/dataset'
frevo_port: 9990
candidate_evals: 10
training_results_path: "/home/user/Documents/Myrtus/Frevo/Frevo/Results/EFC_test"
evaluate_best_candidate: True
randomized_pod_interval: False
mu: 0.5
Saved trained MLP candidates can be evaluated automatically using the combination of EFC_Evaluator.py
source file located in modules
directory and eval.py
script located in the modules/evaluation
directory.
To generate the evaluation results, the following steps should be taken:
- adjust the configuration file named
config.yml
in theconfig
directory - navigate to the
modules
directory:
cd modules
- run
EFC_Evaluator.py
:
python3.10 EFC_Evaluator.py
The preliminary evaluation results for plotting will be saved in the evaluation
directory as eval.csv
.
- navigate to the
modules/evaluation
directory:
cd evaluation
- run
eval.py
to visualize and plot the evaluation results:
python3.10 eval.py