syntax translation for constraints

瀏覽次數:28 次
跳到第一則未讀訊息

nik.r...@gmail.com

未讀,
2017年11月10日 中午12:07:332017/11/10
收件者:AMPL Modeling Language
Hey everyone,

currently I try to model a two-stage mixed-integer stochastic problem and I despair on translating two constraint equations in AMPL syntax.

I hope anyone has an idea, how to solve this tinny problems. As followed I present the necessary backround information about the variable that I want to model. I


#Parameter#

param T;                                    #Index of time periods, running from 1 to T
param J;                                    #Index of CPP production blocks, running from 1 to J
param P;                                    #Index of day-ahead market price scenarios, running from 1 to P

param suc_CPP;                                     #Start-up-costs of plant 1 (Euro)
param lambda_pt {1..P, 1..T};                #Electricity price in the day-ahead market in time period t and day-ahead market price scenario p (Euro/MW h)

param psi_r_down {1..T};                    #Down-regulation price ratio in time period t
param psi_r_up {1..T};                        #Up-regulation price ratio in time period t

#Variable#
var bm_wptdown {1..P, 1..T} >= 0;            #Power sold in the balancing market (MW)
var bm_wptup {1..P, 1..T} >= 0;                 #Power purchased in the balancing market (MW)
var C_wpt_CPP {1..P, 1..T}>= 0;               #Total cost of the CPP electricity production (Euro)
var G_wpt {1..P, 1..T+1}>= 0;                     #Power sold (if positive) or purchased (if negative) in the day-ahead market (MW)
var v_wp_CPP {1..P, 1..T} binary;             #Binary variable equal to 1 if the CPP is started up at the beginning of the time period, and 0 otherwise

maximize Profit {p in 1..P}: sum {t in 1..T} (lambda_pt[p,t] * (G_wpt[p,t] + bm_wptdown[p,t] * psi_r_down[t] - bm_wptup[p,t] * psi_r_up[t]) - C_wpt_CPP[p,t] - suc_CPP * v_wp_CPP[p,t]);

And now the two concerning constraints 1t and 1 u. I hope there are easily to understand, but I attached my attempt as well as the explanation for that contraint, given additionally to the model. So far, it's the only thing I have



Eq. (1t) are non-anticipativity constraints and reflect the fact that information on stochastic parameters cannot be anticipated.
In other words, these constraints are necessary to model the fact that only one bidding curve can be submitted to the day-ahead market for each hour,
irrespective of the WPP output.
Constraints (1u) ensure that the VPP bidding curve is monotonously nondecreasing. Op(t) denotes the order of price scenario p in each hour t.
The price scenarios are ordered in each hour from the lowest price value to the highest one.

My attempt was:

subject to 1t {t in 1..T}: G_wpt[t] = G_wpt[2,p,t] = .. = G_wpt[w,p,t];

subject to 1u {t in 1..T, p in 1..P, pp in 1..P: O_pt[p,t]+1 = O_pp[t]}: G_wpt[w,p,t] - G_wpt[w,pp,t] <= 0;

I would be very grateful for every hint.

Best regards,

Niklas

Auto Generated Inline Image 1

Robert Fourer

未讀,
2017年11月12日 晚上11:48:202017/11/12
收件者:am...@googlegroups.com

It seems that the first constraint should be something like

 

   subject to 1t {t in 1..T, p in 1..np, w in 1..nW-1}:

      G[w,p,t] = G[w+1,p,t];

 

However then you need to index G over 3 sets, and to do that you need to figure out what set the w index should run over; in my example, w is supposed to run over 1..nW where nW is some param, but I made that up.  The mathematical statement of (1t) is not very clear, and without a clear understanding of the mathematical statement it's impossible to make a correct AMPL statement.

 

The second constraint could be something like

 

   subject to 1u {t in 1..T, p1 in 1..P, p2 in 1..P: O[p1,t] + 1 = O[p2,t]}:

      G[w,p1,t] - G[w,p2,t] <= 0;

 

but you need to define O in your model.

 

Bob Fourer

am...@googlegroups.com

 

 

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of nik.r...@gmail.com
Sent: Friday, November 10, 2017 9:54 AM
To: AMPL Modeling Language
Subject: [AMPL 15075] syntax translation for constraints

 

Hey everyone,

currently I try to model a two-stage mixed-integer stochastic problem and I despair on translating two constraint equations in AMPL syntax.

I hope anyone has an idea, how to solve this tinny problems. As followed I present the necessary backround information about the variable that I want to model. I

. . .

image003.jpg

nik.r...@gmail.com

未讀,
2017年11月17日 下午3:25:362017/11/17
收件者:AMPL Modeling Language
Hey Bob,

I am very thankful for your quick response, but actually I am perplexed how to order O[p,t] from the lowest p to the highest p in every t.

I tried it in different manners with the command "ordered" unsuccesfully.

Best regards,

Niklas

Robert Fourer

未讀,
2017年11月20日 中午12:38:592017/11/20
收件者:am...@googlegroups.com
Members of the sets that contain p and t can be ordered; then the ordering of those sets can enable you to access the O[p,t] values in a desired order. To get more help, reply with the AMPL definition of param O and the definitions of the sets that O is indexed over; and also show an example of what you are trying to do with param O that requires the ordering.

Bob Fourer
am...@googlegroups.com

=======
回覆所有人
回覆作者
轉寄
0 則新訊息