Skip to content

Commit 394d1d1

Browse files
updating references in GAMS code to EJOR manuscript equation numbers
1 parent 12baeb8 commit 394d1d1

2 files changed

Lines changed: 92 additions & 89 deletions

File tree

MOPBQE_power_market_example/MOPBQE_power_market_example.gms

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -342,24 +342,25 @@ Equations
342342
*** Objective functions ***
343343

344344
* standard objective - welfare maximization less dispatch and start-up/shut-down costs
345-
obj_simple.. # Equation 20 excluding compensation
345+
obj_simple.. # Equation 20a excluding compensation
346346
obj =e= sum((t,j,k), u_D(t,j,k) * d(t,j,k) )
347347
- sum((t,i,b), c_G(t,i,b) * g(t,i,b) )
348348
- sum((t,i), c_on(i) * z_on(t,i) + c_off(i) * z_off(t,i) ) ;
349349
;
350350

351351
* objective with compensation
352-
obj_binary_equilibrium.. # Equation 20
352+
obj_binary_equilibrium.. # Equation 20a
353353
obj =e= sum((t,j,k), u_D(t,j,k) * d(t,j,k) )
354354
- sum((t,i,b), c_G(t,i,b) * g(t,i,b) )
355355
- sum((t,i), c_on(i) * z_on(t,i) + c_off(i) * z_off(t,i) )
356356
- sum(i, zeta(i) )
357357
;
358358

359-
*** inter-temporal constraint of generator dispatch - start-up and shut-down ***
359+
*** market-clearing (energy balance) constraint ***
360360

361-
CON_ramp(t,i).. # Equation 21a
362-
x(t-1,i) + x_init(i)$( ORD(t) = 1 ) + z_on(t,i) - z_off(t,i) =E= x(t,i) ;
361+
MCC(t,n).. # Equation 20b
362+
sum((j,k)$( map_D(n,j) ), d(t,j,k) ) - sum((i,b)$( map_G(n,i) ), g(t,i,b) )
363+
+ sum(m, B_M(n,m) * delta(t,m) ) =E= 0 ;
363364

364365
*** stationarity (KKT) conditions for demand and the voltage angle ***
365366

@@ -378,68 +379,63 @@ KKT_delta(t,n).. # Equation 19b
378379
+ xi_up(t,n) - xi_lo(t,n)
379380
- gamma(t) * slack(n) =e= 0 ;
380381

381-
* set voltage angle to zero at slack node
382-
delta.fx(t,n)$slack(n) = 0 ; # Equation 19i
383-
384-
*** market-clearing (energy balance) constraint ***
385-
386-
MCC(t,n).. # Equation 19c
387-
sum((j,k)$( map_D(n,j) ), d(t,j,k) ) - sum((i,b)$( map_G(n,i) ), g(t,i,b) )
388-
+ sum(m, B_M(n,m) * delta(t,m) ) =E= 0 ;
389-
390382
*** maximum demand constraints ***
391-
CON_D_max(t,j,k).. # Equation 19d
383+
CON_D_max(t,j,k).. # Equation 19c
392384
d_max(t,j,k) - d(t,j,k) =G= 0 ;
393385

394-
CON_D_max_DC1(t,j,k).. # Equation 19d (complementarity part 1)
386+
CON_D_max_DC1(t,j,k).. # Equation 19c (complementarity part 1)
395387
d_max(t,j,k) - d(t,j,k) =L= r_D_max(t,j,k) * K_D_max ;
396388

397-
CON_D_max_DC2(t,j,k).. # Equation 19d (complementarity part 2)
389+
CON_D_max_DC2(t,j,k).. # Equation 19c (complementarity part 2)
398390
nu_max(t,j,k) =L= ( 1 - r_D_max(t,j,k) ) * K_D_max ;
399391

400392
*** power line capacity constraints ***
401393

402-
CON_F_pos(t,l).. # Equation 19e
394+
CON_F_pos(t,l).. # Equation 19d
403395
f_max(l) - sum(n, H_M(l,n) * delta(t,n) ) =G= 0 ;
404396

