Package: fast-online-packing
Fast Online PackingAn implementation of Agrawal & Devanur's Online Stochastic Packing Algorithm, described in "Fast Algorithms for Online Stochastic Convex Programming".Explore the docs »About The ProjectThis is an implementation of theOnline Packingalgorithm presented by Agrawal  & Devanur on"Fast Algorithms for Online Stochastic Convex Programming"(Algorithm 6.1), published in SODA'15. This algorithm tries to solve the Online Packing problem in the random-order model.You can learn more about it in the docs.This project aims to provide a clear understanding of the algorithm, enlighten possible implementation dificulties and be used in fast prototyping scenarios. It was not designed for runtime performance nor for use in production environments.In addition, this library provides aPacking Problemmodule that describes and enforces the Online Packing problem. This module can be used independently to assist the development of other algorithms for this same problem.External Usage DependenciesPython-MIPGoogle ORToolsInstallationFirst, check that you have Python 3.9+:python3 --versionThen, you can install the library with the following command:pipinstallfast-online-packingUsagefromfast_online_packingimportinstance_generatorasgeneratorfromfast_online_packing.online_solverimportOnlineSolvern_instants=400cost_dim=5delta=0.3values,costs,cap,e=generator.generate_valid_instance(delta,n_instants,cost_dim,items_per_instant=3)# instantiate the solvers=OnlineSolver(cost_dim,n_instants,cap,e)forv,cinzip(values,costs):# ask the solver which item should we packchosen_idx=s.pack_one(v,c)ifchosen_idx==-1:print("No item chosen this round.")else:print("Algorithm picked item with index ",chosen_idx)item_value=v[chosen_idx]item_cost_vector=c[chosen_idx]For more examples, please refer to theDocumentationFurther Development / ContributingClone the repo somewhere inside your project:git clone https://github.com/dbeyda/fast-online-packingInstall development dependencies:pip install -r fast-online-learning/requirements.txtInstall the cloned repo using the--editableoption:pip install -e <path/to/fast-online-packing>Develop, develop, develop. When you're finished, make to update and run thetests, and update and generate newdocs.TestsTests were developed usingPyTest. There is one test for each module, all located under thetests/folder.To run all tests, use the following command:pytest .If you want to output the test log to a file, you can do:pytest . > testlog.txtGenerating New DocumentationDocumentation is provided in the HTML format and was generated withSphinx. API reference was generated automatically withautodocfromdocstrings. Documentation source files are found in thedocs_srcfolder, and generated HTML docs are in thedocs/folder. This arrangement facilitates deploying the docs to GitHub Pages.To generate new documentation:cd docs_src
make githubSphinx will read the.rstfiles indocs_src/to generate new HTML files in thedocs/folder.LicenseDistributed under the MIT License. SeeLICENSE.txtfor more information.ContactDavid Beyda -dbeyda@poli.ufrj.brProject Link:https://github.com/dbeyda/fast-online-packingDisclaimerThis package was implemented as the Final Programming Assignment of my Msc. in PUC-Rio. It was developed only by me. This project is an independent work. It isnotthe original / official implementation of Agrawal & Devanur's paper.