# GenOpt/EnergyPlus-Best Algorithm for peak load reduction (load-shift)

I am actually trying to develop an algorithm to shift the load demand during on-peak hours using GenOpt. I have had a quick trial testing the example file HookJeeves Algorithm, however I have some doubts in order to achieve my target.

I would like to start with something very simple such as:

$\min_{J} : C(t) dt$

Where,

$C(t) = [P_{HP} + P_{DHW} +...] * TimeOfUse (t) $

$C(t)$ : Cost function

$TimeOf Use(t)$ : on-peak hour tariff prices and off-peak hour tariff prices

$P_{HP}$: Power associated to a Heat Pump

$P_{DHW}$ : Power associated to the Domestic Hot Water

and,

18C <= Temperature indoor<= 21C

45C <= Temperature Domestic Hot Water<= 55C

Therefore, I am not too sure if HookJeeves is the best algorithm to use for this case, and if it is, how can I set the time of use parameter and constraint the temperatures.

I'm pretty sure your question isn't actually about which algorithm to use (we don't care here...) but how to define your own cost function.

@Julien. Yes indeed. Thanks again

Could you rephrase the question and the title. Like "GenOpt/EnergyPlus-How to write your own cost function" or something