Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pymaro

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pymaro

MARO Python Package

  • 0.3.2a4
  • PyPI
  • Socket score

Maintainers
2

.. image:: https://img.shields.io/pypi/l/pymaro :target: https://github.com/microsoft/maro/blob/master/LICENSE :alt: License

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/platform.svg :target: https://pypi.org/project/pymaro/ :alt: Platform

.. image:: https://img.shields.io/pypi/pyversions/pymaro.svg?logo=python&logoColor=white :target: https://pypi.org/project/pymaro/#files :alt: Python Versions

.. image:: https://img.shields.io/github/languages/code-size/microsoft/maro :target: https://github.com/microsoft/maro :alt: Code Size

.. image:: https://img.shields.io/docker/image-size/maro2020/maro :target: https://hub.docker.com/repository/docker/maro2020/maro/tags?page=1 :alt: Docker Size

.. image:: https://img.shields.io/github/issues/microsoft/maro :target: https://github.com/microsoft/maro/issues :alt: Issues

.. image:: https://img.shields.io/github/issues-pr/microsoft/maro :target: https://github.com/microsoft/maro/pulls :alt: Pull Requests

.. image:: https://img.shields.io/librariesio/github/microsoft/maro :target: https://libraries.io/pypi/pymaro :alt: Dependencies

.. image:: https://github.com/microsoft/maro/workflows/test/badge.svg :target: https://github.com/microsoft/maro/actions?query=workflow%3Atest :alt: test

.. image:: https://github.com/microsoft/maro/workflows/build/badge.svg :target: https://github.com/microsoft/maro/actions?query=workflow%3Abuild :alt: build

.. image:: https://github.com/microsoft/maro/workflows/docker/badge.svg :target: https://hub.docker.com/repository/docker/maro2020/maro :alt: docker

.. image:: https://readthedocs.org/projects/maro/badge/?version=latest :target: https://maro.readthedocs.io/ :alt: docs

.. image:: https://img.shields.io/pypi/v/pymaro :target: https://pypi.org/project/pymaro/#files :alt: PypI Versions

.. image:: https://img.shields.io/pypi/wheel/pymaro :target: https://pypi.org/project/pymaro/#files :alt: Wheel

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/citi_bike.svg :target: https://maro.readthedocs.io/en/latest/scenarios/citi_bike.html :alt: Citi Bike

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/cim.svg :target: https://maro.readthedocs.io/en/latest/scenarios/container_inventory_management.html :alt: CIM

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/vm_scheduling.svg :target: https://maro.readthedocs.io/en/latest/scenarios/vm_scheduling.html :alt: VM Scheduling

.. image:: https://img.shields.io/gitter/room/microsoft/maro :target: https://gitter.im/Microsoft/MARO# :alt: Gitter

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/stack_overflow.svg :target: https://stackoverflow.com/questions/ask?tags=maro :alt: Stack Overflow

.. image:: https://img.shields.io/github/release-date-pre/microsoft/maro :target: https://github.com/microsoft/maro/releases :alt: Releases

.. image:: https://img.shields.io/github/commits-since/microsoft/maro/latest/master :target: https://github.com/microsoft/maro/commits/master :alt: Commits

.. image:: https://github.com/microsoft/maro/workflows/vulnerability%20scan/badge.svg :target: https://github.com/microsoft/maro/actions?query=workflow%3A%22vulnerability+scan%22 :alt: Vulnerability Scan

.. image:: https://github.com/microsoft/maro/workflows/lint/badge.svg :target: https://github.com/microsoft/maro/actions?query=workflow%3Alint :alt: Lint

.. image:: https://img.shields.io/codecov/c/github/microsoft/maro :target: https://codecov.io/gh/microsoft/maro :alt: Coverage

.. image:: https://img.shields.io/pypi/dm/pymaro :target: https://pypi.org/project/pymaro/#files :alt: Downloads

.. image:: https://img.shields.io/docker/pulls/maro2020/maro :target: https://hub.docker.com/repository/docker/maro2020/maro :alt: Docker Pulls

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/play_with_maro.svg :target: https://hub.docker.com/r/maro2020/maro :alt: Play with MARO

.. image:: https://github.com/microsoft/maro/blob/master/docs/source/images/logo.svg :target: https://maro.readthedocs.io/en/latest/ :alt: MARO LOGO

================================================================================================================

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/vm_scheduling.svg :target: https://maro.readthedocs.io/en/latest/scenarios/vm_scheduling.html :alt: VM Scheduling