405-
CON_F_pos_DC1(t,l).. # Equation 19e (complementarity part 1)
397+
CON_F_pos_DC1(t,l).. # Equation 19d (complementarity part 1)
406398
f_max(l) - sum(n, H_M(l,n) * delta(t,n) ) =L= r_F_pos(t,l) * K_F_max ;
407399

408-
CON_F_pos_DC2(t,l).. # Equation 19e (complementarity part 2)
400+
CON_F_pos_DC2(t,l).. # Equation 19d (complementarity part 2)
409401
mu_pos(t,l) =L= ( 1 - r_F_pos(t,l) ) * K_F_max ;
410402

411-
CON_F_neg(t,l).. # Equation 19f
403+
CON_F_neg(t,l).. # Equation 19e
412404
f_max(l) + sum(n, H_M(l,n) * delta(t,n) ) =G= 0 ;
413405

414-
CON_F_neg_DC1(t,l).. # Equation 19f (complementarity part 1)
406+
CON_F_neg_DC1(t,l).. # Equation 19e (complementarity part 1)
415407
f_max(l) + sum(n, H_M(l,n) * delta(t,n) ) =L= r_F_neg(t,l) * K_F_max ;
416408

417-
CON_F_neg_DC2(t,l).. # Equation 19f (complementarity part 2)
409+
CON_F_neg_DC2(t,l).. # Equation 19e (complementarity part 2)
418410
mu_neg(t,l) =L= ( 1 - r_F_neg(t,l) ) * K_F_max ;
419411

420412
*** voltage angle band constraints ***
421413

422-
CON_delta_up(t,n)$( NOT slack(n) ).. # Equation 19g
414+
CON_delta_up(t,n)$( NOT slack(n) ).. # Equation 19f
423415
Pi - delta(t,n) =G= 0 ;
424416

425-
CON_delta_up_DC1(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 1)
417+
CON_delta_up_DC1(t,n)$( NOT slack(n) ).. # Equation 19f (complementarity part 1)
426418
Pi - delta(t,n) =L= r_delta_up(t,n) * K_delta ;
427419

428-
CON_delta_up_DC2(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 2)
420+
CON_delta_up_DC2(t,n)$( NOT slack(n) ).. # Equation 19f (complementarity part 2)
429421
xi_up(t,n) =L= ( 1 - r_delta_up(t,n) ) * K_delta ;
430422

431-
CON_delta_lo(t,n)$( NOT slack(n) ).. # Equation 19h
423+
CON_delta_lo(t,n)$( NOT slack(n) ).. # Equation 19g
432424
Pi + delta(t,n) =G= 0 ;
433425

434-
CON_delta_lo_DC1(t,n)$( NOT slack(n) ).. # Equation 19h (complementarity part 1)
426+
CON_delta_lo_DC1(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 1)
435427
Pi + delta(t,n) =L= r_delta_lo(t,n) * K_delta ;
436428

437-
CON_delta_lo_DC2(t,n)$( NOT slack(n) ).. # Equation 19h (complementarity part 2)
429+
CON_delta_lo_DC2(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 2)
438430
xi_lo(t,n) =L= ( 1 - r_delta_lo(t,n) ) * K_delta ;
439431

440432
xi_up.fx(t,n)$( slack(n) ) = 0 ;
441433
xi_lo.fx(t,n)$( slack(n) ) = 0 ;
442434

435+
*** voltage angle set to zero by definition at slack node ***
436+
437+
delta.fx(t,n)$slack(n) = 0 ; # Equation 19h
438+
443439
*** first-order KKT conditions for the generators ***
444440

445441
* standard formulation
@@ -512,9 +508,14 @@ CON_G_min_1_DC1(t,i).. # Equation 17c (complementarity part 1)
512508
CON_G_min_1_DC2(t,i).. # Equation 17c (complementarity part 2)
513509
alpha_1(t,i) =L= ( 1 - r_G_min(t,i) ) * K_G_min ;
514510

511+
*** inter-temporal constraint of generator dispatch - start-up and shut-down ***
512+
513+
CON_ramp(t,i).. # Equation 21a
514+
x(t-1,i) + x_init(i)$( ORD(t) = 1 ) + z_on(t,i) - z_off(t,i) =E= x(t,i) ;
515+
515516
*** incentive compatibility constraints for each player ***
516517

