Git Product home page Git Product logo

marlon's Introduction

MARLon

Using Multi-Agent Reinforcement Learning in CyberBattleSim.

Developing

CyberBattleSim Image

CyberBattleSim cannot be installed using pip install like many other Python libraries, instead suggesting Docker as an installation method. In order to maintain a consistent development environment this repository uses VSCode Devcontainers powered by Docker. Unfortunately, CyberBattleSim does not provide a public image for licensing reasons so the CyberBattleSim Docker image must either be built manually or retrieved from a private Docker registry.

Building The CyberBattleSim Image

To build the CyberBattleSim Docker image, clone the official CyberBattleSim repository and run the following from the root directory:

docker build -t cyberbattle:1.1 .

Then in your cloned MARLon repository, change the first line of .devcontainer/Dockerfile from

FROM ghcr.io/james-lg/cyberbattlesim:1 as cb

to

FROM cyberbattle:1.1 as cb

Running the Devcontainer

Open the cloned MARLon repository in VSCode and ensure the Remote - Containers extension is installed.

Then click the 'Reopen in Container' button in the pop up in the bottom right. Or if that does not show up, click the green >< icon in the very bottom left of VSCode, and select 'Reopen in Container' in the menu that opens from the center-top of VSCode.

You can now open a new terminal if one was not opened automatically with Ctrl+Shift+`.

Usage

These subsections assume you are running the commands from a terminal within the Devcontainer. Instructions for opening the Devcontainer are given above.

Training

Use the 'Run and Debug` tab of VSCode to choose a training script. Run the script by pressing the green play button to the left of the dropdown.

run and debug

When the training has finished, the program will save the agent as a .zip or .pkl file in the current working directory before starting an multi-episode evaluation cycle.

Simulating With a GUI

MARLon is capable of rerunning a saved agent for a single episode that can be viewed step-by-step using a GUI featuring the network graph.

simulation

Running the GUI

The GUI is a locally hosted webapp to take advantage of CyberBattleSim's network graphs rendered with plotly. It can be run with the following command from the root of the repository.

flask run

Open http://127.0.0.1:5000/ in a browser to access the page.

To exit the webapp, press Ctrl+C in the terminal running the webapp.

Using the GUI

Choose an attacker and/or defender agent (a .zip or .pkl saved from training scripts described above), and press the Simulate button. Simulation make take several minutes to complete, check the webapp terminal output for progress.

The simulation has completed when the first graph renders. Use the Previous/Next buttons to move to the next step in which the reward value changed.

marlon's People

Contributors

james-lg avatar christian-fisher avatar chrisnguyen3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.