.. image:: https://img.shields.io/gitter/room/microsoft/maro :target: https://gitter.im/Microsoft/MARO# :alt: Gitter

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/stack_overflow.svg :target: https://stackoverflow.com/questions/ask?tags=maro :alt: Stack Overflow

.. image:: https://img.shields.io/github/release-date-pre/microsoft/maro :target: https://github.com/microsoft/maro/releases :alt: Releases

.. image:: https://img.shields.io/github/commits-since/microsoft/maro/latest/master :target: https://github.com/microsoft/maro/commits/master :alt: Commits

.. image:: https://github.com/microsoft/maro/workflows/vulnerability%20scan/badge.svg :target: https://github.com/microsoft/maro/actions?query=workflow%3A%22vulnerability+scan%22 :alt: Vulnerability Scan

.. image:: https://github.com/microsoft/maro/workflows/lint/badge.svg :target: https://github.com/microsoft/maro/actions?query=workflow%3Alint :alt: Lint

.. image:: https://img.shields.io/codecov/c/github/microsoft/maro :target: https://codecov.io/gh/microsoft/maro :alt: Coverage

.. image:: https://img.shields.io/pypi/dm/pymaro :target: https://pypi.org/project/pymaro/#files :alt: Downloads

.. image:: https://img.shields.io/docker/pulls/maro2020/maro :target: https://hub.docker.com/repository/docker/maro2020/maro :alt: Docker Pulls

.. image:: https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/play_with_maro.svg :target: https://hub.docker.com/r/maro2020/maro :alt: Play with MARO

.. image:: https://github.com/microsoft/maro/blob/master/docs/source/images/logo.svg :target: https://maro.readthedocs.io/en/latest/ :alt: MARO LOGO

================================================================================================================

Multi-Agent Resource Optimization (MARO) platform is an instance of Reinforcement learning as a Service (RaaS) for real-world resource optimization. It can be applied to many important industrial domains, such as container inventory management <https://maro.readthedocs.io/en/latest/scenarios/container_inventory_management.html>_ in logistics, bike repositioning <https://maro.readthedocs.io/en/latest/scenarios/citi_bike.html>_ in transportation, virtual machine <https://maro.readthedocs.io/en/latest/scenarios/vm_scheduling.html>_ provisioning in data centers, and asset management in finance. Besides Reinforcement Learning <https://www.andrew.cmu.edu/course/10-703/textbook/BartoSutton.pdf>_ (RL), it also supports other planning/decision mechanisms, such as Operations Research <https://en.wikipedia.org/wiki/Operations_research>_.

Key Components of MARO:

  • Simulation toolkit: it provides some predefined scenarios, and the reusable wheels for building new scenarios.
  • RL toolkit: it provides a full-stack abstraction for RL, such as agent manager, agent, RL algorithms, learner, actor, and various shapers.
  • Distributed toolkit: it provides distributed communication components, interface of user-defined functions for message auto-handling, cluster provision, and job orchestration.

.. image:: https://github.com/microsoft/maro/blob/master/docs/source/images/maro_overview.svg :target: https://github.com/microsoft/maro/blob/master/docs/source/images/maro_overview.svg :alt: MARO Key Components

Contents

.. list-table:: :header-rows: 1

    • File/folder
    • Description
    • maro
    • MARO source code.
    • docs
    • MARO docs, it is host on readthedocs <https://maro.readthedocs.io/en/latest/>_.
    • examples
    • Showcase of MARO.
    • notebooks
    • MARO quick-start notebooks.

Try MARO playground <#run-playground>_ to have a quick experience.

Install MARO from PyPI <https://pypi.org/project/pymaro/#files>_

Notes: The CLI commands (including the visualization tool) are not included in pymaro package. To enable these support, you need to install from source.

  • Mac OS / Linux

    .. code-block:: sh

    pip install pymaro

  • Windows

    .. code-block:: powershell

    Install torch first, if you don't have one.

    pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

    pip install pymaro

Install MARO from Source