517-
INCENTIVE(t,i).. # Equation 21a
518+
INCENTIVE(t,i).. # Equation 21b
518519
* revenue if x_i = 1
519520
sum((b), beta_1(t,i,b) * g_max(t,i,b) ) - alpha_1(t,i) * g_min(t,i)
520521
* revenue if x_i = 0 in the short run => 0
@@ -523,6 +524,14 @@ INCENTIVE(t,i).. # Equation 21a
523524
+ kappa_0_plus(t,i) - kappa_0_minus(t,i)
524525
=E= 0 ;
525526

527+
INC_plus(t,i).. # Equation 21c
528+
kappa_1_plus(t,i) + kappa_1_minus(t,i)
529+
=L= x(t,i) * K_compensation ;
530+
531+
INC_minus(t,i).. # Equation 21d
532+
kappa_0_plus(t,i) + kappa_0_minus(t,i)
533+
=L= ( 1 - x(t,i) ) * K_compensation ;
534+
526535
INCENTIVE_COMP(i,phi)$game_theoretic.. # Equation 21e
527536
* actual profits less dispatch costs in (quasi-) equilibrium
528537
sum(t, kappa_1_plus(t,i) - kappa_1_minus(t,i) )
@@ -559,13 +568,6 @@ CON_COMP4ACT(i)$compensation4active.. # Equation 21e''
559568
* actually generate electricity at some point over the model horizon?
560569
* The parameter "compensation4active" can incorporate this regulation.
561570

562-
INC_plus(t,i).. # Equation 21c
563-
kappa_1_plus(t,i) + kappa_1_minus(t,i)
564-
=L= x(t,i) * K_compensation ;
565-
566-
INC_minus(t,i).. # Equation 21d
567-
kappa_0_plus(t,i) + kappa_0_minus(t,i)
568-
=L= ( 1 - x(t,i) ) * K_compensation ;
569571

570572
*** translating optimal strategy into equilibrium and decision seen by other players - for binary equilibrium ***
571573
TRANS_0_ge(t,i,b).. # Equation 21f (part 1)
@@ -613,7 +615,7 @@ Model disjunctive_constraints /
613615
CON_F_neg, CON_F_neg_DC1, CON_F_neg_DC2
614616
CON_delta_up, CON_delta_up_DC1, CON_delta_up_DC2
615617
CON_delta_lo, CON_delta_lo_DC1, CON_delta_lo_DC2
616-
KKT_G, KKT_G_DC1, KKT_G_DC2
618+
KKT_G, KKT_G_DC1, KKT_G_DC2
617619
CON_G_max, CON_G_max_DC1, CON_G_max_DC2
618620
CON_G_min, CON_G_min_DC1, CON_G_min_DC2
619621
/ ;
@@ -632,7 +634,7 @@ Model binary_equilibrium /
632634
CON_F_neg, CON_F_neg_DC1, CON_F_neg_DC2
633635
CON_delta_up, CON_delta_up_DC1, CON_delta_up_DC2
634636
CON_delta_lo, CON_delta_lo_DC1, CON_delta_lo_DC2
635-
KKT_G_1, KKT_G_1_DC1, KKT_G_1_DC2
637+
KKT_G_1, KKT_G_1_DC1, KKT_G_1_DC2
636638
CON_G_max_1, CON_G_max_1_DC1, CON_G_max_1_DC2
637639
CON_G_min_1, CON_G_min_1_DC1, CON_G_min_1_DC2
638640
INCENTIVE

MOPBQE_power_market_numerical_tests/MOPBQE_power_market_example_numerical_tests.gms

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,16 @@ Equations
328328
*** Objective functions ***
329329

330330
* standard objective - welfare maximization less dispatch and start-up/shut-down costs
331-
obj_simple.. # Equation 20 excluding compensation
331+
obj_simple.. # Equation 20a excluding compensation
332332
* this is also the objective function of the inner part of Problem 15
333333
obj =e= sum((t,n), u_D(t,n) * d(t,n) )
334334
- sum((t,i), c_NL(i) * x(t,i) )
335335
- sum((t,i,b), c_G(i,b) * g(t,i,b) )
336336
- sum((t,i), c_on(i) * z_on(t,i) + c_off(i) * z_off(t,i) ) ;
337337
;
338338

