Skip to content

Commit

Permalink
change the default solver used in Citibike OnlineLP example, from GLP…
Browse files Browse the repository at this point in the history
…K to CBC
  • Loading branch information
Jinyu Wang authored and Jinyu Wang committed Sep 6, 2021
1 parent 18eb076 commit 0af3573
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions examples/citi_bike/online_lp/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Performance

## Solver Used

To get stable problem solution, the experiments are made with **GLPK solver**.
To use GLPK solver, you need to first install the GLPK package in your platform
accordingly. Then replace the *PULP_CBC_CMD* solver with GLPK in the code.

```python
from pulp import GLPK

class CitiBikeILP():

def _formulate_and_solve(...):
...
problem.solve(GLPK(msg=0))
```

## Configuration

Below are the final environment metrics of the onlineLP in different topologies.
For each experiment, we setup the environment and test for a duration of 1 week
with environment random seed 0, 128, 1024. Besides the parameter listed in the
Expand Down
4 changes: 2 additions & 2 deletions examples/citi_bike/online_lp/citi_bike_ilp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import List, Tuple

import numpy as np
from pulp import GLPK, LpInteger, LpMaximize, LpProblem, LpVariable, lpSum
from pulp import PULP_CBC_CMD, LpInteger, LpMaximize, LpProblem, LpVariable, lpSum

from maro.utils import DottableDict

Expand Down Expand Up @@ -176,7 +176,7 @@ def _formulate_and_solve(
self._init_variables(init_inventory=init_inventory)
self._add_constraints(problem=problem, demand=demand, supply=supply)
self._set_objective(problem=problem)
problem.solve(GLPK(msg=0))
problem.solve(PULP_CBC_CMD(msg=0))

# ============================= private end =============================

Expand Down

0 comments on commit 0af3573

Please sign in to comment.