Any idea why the following objective function doesn't include the -5000 in its formulation?
prob += lp.lpSum([-5000 + price_today_d[i] * ticker_vars[i] for i in ticker_list]), 'Total Cost'
Result:
Total_Cost: 0.82 ticker_A + 27.55 ticker_B
+ 32.73 ticker_C + 30.14 ticker_D + 26.55 ticker_E
By default PuLP ignores constant values since they are not relevant for obtaining the optimal solution. You can always add it after solving.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.