Hi!

Can you help me in constructing interfaces between GAMS and MATLAB? I

have read the introduction http://www.cs.wisc.edu/math-prog/matlab.html

However it doesn’t fix my problem.

My challenge is:

- MATLAB to GAMS

I have data for an optimisation problem generated by MATLAB and I want

to solve it by using GAMS.

\ - GAMS to MATLAB

The solution will be used in MATLAB for further calculation.

The attached gams-file is only a small clear extract of the total

optimisation model. The GAMS-Input (MATLAB => GAMS) is:

p_load(t)

and

the output of GAMS (GAMS => MATLAB) is P(i,t) (actual power output

of plant i in time t)

Thanks a lot for your help.

Regards,

David

The given GAMS-model:

SETS

i unit /1 * 4/

t consideration period /1*2/

;

Parameter

price_fuel(i) fuel price for gas (EUR per kWh)/1 0.0001

2 0.002

3

0.0025

4

0.0015/

- p_load(t) is MATLAB output and not determined in GAMS like now.

p_load(t) /1 50

2 100/

p_min(i) /1 15

2 15

3 12

4 12/

p_max(i) /1 40

2 45

3 50

4 50/

VARIABLES

C_total total costs of the schedule

;

POSITIVE VARIABLES

P actual power output of plant i in time t

P_fuel fuel rating of plant i in time t

P1 required power of unit i in t

;

BINARY VARIABLES

gamma_on

;

$ontext

P.up(‘1’,t) = 40;

P.up(‘2’,t) = 45;

P.up(‘3’,t) = 50;

P.up(‘4’,t) = 50;

P.lo(‘1’,t) = 15;

P.lo(‘2’,t) = 15;

P.lo(‘3’,t) = 12;

P.lo(‘4’,t) = 12;

$offtext

EQUATIONS

fuel simple linear fuel function

cost_total cost function

load_cover load cover constraint

syst_unit_pos1 Sytem unit constraint: lower boundfor

operational range

syst_unit_pos2 Sytem unit constraint: upper boundfor

operational range

;

*Load in the system constraint

load_cover(t)…

p_load(t) =E= sum(i, P1(i,t))

;

*Fuel function

fuel(i,t)…

P_fuel(i,t) =E= (2.5891 * P1(i,t) + 43.031)

;

*Object function
cost_total…
C_total =E= sum(t, ( sum(i,
price_fuel(i)* P_fuel(i,t)) ))*0.25

;

*Sytem unit constraint: lower bound for operational range

syst_unit_pos1(i,t)…

P1(i,t) =G= gamma_on(i,t) * p_min(i)

;

*Sytem unit constraint: upper bound for operational range

syst_unit_pos2(i,t)…

P1(i,t) =L= gamma_on(i,t) * p_max(i)

;

model schedule /all/;

solve schedule using mip minimizing C_total;

execute_unload “C:\tmp\resultout.gdx”;

\