Notes: Install from source if you want to use the CLI commands (including the visualization tool).

  • Prerequisites

    • C++ Compiler

      • Linux or Mac OS X: gcc
      • Windows: Build Tools for Visual Studio 2017 <https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15>_
  • Enable Virtual Environment

    • Mac OS / Linux

      .. code-block:: sh

      If your environment is not clean, create a virtual environment firstly.

      python -m venv maro_venv source ./maro_venv/bin/activate

    • Windows

      .. code-block:: powershell

      If your environment is not clean, create a virtual environment firstly.

      python -m venv maro_venv

      You may need this for SecurityError in PowerShell.

      Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

      Activate the virtual environment.

      .\maro_venv\Scripts\activate

  • Install MARO

    .. code-block:: sh

    Git Clone the whole source code.

    git clone https://github.com/microsoft/maro.git

    • Mac OS / Linux

      .. code-block:: sh

      Install MARO from source.

      bash scripts/install_maro.sh

    • Windows

      .. code-block:: powershell

      Install MARO from source.

      .\scripts\install_maro.bat

  • Notes: If your package is not found, remember to set your PYTHONPATH

    • Mac OS / Linux

    .. code-block:: sh

    export PYTHONPATH=PATH-TO-MARO

    • Windows

    .. code-block:: powershell

    $Env:PYTHONPATH=PATH-TO-MARO

Quick Example

.. code-block:: python

from maro.simulator import Env

env = Env(scenario="cim", topology="toy.5p_ssddd_l0.0", start_tick=0, durations=100)

metrics, decision_event, is_done = env.step(None)

while not is_done: metrics, decision_event, is_done = env.step(None)

print(f"environment metrics: {env.metrics}")

Environment Visualization <https://maro.readthedocs.io/en/latest/>_

.. code-block:: sh

Enable environment dump feature, when initializing the environment instance

env = Env(scenario="cim", topology="toy.5p_ssddd_l0.0", start_tick=0, durations=100, options={"enable-dump-snapshot": "./dump_data"})

Inspect environment with the dump data

maro inspector dashboard --source_path ./dump_data/YOUR_SNAPSHOT_DUMP_FOLDER

Show Cases ^^^^^^^^^^

Run Playground

  • Pull from Docker Hub <https://hub.docker.com/r/maro2020/playground>_

    .. code-block:: sh

    Pull the docker image from docker hub

    docker pull maro2020/playground

    Run playground container.

    Redis commander (GUI for redis) -> http://127.0.0.1:40009

    Jupyter lab with maro -> http://127.0.0.1:40010

    docker run -p 40009:40009 -p 40010:40010 maro2020/playground

  • Build from source

    • Mac OS / Linux

      .. code-block:: sh

      Build playground image.

      bash ./scripts/build_playground.sh

      Run playground container.

      Redis commander (GUI for redis) -> http://127.0.0.1:40009

      Jupyter lab with maro -> http://127.0.0.1:40010

      docker run -p 40009:40009 -p 40010:40010 maro2020/playground

    • Windows

      .. code-block:: powershell

      Build playground image.

      .\scripts\build_playground.bat

      Run playground container.

      Redis commander (GUI for redis) -> http://127.0.0.1:40009

      Jupyter lab with maro -> http://127.0.0.1:40010

      docker run -p 40009:40009 -p 40010:40010 maro2020/playground

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct <https://opensource.microsoft.com/codeofconduct/>. For more information see the Code of Conduct FAQ <https://opensource.microsoft.com/codeofconduct/faq/> or contact opencode@microsoft.com <mailto:opencode@microsoft.com>_ with any additional questions or comments.

Container Inventory Management <https://maro.readthedocs.io/en/latest/scenarios/container_inventory_management.html>_ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. image:: https://github.com/microsoft/maro/blob/master/docs/source/images/scenario/cim_vis.gif :target: https://github.com/microsoft/maro/blob/master/docs/source/images/scenario/cim_vis.gif :alt: CIM Vis

Wenlei Shi, Xinran Wei, Jia Zhang, Xiaoyuan Ni, Arthur Jiang, Jiang Bian, Tie-Yan Liu. "\ Cooperative Policy Learning with Pre-trained Heterogeneous Observation Representations <https://arxiv.org/abs/2012.13099>_\ ". AAMAS 2021

Xihan Li, Jia Zhang, Jiang Bian, Yunhai Tong, Tie-Yan Liu. "\ A Cooperative Multi-Agent Reinforcement Learning Framework for Resource Balancing in Complex Logistics Network <https://arxiv.org/abs/1903.00714>_\ ". AAMAS 2019

MSRA Top-10 Hack-Techs in 2021 <https://mp.weixin.qq.com/s/Y4kjQq8gKcsEsVadjdwnEQ>_

Open Source Platform MARO: Anywhere Door for Resource Optimization <https://mp.weixin.qq.com/s/zXIpgzomLhDWS_YUFmRlEQ>_

AI from "Point" to "Surface" <https://mp.weixin.qq.com/s/PggO49wwmS7grTO0nEMgVQ>_

Cite Us <https://github.com/microsoft/maro/blob/master/CITATION>_

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT <https://github.com/microsoft/maro/blob/master/LICENSE>_ License.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc