Skip to content
Snippets Groups Projects
Commit ad1d39e7 authored by rhenry2's avatar rhenry2
Browse files

Fix for NaN price values.

parent 19c2545a
No related branches found
No related tags found
No related merge requests found
......@@ -95,7 +95,9 @@ public class GlobalPrice implements Serializable {
LogWriter.println(String.format(" initally imbalance ratio= %.4f", ratio));
}
else {
if (stockChange >= 0) // stock increasing, so decrease price. stockChange is positive so adjustment < 1
if (stockChange == 0 && production == 0)
adjustment=1;
else if (stockChange >= 0 && production != 0) // stock increasing, so decrease price. stockChange is positive so adjustment < 1
adjustment = 1 - ModelConfig.MARKET_LAMBA * stockChange/production;
else // stock decreasing, so increase price. stockChange is negative so adjustment > 1
adjustment = 1 - ModelConfig.MARKET_LAMBA * stockChange/Math.max(0, stockLevel);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment