Skip to content

cvxgrp/resalloc

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Resource allocation

This repo accompanies the paper Allocation of Fungible Resources via a Fast, Scalable Price Discovery Method.

To get started with the code, clone this repo, run

python setup.py install

in a virtual environment of your choice, and try out the notebooks, which reproduce the examples from the paper.

Example

The resalloc package exports one main class representing a resource allocation problem, called AllocationProblem. It also exports a number of utility functions.

Here is a code example showing how to set up and solve a simple problem.

import torch
from resalloc.fungible import AllocationProblem, utilites

n_jobs, n_resources = int(1e6), 4
throughput_matrix = torch.rand((n_jobs, n_resources))
resource_limits = torch.rand(n_resoures) * n_jobs + 1e3

problem = AllocationProblem(
  throughput_matrix=throughput_matrix,
  resource_limits=resource_limits,
  utility_function=utilities.Log()
)

problem.solve(verbose=True)

# X is the optimal allocation
print(problem.X)

# prices are the optimal prices
print(problem.prices)

For more details about the available utilities, and how to customize the solve method with optional arguments, please consult the source code.

About

Efficient allocation of fungible resources

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published