BYU-PRISM / GEKKO

GEKKO Python for Machine Learning and Dynamic Optimization
https://machinelearning.byu.edu
Other
573 stars 102 forks source link

APM max operator with intermediate `x` #92

Open APMonitor opened 3 years ago

APMonitor commented 3 years ago

There is a problem with the x value updating as an Intemediate with APM code:


Objects
f = max(2)
End Objects

Connections
f.x[1] = mem_ddr
f.x[2] = mem_hbm
f.y = mem_max
End Connections

Parameters
mem_ddr = 64 * 8
mem_hbm = 16
End Parameters

Variables
mem_max
End Variables

Intermediates
   x = mem_max
End Intermediates

This produces x=1 instead of x=512. When x is introduced as a variable with an equation, the result is correct.


Objects
f = max(2)
End Objects

Connections
mem_ddr = f.x[1]
mem_hbm = f.x[2]
mem_max = f.y
End Connections

Parameters
mem_ddr = 64 * 8
mem_hbm = 16
End Parameters

Variables
mem_max
x
End Variables

Equations
   x = mem_max
End Equations

Could this be something with how intermediates are reported in the solution?

loganbeal commented 3 years ago

Are you sure the issue is with intermediates and not connections?

APMonitor commented 3 years ago

Thanks - I'll look into that possibility as well. I process the Intermediates to make sure they are at current values as a final step before writing to the results.csv and results.json files.