339-
* objective for generator profit (given nodal prices from welfare-maximzation problem)
340-
obj_binary_generator_profit..
339+
* objective for generator profit (given nodal prices from welfare-maximzation problem)
340+
obj_binary_generator_profit.. # Equation 16a
341341
* this is the objective function of the outer constraints of Problem 15
342342
obj =e= sum((t,n,i,b)$( map_G(n,i) ), price.l(t,n) * g(t,i,b) )
343343
- sum((t,i), c_NL(i) * x(t,i) )
@@ -346,27 +346,21 @@ obj_binary_generator_profit..
346346
;
347347

348348
* objective with compensation
349-
obj_binary_equilibrium.. # Equation 20
350-
* this is the objective function of the multi-objective problem subject to a binary quasi-equilibrium (Equation 14a/14')
349+
obj_binary_equilibrium.. # Equation 20a
350+
* this is the objective function of the multi-objective problem subject to a binary quasi-equilibrium
351351
obj =e= sum((t,n), u_D(t,n) * d(t,n) )
352352
- sum((t,i), c_NL(i) * x(t,i) )
353353
- sum((t,i,b), c_G(i,b) * g(t,i,b) )
354354
- sum((t,i), c_on(i) * z_on(t,i) + c_off(i) * z_off(t,i) )
355355
- sum(i, zeta(i) )
356356
;
357357

358-
*** inter-temporal constraint of generator dispatch - start-up and shut-down ***
359-
360-
CON_startshut(t,i).. # Equation 21a
361-
x(t-1,i) + x_init(i)$( ORD(t) = 1 ) + z_on(t,i) - z_off(t,i) =E= x(t,i) ;
362-
363-
CON_startshut_mup(t,i).. # additional constraint to Problem 16
364-
1 - z_on(t,i) =G= sum(tt$( ORD(tt) > ORD(t)
365-
AND ORD(tt) < ( ORD(t) + z_min_up(i) ) ) , z_off(tt,i) ) ;
358+
*** market-clearing (energy balance) constraint ***
366359

367-
CON_startshut_mdo(t,i).. # additional constraint to Problem 16
368-
1 - z_off(t,i) =G= sum(tt$( ORD(tt) > ORD(t)
369-
AND ORD(tt) < ( ORD(t) + z_min_down(i) ) ) , z_on(tt,i) ) ;
360+
MCC(t,n).. # Equation 20b
361+
d(t,n) - sum(w$( map_W(w,n) ), w_det(t,w) - w_curt(t,w) )
362+
- sum((i,b)$( map_G(n,i) ), g(t,i,b) )
363+
+ sum(m, B_M(n,m) * delta(t,m) ) =E= 0 ;
370364

371365
*** stationarity (KKT) conditions for demand and the voltage angle ***
372366

@@ -385,69 +379,63 @@ KKT_delta(t,n).. # Equation 19b
385379
+ xi_up(t,n) - xi_lo(t,n)
386380
- gamma(t) * slack(n) =e= 0 ;
387381

388-
* set voltage angle to zero at slack node
389-
delta.fx(t,n)$slack(n) = 0 ; # Equation 19i
390-
391-
*** market-clearing (energy balance) constraint ***
392-
393-
MCC(t,n).. # Equation 19c
394-
d(t,n) - sum(w$( map_W(w,n) ), w_det(t,w) - w_curt(t,w) )
395-
- sum((i,b)$( map_G(n,i) ), g(t,i,b) )
396-
+ sum(m, B_M(n,m) * delta(t,m) ) =E= 0 ;
397-
398382
*** maximum demand constraints ***
399-
CON_D_max(t,n).. # Equation 19d
383+
CON_D_max(t,n).. # Equation 19c
400384
d_max(t,n) - d(t,n) =G= 0 ;
401385

402-
CON_D_max_DC1(t,n).. # Equation 19d (complementarity part 1)
386+
CON_D_max_DC1(t,n).. # Equation 19c (complementarity part 1)
403387
d_max(t,n) - d(t,n) =L= r_D_max(t,n) * 1.1 * d_max(t,n) ;
404388

405-
CON_D_max_DC2(t,n).. # Equation 19d (complementarity part 2)
389+
CON_D_max_DC2(t,n).. # Equation 19c (complementarity part 2)
406390
nu_max(t,n) =L= ( 1 - r_D_max(t,n) ) * price_bound ;
407391

408392
*** power line capacity constraints ***
409393

410-
CON_F_pos(t,l).. # Equation 19e
394+
CON_F_pos(t,l).. # Equation 19d
411395
f_max(l) - sum(n, H_M(l,n) * delta(t,n) ) =G= 0 ;
412396

413-
CON_F_pos_DC1(t,l).. # Equation 19e (complementarity part 1)
397+
CON_F_pos_DC1(t,l).. # Equation 19d (complementarity part 1)
414398
f_max(l) - sum(n, H_M(l,n) * delta(t,n) ) =L= r_F_pos(t,l) * 2.1 * f_max(l) ;
415399

416-
CON_F_pos_DC2(t,l).. # Equation 19e (complementarity part 2)
400+
CON_F_pos_DC2(t,l).. # Equation 19d (complementarity part 2)
417401
mu_pos(t,l) =L= ( 1 - r_F_pos(t,l) ) * price_bound ;
418402

419-
CON_F_neg(t,l).. # Equation 19f
403+
CON_F_neg(t,l).. # Equation 19e
420404
f_max(l) + sum(n, H_M(l,n) * delta(t,n) ) =G= 0 ;
421405

422-
CON_F_neg_DC1(t,l).. # Equation 19f (complementarity part 1)
406+
CON_F_neg_DC1(t,l).. # Equation 19e (complementarity part 1)
423407
f_max(l) + sum(n, H_M(l,n) * delta(t,n) ) =L= r_F_neg(t,l) * 2.1 * f_max(l) ;
424408

425-
CON_F_neg_DC2(t,l).. # Equation 19f (complementarity part 2)
409+
CON_F_neg_DC2(t,l).. # Equation 19e (complementarity part 2)
426410
mu_neg(t,l) =L= ( 1 - r_F_neg(t,l) ) * price_bound ;
427411

428412
*** voltage angle band constraints ***
429413

430-
CON_delta_up(t,n)$( NOT slack(n) ).. # Equation 19g
414+
CON_delta_up(t,n)$( NOT slack(n) ).. # Equation 19f
431415
Pi - delta(t,n) =G= 0 ;
432416

433-
CON_delta_up_DC1(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 1)
417+
CON_delta_up_DC1(t,n)$( NOT slack(n) ).. # Equation 19f (complementarity part 1)
434418
Pi - delta(t,n) =L= r_delta_up(t,n) * 2.1 * Pi ;
435419

436-
CON_delta_up_DC2(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 2)
420+
CON_delta_up_DC2(t,n)$( NOT slack(n) ).. # Equation 19f (complementarity part 2)
437421
xi_up(t,n) =L= ( 1 - r_delta_up(t,n) ) * price_bound ;
438422

439-
CON_delta_lo(t,n)$( NOT slack(n) ).. # Equation 19h
423+
CON_delta_lo(t,n)$( NOT slack(n) ).. # Equation 19g
440424
Pi + delta(t,n) =G= 0 ;
441425

442-
CON_delta_lo_DC1(t,n)$( NOT slack(n) ).. # Equation 19h (complementarity part 1)
426+
CON_delta_lo_DC1(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 1)
443427
Pi + delta(t,n) =L= r_delta_lo(t,n) * 2.1 * Pi ;
444428

445-
CON_delta_lo_DC2(t,n)$( NOT slack(n) ).. # Equation 19h (complementarity part 2)
429+
CON_delta_lo_DC2(t,n)$( NOT slack(n) ).. # Equation 19g (complementarity part 2)
446430
xi_lo(t,n) =L= ( 1 - r_delta_lo(t,n) ) * price_bound ;
447431

448432
xi_up.fx(t,n)$( slack(n) ) = 0 ;
449433
xi_lo.fx(t,n)$( slack(n) ) = 0 ;
450434

435+
*** voltage angle set to zero by definition at slack node ***
436+
437+
delta.fx(t,n)$slack(n) = 0 ; # Equation 19h
438+
451439
*** first-order KKT conditions for the generators ***
452440

453441
* standard formulation
@@ -532,9 +520,22 @@ CON_G_min_1_DC2(t,i).. # Equation 17c (complementarity part 2)
532520
*CON_G_DC_redux2(t,i,b,bb)$( ORD(bb) < ORD(b) )..
533521
* r_G_max(t,i,bb) =L= r_G_max(t,i,b) ;
534522

523+
*** inter-temporal constraint of generator dispatch - start-up and shut-down ***
524+
525+
CON_startshut(t,i).. # Equation 21a
526+
x(t-1,i) + x_init(i)$( ORD(t) = 1 ) + z_on(t,i) - z_off(t,i) =E= x(t,i) ;
527+
528+
CON_startshut_mup(t,i).. # additional constraint to Problem 16
529+
1 - z_on(t,i) =G= sum(tt$( ORD(tt) > ORD(t)
530+
AND ORD(tt) < ( ORD(t) + z_min_up(i) ) ) , z_off(tt,i) ) ;
531+
532+
CON_startshut_mdo(t,i).. # additional constraint to Problem 16
533+
1 - z_off(t,i) =G= sum(tt$( ORD(tt) > ORD(t)
534+
AND ORD(tt) < ( ORD(t) + z_min_down(i) ) ) , z_on(tt,i) ) ;
535+
535536
*** incentive compatibility constraints for each player ***
536537

537-
INCENTIVE(t,i).. # Equation 21a
538+
INCENTIVE(t,i).. # Equation 21b
538539
* revenue if x_i = 1
539540
sum((b), beta_1(t,i,b) * g_max(i,b) ) - alpha_1(t,i) * g_min(i)
540541
* revenue if x_i = 0 in the short run => 0
@@ -543,6 +544,14 @@ INCENTIVE(t,i).. # Equation 21a
543544
+ kappa_0_plus(t,i) - kappa_0_minus(t,i)
544545
=E= 0 ;
545546

547+
INC_plus(t,i).. # Equation 21c
548+
kappa_1_plus(t,i) + kappa_1_minus(t,i)
549+
=L= x(t,i) * 1.1 * price_bound * sum(b, g_max(i,b) ) ;
550+
551+
INC_minus(t,i).. # Equation 21d
552+
kappa_0_plus(t,i) + kappa_0_minus(t,i)
553+
=L= ( 1 - x(t,i) ) * 1.1 * price_bound * sum(b, g_max(i,b) ) ;
554+
546555
INCENTIVE_COMP(i,z)$( map_Z_I(i,z,'available') ).. # Equation 21e
547556
* actual profits less no-load and dispatch costs in (quasi-) equilibrium
548557
sum(t, kappa_1_plus(t,i) - kappa_1_minus(t,i) )
@@ -563,14 +572,6 @@ INCENTIVE_COMP(i,z)$( map_Z_I(i,z,'available') ).. # Equation 21e
563572
- ( c_off(i) )$( x_init(i) = 1 AND map_Z_I(i,z,'t1') = 0 )
564573
;
565574

566-
INC_plus(t,i).. # Equation 21c
567-
kappa_1_plus(t,i) + kappa_1_minus(t,i)
568-
=L= x(t,i) * 1.1 * price_bound * sum(b, g_max(i,b) ) ;
569-
570-
INC_minus(t,i).. # Equation 21d
571-
kappa_0_plus(t,i) + kappa_0_minus(t,i)
572-
=L= ( 1 - x(t,i) ) * 1.1 * price_bound * sum(b, g_max(i,b) ) ;
573-
574575
*** translating optimal strategy into decision seen by other players - for binary equilibrium ***
575576
TRANS_0_ge(t,i,b).. # Equation 21f (part 1)
576577
g(t,i,b) =G= 0 ;

0 commit comments

Comments
 (0)