Originally posted by: bp325
Agreed with Alex on the solution, but I created a very similar problem (in which the piecewise curve shapes vary for each time period) and get a strange result that I can't explain...
I have:
dexpr float ElecCost[p in Period]
Eprice[p]*(piecewise(l in Line){
M[p][l] -> X[p][l]; 0
}(0,0)Gen[p]);
dexpr float TotCost = sum(p in Period) ElecCost[p];
which is fine, except that the values of ElecCost are different before being used in the summation and within the summation. The sum of the latter is ~80% greater than that of the former when they should be exactly the same!
Any thoughts on why this might be?
Also, sorry for hijacking the post, but the subject fits (this weirdness isn't happening with other single variable piecewise curves), so thought it would be good to have everything in one place.
|
Before sum
|
During sum
|
|
1057.239
|
1955.039
|
|
1040.217
|
1935.368
|
|
1004.65
|
1880.262
|
|
1010.951
|
1887.64
|
|
1014.145
|
1891.369
|
|
1116.377
|
2084.49
|
|
1144.415
|
2102.873
|
|
1218.703
|
2194.187
|
|
3674.012
|
6527.651
|
|
0
|
0
|
|
0
|
0
|
|
0
|
0
|
|
0
|
0
|
|
0
|
0
|
|
0
|
0
|
|
3995.685
|
6860.66
|
|
3442.392
|
5981.486
|
|
3373.986
|
5910.807
|
|
1441.588
|
2533.579
|
|
1276.087
|
2270.668
|
|
1236.949
|
2220.636
|
|
1221.636
|
2196.315
|
|
0
|
0
|
|
0
|
0
|
Best,
Bryn
#DecisionOptimization#OPLusingCPLEXOptimizer