Linear programming: redistributing bikes at the end of the day

61 Views Asked by At

I'm not sure how I can approach this problem. I need to state the problem before asking my questions.

Problem. Suppose a city has many bike stations. You can rent a bike and turn it back at any station. In the morning, every station $i$ begins with $b_i$ bikes. At night, they close with $d_i$ bikes. If a station ends with $d_i > b_i$ it has too many bikes and it should send some bikes to another station. All stations should begin the next day with $b_i$ bikes. There's a cost $c_{ij}$ to take a single bike from station $i$ to $j$. Minimize the cost.

My mistake. I made the following mistake. I defined $X_{ij}$ as the number of bikes that station $i$ has to send to station $j$. I also defined a variable

$$E_i := \begin{cases} 1 & \text{if $b_i < d_i$}\\ 0 & \text{otherwise} \end{cases}$$

and then I considered the following particular case between station $i=1$ and station $j=2$:

$$C_{1,2} X_{1,2} E_1 + C_{2,1} X_{2,1} E_2$$

But this is non-linear, so I can't do that. Nevertheless this non-linear expression reflects the transfer of bikes from station $1$ to station $2$. My $E_i$ variable is coding an if-statement. If station $1$ has an excess of bikes, $E_1 = 1$ and so the cost of transferring bikes to station $2$ is accounted for. That means $E_2 = 0$ because station 2 is after all receiving bikes, so by multiplying by 0, I'm able to not count those bike transfers twice. But the non-linearity shattered my dreams.

I'm out of ideas. How is a problem like that approached?

1

There are 1 best solutions below

0
On

The $E_i$ variables do not seem necessary. If $X_{i,j}$'s are restricted to be non-negative, and if there are no negative cost cycles by moving bikes around, I suppose at least one of $X_{i,j}$ or $X_{j,i}$ will be $0$ in the optimal solution.

Taking your two-station example for instance, where the costs $C$ are positive: $C_{1,2}X_{1,2} + C_{2,1}X_{2,1}$. Assume that both $X$'s are positive, then it is possible to reduce the cost to

$$C_{1,2}(X_{1,2}-1) + C_{2,1}(X_{2,1}-1) = C_{1,2}X_{1,2} + C_{2,1}X_{2,1} - (C_{1,2}+C_{2,1})$$

So a solution with minimum cost will keep one of the $X$ zero, and break loops.


One proposed linear programming model:

The variables $X_{i,j}$ are defined for $i\ne j$, and $X_{i,j} \ge 0$.

For each station $i$, the bike inflow and outflow should meet the beginning and ending condition:

$$d_i - \sum _{j\ne i} X_{i,j} + \sum_{h\ne i} X_{h,i} = b_i$$

The objective is to minimise the cost $$\sum_i\sum_{j\ne i} C_{i,j} X_{i,j}$$(without your $E$ variables). Assuming the costs $C$ are positive, or at least the absence of negative-cost loops.