I'm trying to solve a convex linear programming problem related to charging and discharging a battery. In general (for my problem), charging the battery at low power over a long period has the same objective function value as intermittently charging at high power over a short period, then doing nothing. For example, one solution might have constant charging at 100W for 5 hours, and another might have 500W charging in the first hour, then no charging for the next 4 hours. In both cases the total charging is 500W-hrs, so the objective function is the same.
I've used Matlab's linprog and lpsolve. linprog seems to prefer solutions similar to the former -- charging power is spread over a long period. lpsolve prefers the latter solution -- short periods of high power with mostly no charging in between. Ultimately I need to use lpsolve, but I would prefer the former solution. For various reasons, there's no way for me to program that preference into the problem formulation.
Any idea why the Matlab and lpsolve solutions are different? (All the algorithms in Matlab give the same result.) Any ideas how to force lpsolve to reach the "low and slow" solution? I'm wondering if there's some internal solver parameter I can set to change its behavior.
You might change the formulation so that high-power charging becomes slightly more costly. Thus if $x_i$ is the charging level during time interval $i$, replace $x_i$ by $y_i + z_i$ with an additional constraint, say $y_i \le 200$, and an additional cost term $0.01 z_i$.
More elegant would be to add quadratic terms, but that takes you out of the realm of linear programming into quadratic programming.