leopoldcambier / FAST

FAST (Finally An SDDP Toolbox) is an SDDP toolbox for Matlab
https://web.stanford.edu/~lcambier/fast/
GNU General Public License v3.0
21 stars 6 forks source link

Can I have the max function in the objective function? #18

Open hssharadga opened 3 years ago

hssharadga commented 3 years ago

A) Can I have the max function in the objective function? Is the SDDP able to solve this kind of problem?

For example the objective function: obj = energy (1,t) 10 if t<H .........................................................................obj = energy (1,t) 10 + max (energy(1,1:t)) if t=H I am getting the following error: Error using max Invalid data type. First argument must be numeric or logical.

B) If my problem got solved How can I get the solution that would lead to the best objective function with the highest probability?

C) Why the lattice.randomPath() assumes for the first stage that the selected node is node 1. Let me explain it: in my problem, I assume that I have 3 stages and for each stage, I have 3 nodes. My question: Why this function take random nodes for stage 2 and stage 3 while it assumes the selected node for stage 1 is node number 1.

windows7lover commented 3 years ago

Hello,

Thank you for reaching us. I will try to answer your questions.

A) You can do a max function using linear constraint as follow. Instead of

energy (1,t) * 10 + max( energy(1,1:t) ),

you can create a new variable, says "y", and write

energy (1,t) * 10 + y s.t. y >= energy(1,1:t)

Since you are minimizing, y will always be tight to the maximum value of energy(1,1:t).

B) In such case, at stage t with realization xi, you take the corresponding node n(t, xi) and you solve the associated problem, given your previous decision at previous stages. This will give you the best solution. i,e,. the solution that minimizes (in expectation) your objective.

C) In that case, you can create one extra node at the beginning that does nothing. This will give you the possibility to simulate the fact that you start with 3 nodes at stage 1.

I hope those answers will help you, do not hesitate to contact us again if you want more details :-).

Best regards,

Damien

Le sam. 13 mars 2021 à 04:18, hssharadga @.***> a écrit :

A) Can I have the max function in the objective function? Is the SDDP able to solve this kind of problem?

For example the objective function: obj = energy (1,t) 10 if t<H obj = energy (1,t) 10 + max (energy(1,1:t)) if t=H I am getting the following error: Error using max Invalid data type. First argument must be numeric or logical.

B) If my problem got solved How can I get the solution that would lead to the best objective function with the highest probability?

C) Why the lattice.randomPath() assumes for the first stage that the selected node is node 1. Let me explain it: in my problem, I assume that I have 3 stages and for each stage, I have 3 nodes. My question: Why this function take random nodes for stage 2 and stage 3 while it assumes the selected node for stage 1 is node number 1.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/leopoldcambier/FAST/issues/18, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6XCZ6DCDPAWSRAYMKGXTLTDMNUBANCNFSM4ZDT5CBA .

-- Damien Scieur Homepage: https://damienscieur.com/

hssharadga commented 3 years ago

Thank you again @windows7lover

I have one question what if the realization is not one of the expected scenarios (node)? Can you provide me with a command that I should use for your comment B above?

Your help is appreciated!