Skip to main content

This is the python package implementing several algorithms and strategy-proof mechanisms introduced in the paper Multi-stage Facility Location Problem with Transient Agents

Project description

Multi-stage Facility Location Problem with Transient Agent (MSFL-TA)

The msfl_ta is a package implementing several optimal algorithms and strategy-proof mechanisms introduced in the paper Multi-stage Facility Location Problem with Transient Agent.

For more details about the algorithms, strategy-proof mechanisms, specifications on the concepts and terminologies in game theory community, you may later refer to the full paper to be published on AAAI 23 or the final year project report.

Installation

You can install the msflta from PyPI:

python -m pip install msflta

The package requires a Python 3.7 and above and a Numpy 1.21.5 and above.

Introduction

The package implements 6 different optimal algorithms and 4 different strategy-proof mechanisms as introduced in the paper.

Optimal Algorithms

  • sc_nfcfs module - sc_nfcfs(T, r, X) function: implements the optimal algorithm for the "No First Come First Serve Without Moving Cost Model" in terms of social cost objective
  • sc_wfcfs module - sc_wfcfs(T, r, X) function: implements the optimal algorithm for the "With First Come First Serve Without Moving Cost Model" in terms of social cost objective
  • mc_nfcfs module - mc_nfcfs(T, r, X) function: implements the optimal algorithm for the "No First Come First Serve Without Moving Cost Model" in terms of maximum cost objective
  • mc_wfcfs module - mc_wfcfs(T, r, X) function: implements the optimal algorithm for the "With First Come First Serve Without Moving Cost Model" in terms of maximum cost objective
  • sc_nfcfs_mov module - sc_nfcfs_mov(T, r, X) function: implements the optimal algorithm for the "No First Come First Serve With Moving Cost Model" in terms of social cost objective
  • sc_wfcfs_mov module - sc_wfcfs_mov(T, r, X) function: implements the optimal algorithm for the "With First Come First Serve With Moving Cost Model" in terms of social cost objective

Strategy-proof Mechanisms

  • mechanism_fc_nfcfs module - fc_nfcfs(T, r, X) function: implements the strategy-proof mechanism named Full-Coverage for the "Without First Come First Serve Without Moving Cost Model"

  • mechanism_fc_wfcfs module - fc_wfcfs(T, r, X) function: implements the strategy-proof mechanism named Full-Coverage for the "With First Come First Serve Without Moving Cost Model"

  • mechanism_gs_nfcfs module - gs_nfcfs(T, r, X) function: implements the strategy-proof mechanism named Full-Coverage for the "Without First Come First Serve With Moving Cost Model"

  • mechanism_gs_wfcfs module - gs_wfcfs(T, r, X) function: implements the strategy-proof mechanism named Full-Coverage for the "With First Come First Serve With Moving Cost Model"

How to Use

Input

  • $T \in \mathbb{N}$ (an integer in Python) is the total number of stages where agents can arrive

  • $r \in \mathbb{N}$ (an integer in Python) is the tolerance rate, indicating the number of stage(s) agents are willing to stay

  • $X$ is a nexted list in python, i.e., a list contains several sublists, where the $i^{th}$ sublist contains the location information for agents arriving at stage $i$ .

    ( Important Notice: All the sublist should be sorted in ascending order! )

$$ \begin{align*} X = [X_1, \ldots, X_{T}], \text{ where } X_{t} \in \mathbb{R}^{N_{t}} \text{ and } N_{t} \text{ is the total number of agents arriving at stage } t \end{align*} $$

For example,

$T = 2, r = 2, X = [[1, 3, 4, 5], [2, 4, 6]]$ is a valid input. In this case, there are in total $2$ stages agents can arrive, and the tolerace rate is $2$. The agents arrive at $1^{st}$ stage are located at $1, 3, 4, 5$ where those arrive at $2^{nd}$ stage are located at $2, 4, 6$

Output

The output of all the algorithm is an Instance of Class Sol.

  • $Sol.p$ is a $2d$ List, where $Sol.p[t][i] = k$ indicates the $i^{th}$ agent arriving at stage $t$ is served at stage $k$.
  • Sol.y is a $1d$ List, where $Sol.y[t] = loc$ indicates that the facility at stage $t$ is located at position $loc$.
  • $Sol.cost$ is the social cost which can be retrieved when the objective function is the social cost, i.e. the total connecting cost of agents (+ the moving cost of the facility).
  • $Sol.maxcost$ is the maximum cost which can be retrieved when the objective function is the maximum cost, i.e., the largest distance between an agent and the facility that serves him or her.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msflta-1.0.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

msflta-1.0.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file msflta-1.0.1.tar.gz.

File metadata

  • Download URL: msflta-1.0.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for msflta-1.0.1.tar.gz
Algorithm Hash digest
SHA256 dfcc54c8bcd923bf736d733d16deb8923a6c8a33362553f8e2cfabdc1f3af91d
MD5 e5e70510874ffac3f71378374378319b
BLAKE2b-256 33543a963a6c581d573f8ea8d5274f95de491eb4c5702e198ffd5ad6c305125f

See more details on using hashes here.

File details

Details for the file msflta-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: msflta-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for msflta-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01375c547e1ea6c96c904645cd33a4c9bd73622741c28422d43e817156af6b44
MD5 fb38fc830bb5ff8956fae4badda14a36
BLAKE2b-256 219b1b866bc923d20f76bfe0dd6e467bc054c230d0c3ae117aab17f4ea9d7391

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page