linear-programmingmodelingamplenergymathprog

How to solve out of domain error in mathprog?


H= 1..24; s.t. ElectBattery{h in H}: ES[h]-ES[h-1]-P2S[h]*Efi['ESt']+PGEN['ESt',h]==0;

error: ES[0] out of domain


Solution

  • One way:

    1. Make sure ES[h] is defined over 0..24 (instead of 1..24)
    2. Fix ES[0] to a known value by adding a constraint ES[0]=10 (say).

    If you want a steady-state solution, use:

    1. ES[0] = ES[24]

    Instead of this, you can also use an if-then-else construct like:

    ES[h] - (if h=1 then ES[24] else ES[h-1]) - ..