Difficulty in understanding the sample code on Bid Evaluation

Problems with modeling
Post Reply
Jubeyer
User
User
Posts: 41
Joined: 4 years ago

Difficulty in understanding the sample code on Bid Evaluation

Post by Jubeyer »

Hi,
I have been trying to understand the code for bid evaluation in :https://www.gams.com/latest/gamslib_ml/ ... idpwl.html
As per my understanding goes the x(v) is a variable that represents the quantity each vendor bids for whereas in equation defy(v) the corresponding cost has been calculated, but I don't get why defx(v) should be used to calculate x(v) which seems to be calculated through a piecewise linear function since x(v) looks like an exogenous variable and not an endogenous one.

One more thing is the use of BidPwl, BidPwl_Seg, BidPwl_x, BidPwl_y is very confusing, why does it have the suffix and sometimes it doesn't?

Thanks in advance.

Regards,
Jubeyer
User avatar
bussieck
Moderator
Moderator
Posts: 1038
Joined: 7 years ago

Re: Difficulty in understanding the sample code on Bid Evaluation

Post by bussieck »

I suggest that you look at the listing file. It expands what pwpfunc.inc does and that gives you the full picture if you want to understand what is going on. For example, BidPwl_x(v) is not a variable it is a macro for an expression:

Code: Select all

 180  $macro BidPwl_x(v) \
 181    sum(BidPwl_Seg(v,s), BidPwlBin(v,s)*BidPwl(v,s,'x') \
 182                      + BidPwlSeg(v,s)*sign(BidPwl(v,s,'l')))
I leave the other questions unanswered. I guess you will study the listing file and then things will hopefully be more clearer. pwlfunc.inc is a convenience wrapper. If you want to understand pwl linearizations and get the last out of your reformulation, do the reformulation yourself without the convenience wrapper.

-Michael
Jubeyer
User
User
Posts: 41
Joined: 4 years ago

Re: Difficulty in understanding the sample code on Bid Evaluation

Post by Jubeyer »

Hi,
Thanks a lot for your reply. I think that I have understood it to some extent. But I do have one additional question. If I want to consider the demand varying with the time so does the quantity and cost will be dependent on time. So, the 'req' will turn into 'req(t)' and so do the 'x(v) and y(v)' to 'x(v,t) and y(v,t)'. I am assuming that I don't need to change the BidPwl definition since it's just evaluating the corresponding cost for the time dependent quantity. Am I thinking correct or I also need to adopt the 't' in the BidPwl evaluation.

Regards,
Jubeyer
Post Reply