Binary variable problem

Dear GAMS experts,

I coded the binary variable (Y(T)) in my model, and I think the binary variable must be 0 or 1. But in my model, I got the binary variable = 0.5 or other numbers.

I don’t know how to solve this problem. I attached my model here.

Can you help me?


Sincerely yours,

Redwood


SETS T TIME PERIODS /05/
TFIRST(T) FIRST PERIOD
TLAST(T) LAST PERIOD
N Regions /U, C/;
SCALARS
** constant
ep Exchange rate / 1.0 /
Gbar1 Limits of carbon emissions in country 1 / 4.88 /
r1 Interest rate in country 1 / 0.03 /
L1 Labor force in country 1 / 157.5 /
Gbar2 Limits of carbon emissions in country 2 / 3 /
r2 Interest rate in country 2 / 0.05 /
L2 Labor force in country 2 / 799.5 /
Pw World price of energy / 1 /
GHGs Target of greenhouse gas emissions / 2748.39 /
delta1 Discount rate / .02 /
gam1 Coefficient of utility 1 / -0.000000005964 /
eta11 Elasticity of MGS in country 1 / 0.1726 /
eta12 Elasticity of EQ in country 1 / 0.6868 /
ag1 Clean capital in country 1 / 1.675 /
alpha1 Target green house gas emissions / 1.032 /
rhoq1 Target green house gas emissions / 0.351 /
beta11 Elasticity of capital in county 1 / 0.228 /
beta12 Elasticity of labor force in country 1 / 0.472 /
beta13 Elasticity of energy in country 1 / 0.301 /
g11 Emissions coefficient in country 1 / 2.352 /
g12 Scale factor of emissions in country 1 / -0.1869 /
xi1 Target green house gas emissions / 0.8898 /
rhom1 Target green house gas emissions / 0.004 /
delta2 Discount rate / .04 /
gam2 Coefficient of utility 2 / -0.00000002672 /
eta21 Elasticity of MGS in country 2 / 0.5341 /
eta22 Elasticity of EQ in country 2 / 0.2305 /
ag2 Clean capital in country 2 / -1.239 /
alpha2 Target green house gas emissions / 0.786628 /
rhoq2 Target green house gas emissions / 0.044 /
beta21 Elasticity of capital in country 2 / 0.269 /
beta22 Elasticity of labor force in country 2 / 0.324 /
beta23 Elasticity of energy in country 2 / 0.407 /
g21 Emissions coefficient in country 2 / 0.5398 /
g22 Scale factor of emissions in country 2 / 0.015 /
xi2 Target green house gas emissions / 1.05 /
rhom2 Target green house gas emissions / 0.0453 /
d Greenhouse gas emissions discout facot / .005 /
psi1 Elasticity of offsets price / .001 /
Ku0 Initial dirty capital stock in country 1 / 43007 /
Kc0 Initial dirty capital stock in country 2 / 16113 /
Kgu0 Initial clean capital stock in country 1 / 43.007 /
Kgc0 Initial clean capital stock in country 2 / 16.113 /
Pg0 Initial price of offset / 0.005 /
GHG0 Initial greenhouse gas emissions / 3026.09 /
Cu0 Initial consumtion in country 1 / 12.8 /
Cc0 Initial consumtion in country 2 /2.84/
Igu0 Initial clean investment in country 1 /0.062460245/
Igc0 Initial clean investment in country 2 /0.081370566/
Eu0 Energy consumption in country 1 /2.22/
Ec0 Energy consumption in country 2 /2.42/
Qu0 /14.4/
Qc0 /5.93/
mu1 /0.8562/
mu2 /0.4911/
MGSu0 Initial consumtion in country 1 /2.66/
MGSc0 Initial consumtion in country 2 /1.58/;
PARAMETERS ZU(T) DISCOUNT FACTOR
ZC(T) DISCOUNT FACTOR
FU(T)
FC(T);
TFIRST(T) = YES$(ORD(T) EQ 1);
TLAST(T) = YES$(ORD(T) EQ CARD(T));
ZU(T) = EXP(rhoq1
(ORD(T)-1));
ZC(T) = EXP(rhoq2
(ORD(T)-1));
FU(T) = EXP(-rhom1
(ORD(T)-1));
FC(T) = EXP(-rhom2*(ORD(T)-1));
Parameter BigM/15000/;
VARIABLES

  • Control variables
    *C(T,N) Consumption
    MGS(T,N) Imports
    Ig(T,N) Clean investment
    E(T,N) Energy

  • State variables
    K(T,N) Dirty capital stocks
    Kg(T,N) Clean capital stocks
    Pg(T) Price of offsets
    GHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere

  • Other variables
    Op(T) Offsets
    Q(T,N) GDP(Output)
    Dummy(T)
    Utility1
    Utility2
    M(T,N)
    ;
    Binary Variable
    Y(T);
    EQUATIONS
    MMu(T,N)
    MMc(T,N)
    QQu(T,N) Output in country 1
    QQc(T,N) Output in country 2
    OOp1(T) Offsets 1
    OOp2(T) Offsets 2
    OOp3(T) Offsets 3
    OOp4(T) Offsets 4
    *OOp5(T)
    *OOp6(T)
    Ku(T,N) Dirty capital stocks in country 1
    TKu(T,N) Termial condition for dirty capital stocks in country 1
    Kc(T,N) Dirty capital stocks in country 2
    TKc(T,N) Termial condition for dirty capital stocks in country 2
    KKg(T,N) Clean capital stocks
    TKg(T,N) Terminal condition for clean capital stocks
    PPg(T) Price of offsets
    TPg(T) Terminal condition for price of offsets
    GGHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere
    TGHG(T) Terminal condition for the concentration of CO2
    UTIL1 Discounted utility 1 : OBJECTIVE FUNCTION
    UTIL2 Discounted utility 2 : OBJECTIVE FUNCTION;

MMu(T,N)… M(T,“U”) =e= (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))xi1)E(T, “U”);
MMc(T,N)… M(T,“C”) =e= (g21
FC(T)-g22
(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))xi2)E(T, “C”);
QQu(T,N)… Q(T,“U”) =e= ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)
(L1
beta12)(E(T, “U”)**beta13);
QQc(T,N)… Q(T,“C”) =e= ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)
(L2
beta22)*(E(T, “C”)beta23);
OOp1(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) + BigM
(1-Y(T)) =g= 0;
OOp2(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) - BigM
(Y(T)) =l= 0;
OOp3(T)… Op(T) + (1-Y(T))*Dummy(T) =e= M(T,“U”) - Gbar1;
OOp4(T)… Op(T) + Y(T)*Dummy(T) =e= Gbar2 - M(T,“C”);
OOp5(T)… Dummy1(T)-BigM(1-Y(T)) =l= 0;
OOp6(T)… Dummy2(T)-BigM(Y(T)) =l= 0;
Ku(T+1,N)… K(T+1, “U”) =e= (1-mu1)ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1
*beta12)*(E(T, “U”)**beta13)

  • MGS(T,“U”)ep - Ig(T, “U”)(1+ag1Ig(T, “U”)/(2Kg(T, “U”)))
  • Pg(T)Op(T)+ K(T, “U”);
    TKu(TLAST,N)… 0 =l= (1-mu1)ZU(TLAST)alpha1((K(TLAST, “U”)+ Kg(TLAST, “U”))**beta11)(L1**beta12)
    (E(TLAST, “U”)**beta13)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “U”)(1+ag1Ig(TLAST, “U”)/(2Kg(TLAST, “U”)))
  • Pg(TLAST)Op(TLAST)+ K(TLAST, “U”);
    Kc(T+1,N)… K(T+1, “C”) =e= (1-mu2)ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2**beta22)
    (E(T, “C”)**beta23)
  • MGS(T,“C”)/ep - Ig(T, “C”)(1+ag2Ig(T, “C”)/(2*Kg(T, “C”)))
  • Pg(T)Op(T)/ep + K(T, “C”);
    TKc(TLAST,N)… 0 =l= (1-mu2)ZC(TLAST)alpha2((K(TLAST, “C”)+ Kg(TLAST, “C”))**beta21)(L2**beta22)
    (E(TLAST, “C”)**beta23)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “C”)(1+ag2Ig(TLAST, “C”)/(2Kg(TLAST, “C”)))
  • Pg(TLAST)Op(TLAST)/ep + K(TLAST, “C”);
    KKg(T+1,N)… Kg(T+1,N) =e= Ig(T,N)+ Kg(T,N);
    TKg(TLAST,N)… 0 =l= Ig(TLAST,N) + Kg(TLAST,N);
    PPg(T+1)… Pg(T+1) =e= psi1
    Pg(T)
    ((g11FU(T)- g12*(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)beta13Q(T,“U”)/(Pw+Pg(T)*Op(T)/E(T, “U”))
  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))*xi2)beta23Q(T,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1Gbar2) + Pg(T);
    TPg(TLAST)… 0 =l= psi1
    Pg(TLAST)
    ((g11FU(TLAST)-g12
    (Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)beta13Q(TLAST,“U”)/(Pw+Pg(TLAST)*Op(TLAST)/E(TLAST, “U”))
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)beta23Q(TLAST,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1Gbar2) + Pg(TLAST);
    GGHG(T+1)… GHG(T+1) =e= - d
    GHG(T)
  • (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)*E(T, “U”)
  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))**xi2)*E(T, “C”)
  • GHG(T);
    TGHG(TLAST)… 0 =l= - d*GHG(TLAST)
  • (g11FU(TLAST)-g12(Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)*E(TLAST, “U”)
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)*E(TLAST, “C”)
  • GHG(TLAST);
    UTIL1… UTILITY1 =e= SUM(T, EXP(delta1*(ORD(T)-1))(1/gam1)(mu1ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1beta12)(E(T, “U”)**beta13)
    MGS(T, “U”)*eta11(GHGs/GHG(T))**eta12)*gam1);
    UTIL2… UTILITY2 =e= SUM(T, EXP(delta2
    (ORD(T)-1))
    (1/gam2)
    (mu2ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2
    beta22)*(E(T, “C”)**beta23)
    *MGS(T, “C”)*eta21(GHGs/GHG(T))**eta22)**gam2);

Parameters
K7
Kg7
*C7
MGS7
Ig7
GHG7
Pg7
Op7
M7
Me7
;
MODEL Nash /all/;
*############################ Lower and upper #############################

K.LO(T,N) = 10000;
Kg.LO(T,N) = 1;
Pg.LO(T) = 0.0001; Pg.up(T) = 10000;
GHG.lo(T) = 2000; GHG.up(T) = 3500;
*C.LO(T,N)= 0.01;C.UP(T,N) = 150;
MGS.LO(T,N)= 0.01;MGS.UP(T,N) = 150;
Ig.LO(T,N)= 0.01;Ig.UP(T,N) = 100;
E.LO(T,N)= 0.01;E.UP(T,N) = 20;
Op.lO(T) = 0; Op.up(T) = 10;

K.fx(TFIRST, “U”) = Ku0;
K.fx(TFIRST, “C”) = Kc0;
Kg.fx(TFIRST, “U”) = Kgu0;
Kg.fx(TFIRST, “C”) = Kgc0;
Pg.fx(TFIRST) = Pg0;
GHG.fx(TFIRST) = GHG0;
*C.fx(TFIRST, “U”) = Cu0;
*C.fx(TFIRST, “C”) = Cc0;
MGS.fx(TFIRST, “U”) = MGSu0;
MGS.fx(TFIRST, “C”) = MGSc0;
Ig.fx(TFIRST, “U”) = Igu0;
Ig.fx(TFIRST, “C”) = Igc0;
E.fx(TFIRST, “U”) = Eu0;
E.fx(TFIRST, “C”) = Ec0;
*Dummy1.lo(T) = 0;
*Dummy2.lo(T) = 0;
SOLVE Nash MAXIMIZING UTILITY1 USING RMINLP;
SOLVE Nash MAXIMIZING UTILITY2 USING RMINLP;
DISPLAY K.L, Kg.L, Q.L, MGS.L, Ig.L, E.L, Pg.L, Op.L, M.L, GHG.L, Y.L;


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Dear Redwood,

You are solving a relaxed version of a MINLP when use RMINLP for the model type in the solve statement. In this case, the binary variables work as continuous variables.

Regards,
Luiz Carlos.

On Thu, Mar 28, 2013 at 11:32 PM, Redwood wrote:

Dear GAMS experts,

I coded the binary variable (Y(T)) in my model, and I think the binary variable must be 0 or 1. But in my model, I got the binary variable = 0.5 or other numbers.

I don’t know how to solve this problem. I attached my model here.

Can you help me?


Sincerely yours,

Redwood


SETS T TIME PERIODS /05/
TFIRST(T) FIRST PERIOD
TLAST(T) LAST PERIOD
N Regions /U, C/;
SCALARS
** constant
ep Exchange rate / 1.0 /
Gbar1 Limits of carbon emissions in country 1 / 4.88 /
r1 Interest rate in country 1 / 0.03 /
L1 Labor force in country 1 / 157.5 /
Gbar2 Limits of carbon emissions in country 2 / 3 /
r2 Interest rate in country 2 / 0.05 /
L2 Labor force in country 2 / 799.5 /
Pw World price of energy / 1 /
GHGs Target of greenhouse gas emissions / 2748.39 /
delta1 Discount rate / .02 /
gam1 Coefficient of utility 1 / -0.000000005964 /
eta11 Elasticity of MGS in country 1 / 0.1726 /
eta12 Elasticity of EQ in country 1 / 0.6868 /
ag1 Clean capital in country 1 / 1.675 /
alpha1 Target green house gas emissions / 1.032 /
rhoq1 Target green house gas emissions / 0.351 /
beta11 Elasticity of capital in county 1 / 0.228 /
beta12 Elasticity of labor force in country 1 / 0.472 /
beta13 Elasticity of energy in country 1 / 0.301 /
g11 Emissions coefficient in country 1 / 2.352 /
g12 Scale factor of emissions in country 1 / -0.1869 /
xi1 Target green house gas emissions / 0.8898 /
rhom1 Target green house gas emissions / 0.004 /
delta2 Discount rate / .04 /
gam2 Coefficient of utility 2 / -0.00000002672 /
eta21 Elasticity of MGS in country 2 / 0.5341 /
eta22 Elasticity of EQ in country 2 / 0.2305 /
ag2 Clean capital in country 2 / -1.239 /
alpha2 Target green house gas emissions / 0.786628 /
rhoq2 Target green house gas emissions / 0.044 /
beta21 Elasticity of capital in country 2 / 0.269 /
beta22 Elasticity of labor force in country 2 / 0.324 /
beta23 Elasticity of energy in country 2 / 0.407 /
g21 Emissions coefficient in country 2 / 0.5398 /
g22 Scale factor of emissions in country 2 / 0.015 /
xi2 Target green house gas emissions / 1.05 /
rhom2 Target green house gas emissions / 0.0453 /
d Greenhouse gas emissions discout facot / .005 /
psi1 Elasticity of offsets price / .001 /
Ku0 Initial dirty capital stock in country 1 / 43007 /
Kc0 Initial dirty capital stock in country 2 / 16113 /
Kgu0 Initial clean capital stock in country 1 / 43.007 /
Kgc0 Initial clean capital stock in country 2 / 16.113 /
Pg0 Initial price of offset / 0.005 /
GHG0 Initial greenhouse gas emissions / 3026.09 /
Cu0 Initial consumtion in country 1 / 12.8 /
Cc0 Initial consumtion in country 2 /2.84/
Igu0 Initial clean investment in country 1 /0.062460245/
Igc0 Initial clean investment in country 2 /0.081370566/
Eu0 Energy consumption in country 1 /2.22/
Ec0 Energy consumption in country 2 /2.42/
Qu0 /14.4/
Qc0 /5.93/
mu1 /0.8562/
mu2 /0.4911/
MGSu0 Initial consumtion in country 1 /2.66/
MGSc0 Initial consumtion in country 2 /1.58/;
PARAMETERS ZU(T) DISCOUNT FACTOR
ZC(T) DISCOUNT FACTOR
FU(T)
FC(T);
TFIRST(T) = YES$(ORD(T) EQ 1);
TLAST(T) = YES$(ORD(T) EQ CARD(T));
ZU(T) = EXP(rhoq1
(ORD(T)-1));
ZC(T) = EXP(rhoq2
(ORD(T)-1));
FU(T) = EXP(-rhom1
(ORD(T)-1));
FC(T) = EXP(-rhom2*(ORD(T)-1));
Parameter BigM/15000/;
VARIABLES

  • Control variables
    *C(T,N) Consumption
    MGS(T,N) Imports
    Ig(T,N) Clean investment
    E(T,N) Energy

  • State variables
    K(T,N) Dirty capital stocks
    Kg(T,N) Clean capital stocks
    Pg(T) Price of offsets
    GHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere

  • Other variables
    Op(T) Offsets
    Q(T,N) GDP(Output)
    Dummy(T)
    Utility1
    Utility2
    M(T,N)
    ;
    Binary Variable
    Y(T);
    EQUATIONS
    MMu(T,N)
    MMc(T,N)
    QQu(T,N) Output in country 1
    QQc(T,N) Output in country 2
    OOp1(T) Offsets 1
    OOp2(T) Offsets 2
    OOp3(T) Offsets 3
    OOp4(T) Offsets 4
    *OOp5(T)
    *OOp6(T)
    Ku(T,N) Dirty capital stocks in country 1
    TKu(T,N) Termial condition for dirty capital stocks in country 1
    Kc(T,N) Dirty capital stocks in country 2
    TKc(T,N) Termial condition for dirty capital stocks in country 2
    KKg(T,N) Clean capital stocks
    TKg(T,N) Terminal condition for clean capital stocks
    PPg(T) Price of offsets
    TPg(T) Terminal condition for price of offsets
    GGHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere
    TGHG(T) Terminal condition for the concentration of CO2
    UTIL1 Discounted utility 1 : OBJECTIVE FUNCTION
    UTIL2 Discounted utility 2 : OBJECTIVE FUNCTION;

MMu(T,N)… M(T,“U”) =e= (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))xi1)E(T, “U”);
MMc(T,N)… M(T,“C”) =e= (g21
FC(T)-g22
(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))xi2)E(T, “C”);
QQu(T,N)… Q(T,“U”) =e= ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)
(L1
beta12)(E(T, “U”)**beta13);
QQc(T,N)… Q(T,“C”) =e= ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)
(L2
beta22)*(E(T, “C”)beta23);
OOp1(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) + BigM
(1-Y(T)) =g= 0;
OOp2(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) - BigM
(Y(T)) =l= 0;
OOp3(T)… Op(T) + (1-Y(T))*Dummy(T) =e= M(T,“U”) - Gbar1;
OOp4(T)… Op(T) + Y(T)*Dummy(T) =e= Gbar2 - M(T,“C”);
OOp5(T)… Dummy1(T)-BigM(1-Y(T)) =l= 0;
OOp6(T)… Dummy2(T)-BigM(Y(T)) =l= 0;
Ku(T+1,N)… K(T+1, “U”) =e= (1-mu1)ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1
*beta12)*(E(T, “U”)**beta13)

  • MGS(T,“U”)ep - Ig(T, “U”)(1+ag1Ig(T, “U”)/(2Kg(T, “U”)))
  • Pg(T)Op(T)+ K(T, “U”);
    TKu(TLAST,N)… 0 =l= (1-mu1)ZU(TLAST)alpha1((K(TLAST, “U”)+ Kg(TLAST, “U”))**beta11)(L1**beta12)
    (E(TLAST, “U”)**beta13)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “U”)(1+ag1Ig(TLAST, “U”)/(2Kg(TLAST, “U”)))
  • Pg(TLAST)Op(TLAST)+ K(TLAST, “U”);
    Kc(T+1,N)… K(T+1, “C”) =e= (1-mu2)ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2**beta22)
    (E(T, “C”)**beta23)
  • MGS(T,“C”)/ep - Ig(T, “C”)(1+ag2Ig(T, “C”)/(2*Kg(T, “C”)))
  • Pg(T)Op(T)/ep + K(T, “C”);
    TKc(TLAST,N)… 0 =l= (1-mu2)ZC(TLAST)alpha2((K(TLAST, “C”)+ Kg(TLAST, “C”))**beta21)(L2**beta22)
    (E(TLAST, “C”)**beta23)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “C”)(1+ag2Ig(TLAST, “C”)/(2Kg(TLAST, “C”)))
  • Pg(TLAST)Op(TLAST)/ep + K(TLAST, “C”);
    KKg(T+1,N)… Kg(T+1,N) =e= Ig(T,N)+ Kg(T,N);
    TKg(TLAST,N)… 0 =l= Ig(TLAST,N) + Kg(TLAST,N);
    PPg(T+1)… Pg(T+1) =e= psi1
    Pg(T)
    ((g11FU(T)- g12*(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)beta13Q(T,“U”)/(Pw+Pg(T)*Op(T)/E(T, “U”))
  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))*xi2)beta23Q(T,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1Gbar2) + Pg(T);
    TPg(TLAST)… 0 =l= psi1
    Pg(TLAST)
    ((g11FU(TLAST)-g12
    (Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)beta13Q(TLAST,“U”)/(Pw+Pg(TLAST)*Op(TLAST)/E(TLAST, “U”))
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)beta23Q(TLAST,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1Gbar2) + Pg(TLAST);
    GGHG(T+1)… GHG(T+1) =e= - d
    GHG(T)
  • (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)*E(T, “U”)
  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))**xi2)*E(T, “C”)
  • GHG(T);
    TGHG(TLAST)… 0 =l= - d*GHG(TLAST)
  • (g11FU(TLAST)-g12(Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)*E(TLAST, “U”)
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)*E(TLAST, “C”)
  • GHG(TLAST);
    UTIL1… UTILITY1 =e= SUM(T, EXP(delta1*(ORD(T)-1))(1/gam1)(mu1ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1beta12)(E(T, “U”)**beta13)
    MGS(T, “U”)*eta11(GHGs/GHG(T))**eta12)*gam1);
    UTIL2… UTILITY2 =e= SUM(T, EXP(delta2
    (ORD(T)-1))
    (1/gam2)
    (mu2ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2
    beta22)*(E(T, “C”)**beta23)
    *MGS(T, “C”)*eta21(GHGs/GHG(T))**eta22)**gam2);

Parameters
K7
Kg7
*C7
MGS7
Ig7
GHG7
Pg7
Op7
M7
Me7
;
MODEL Nash /all/;
*############################ Lower and upper #############################

K.LO(T,N) = 10000;
Kg.LO(T,N) = 1;
Pg.LO(T) = 0.0001; Pg.up(T) = 10000;
GHG.lo(T) = 2000; GHG.up(T) = 3500;
*C.LO(T,N)= 0.01;C.UP(T,N) = 150;
MGS.LO(T,N)= 0.01;MGS.UP(T,N) = 150;
Ig.LO(T,N)= 0.01;Ig.UP(T,N) = 100;
E.LO(T,N)= 0.01;E.UP(T,N) = 20;
Op.lO(T) = 0; Op.up(T) = 10;

K.fx(TFIRST, “U”) = Ku0;
K.fx(TFIRST, “C”) = Kc0;
Kg.fx(TFIRST, “U”) = Kgu0;
Kg.fx(TFIRST, “C”) = Kgc0;
Pg.fx(TFIRST) = Pg0;
GHG.fx(TFIRST) = GHG0;
*C.fx(TFIRST, “U”) = Cu0;
*C.fx(TFIRST, “C”) = Cc0;
MGS.fx(TFIRST, “U”) = MGSu0;
MGS.fx(TFIRST, “C”) = MGSc0;
Ig.fx(TFIRST, “U”) = Igu0;
Ig.fx(TFIRST, “C”) = Igc0;
E.fx(TFIRST, “U”) = Eu0;
E.fx(TFIRST, “C”) = Ec0;
*Dummy1.lo(T) = 0;
*Dummy2.lo(T) = 0;
SOLVE Nash MAXIMIZING UTILITY1 USING RMINLP;
SOLVE Nash MAXIMIZING UTILITY2 USING RMINLP;
DISPLAY K.L, Kg.L, Q.L, MGS.L, Ig.L, E.L, Pg.L, Op.L, M.L, GHG.L, Y.L;


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Redwood:



You need to solve USING MINLP instead of RMINLP. And why do you have two solve statements?



Good luck



Arne


\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Redwood
Sent: Friday, March 29, 2013 3:32 AM
To: gamsworld@googlegroups.com
Subject: Binary variable problem



Dear GAMS experts,



I coded the binary variable (Y(T)) in my model, and I think the binary variable must be 0 or 1. But in my model, I got the binary variable = 0.5 or other numbers.



I don’t know how to solve this problem. I attached my model here.



Can you help me?





Sincerely yours,



Redwood





SETS T TIME PERIODS /0*5/
TFIRST(T) FIRST PERIOD
TLAST(T) LAST PERIOD

N Regions /U, C/;

SCALARS
** constant
ep Exchange rate / 1.0 /
Gbar1 Limits of carbon emissions in country 1 / 4.88 /
r1 Interest rate in country 1 / 0.03 /
L1 Labor force in country 1 / 157.5 /
Gbar2 Limits of carbon emissions in country 2 / 3 /
r2 Interest rate in country 2 / 0.05 /
L2 Labor force in country 2 / 799.5 /
Pw World price of energy / 1 /
GHGs Target of greenhouse gas emissions / 2748.39 /
delta1 Discount rate / .02 /
gam1 Coefficient of utility 1 / -0.000000005964 /
eta11 Elasticity of MGS in country 1 / 0.1726 /
eta12 Elasticity of EQ in country 1 / 0.6868 /
ag1 Clean capital in country 1 / 1.675 /
alpha1 Target green house gas emissions / 1.032 /
rhoq1 Target green house gas emissions / 0.351 /
beta11 Elasticity of capital in county 1 / 0.228 /
beta12 Elasticity of labor force in country 1 / 0.472 /
beta13 Elasticity of energy in country 1 / 0.301 /
g11 Emissions coefficient in country 1 / 2.352 /
g12 Scale factor of emissions in country 1 / -0.1869 /
xi1 Target green house gas emissions / 0.8898 /
rhom1 Target green house gas emissions / 0.004 /
delta2 Discount rate / .04 /
gam2 Coefficient of utility 2 / -0.00000002672 /
eta21 Elasticity of MGS in country 2 / 0.5341 /
eta22 Elasticity of EQ in country 2 / 0.2305 /
ag2 Clean capital in country 2 / -1.239 /
alpha2 Target green house gas emissions / 0.786628 /
rhoq2 Target green house gas emissions / 0.044 /
beta21 Elasticity of capital in country 2 / 0.269 /
beta22 Elasticity of labor force in country 2 / 0.324 /
beta23 Elasticity of energy in country 2 / 0.407 /
g21 Emissions coefficient in country 2 / 0.5398 /
g22 Scale factor of emissions in country 2 / 0.015 /
xi2 Target green house gas emissions / 1.05 /
rhom2 Target green house gas emissions / 0.0453 /
d Greenhouse gas emissions discout facot / .005 /
psi1 Elasticity of offsets price / .001 /

Ku0 Initial dirty capital stock in country 1 / 43007 /
Kc0 Initial dirty capital stock in country 2 / 16113 /
Kgu0 Initial clean capital stock in country 1 / 43.007 /
Kgc0 Initial clean capital stock in country 2 / 16.113 /
Pg0 Initial price of offset / 0.005 /
GHG0 Initial greenhouse gas emissions / 3026.09 /

*Cu0 Initial consumtion in country 1 / 12.8 /
*Cc0 Initial consumtion in country 2 /2.84/
Igu0 Initial clean investment in country 1 /0.062460245/
Igc0 Initial clean investment in country 2 /0.081370566/
Eu0 Energy consumption in country 1 /2.22/
Ec0 Energy consumption in country 2 /2.42/

Qu0 /14.4/
Qc0 /5.93/
mu1 /0.8562/
mu2 /0.4911/
MGSu0 Initial consumtion in country 1 /2.66/
MGSc0 Initial consumtion in country 2 /1.58/;

PARAMETERS ZU(T) DISCOUNT FACTOR
ZC(T) DISCOUNT FACTOR
FU(T)
FC(T);

TFIRST(T) = YES$(ORD(T) EQ 1);
TLAST(T) = YES$(ORD(T) EQ CARD(T));
ZU(T) = EXP(rhoq1*(ORD(T)-1));
ZC(T) = EXP(rhoq2*(ORD(T)-1));
FU(T) = EXP(-rhom1*(ORD(T)-1));
FC(T) = EXP(-rhom2*(ORD(T)-1));

Parameter BigM/15000/;

VARIABLES

  • Control variables

*C(T,N) Consumption
MGS(T,N) Imports
Ig(T,N) Clean investment
E(T,N) Energy

\

  • State variables

K(T,N) Dirty capital stocks
Kg(T,N) Clean capital stocks
Pg(T) Price of offsets
GHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere

\

  • Other variables

Op(T) Offsets
Q(T,N) GDP(Output)
Dummy(T)
Utility1
Utility2

M(T,N)
;

Binary Variable
Y(T);

EQUATIONS

MMu(T,N)
MMc(T,N)

QQu(T,N) Output in country 1
QQc(T,N) Output in country 2

OOp1(T) Offsets 1
OOp2(T) Offsets 2
OOp3(T) Offsets 3
OOp4(T) Offsets 4
*OOp5(T)
*OOp6(T)

Ku(T,N) Dirty capital stocks in country 1
TKu(T,N) Termial condition for dirty capital stocks in country 1
Kc(T,N) Dirty capital stocks in country 2
TKc(T,N) Termial condition for dirty capital stocks in country 2
KKg(T,N) Clean capital stocks
TKg(T,N) Terminal condition for clean capital stocks
PPg(T) Price of offsets
TPg(T) Terminal condition for price of offsets
GGHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere
TGHG(T) Terminal condition for the concentration of CO2

UTIL1 Discounted utility 1 : OBJECTIVE FUNCTION
UTIL2 Discounted utility 2 : OBJECTIVE FUNCTION;


MMu(T,N)… M(T,“U”) =e= (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))*xi1)E(T, “U”);
MMc(T,N)… M(T,“C”) =e= (g21
FC(T)-g22
(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))**xi2)*E(T, “C”);

QQu(T,N)… Q(T,“U”) =e= ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))beta11)*(L1beta12)(E(T, “U”)**beta13);
QQc(T,N)… Q(T,“C”) =e= ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)
(L2**beta22)*(E(T, “C”)**beta23);

OOp1(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) + BigM*(1-Y(T)) =g= 0;
OOp2(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) - BigM*(Y(T)) =l= 0;
OOp3(T)… Op(T) + (1-Y(T))*Dummy(T) =e= M(T,“U”) - Gbar1;
OOp4(T)… Op(T) + Y(T)*Dummy(T) =e= Gbar2 - M(T,“C”);
OOp5(T)… Dummy1(T)-BigM(1-Y(T)) =l= 0;
OOp6(T)… Dummy2(T)-BigM(Y(T)) =l= 0;

Ku(T+1,N)… K(T+1, “U”) =e= (1-mu1)ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1**beta12)*(E(T, “U”)**beta13)

  • MGS(T,“U”)ep - Ig(T, “U”)(1+ag1Ig(T, “U”)/(2Kg(T, “U”)))
  • Pg(T)Op(T)+ K(T, “U”);
    TKu(TLAST,N)… 0 =l= (1-mu1)ZU(TLAST)alpha1((K(TLAST, “U”)+ Kg(TLAST, “U”))**beta11)(L1**beta12)
    (E(TLAST, “U”)**beta13)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “U”)(1+ag1Ig(TLAST, “U”)/(2Kg(TLAST, “U”)))
  • Pg(TLAST)Op(TLAST)+ K(TLAST, “U”);
    Kc(T+1,N)… K(T+1, “C”) =e= (1-mu2)ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2**beta22)
    (E(T, “C”)**beta23)
  • MGS(T,“C”)/ep - Ig(T, “C”)(1+ag2Ig(T, “C”)/(2*Kg(T, “C”)))
  • Pg(T)Op(T)/ep + K(T, “C”);
    TKc(TLAST,N)… 0 =l= (1-mu2)ZC(TLAST)alpha2((K(TLAST, “C”)+ Kg(TLAST, “C”))**beta21)(L2**beta22)
    (E(TLAST, “C”)**beta23)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “C”)(1+ag2Ig(TLAST, “C”)/(2Kg(TLAST, “C”)))
  • Pg(TLAST)*Op(TLAST)/ep + K(TLAST, “C”);

KKg(T+1,N)… Kg(T+1,N) =e= Ig(T,N)+ Kg(T,N);
TKg(TLAST,N)… 0 =l= Ig(TLAST,N) + Kg(TLAST,N);

PPg(T+1)… Pg(T+1) =e= psi1Pg(T)
((g11FU(T)- g12
(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)beta13Q(T,“U”)/(Pw+Pg(T)*Op(T)/E(T, “U”))

  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))*xi2)beta23Q(T,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1Gbar2) + Pg(T);
    TPg(TLAST)… 0 =l= psi1
    Pg(TLAST)
    ((g11FU(TLAST)-g12
    (Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)beta13Q(TLAST,“U”)/(Pw+Pg(TLAST)*Op(TLAST)/E(TLAST, “U”))
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)beta23Q(TLAST,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1*Gbar2) + Pg(TLAST);

GGHG(T+1)… GHG(T+1) =e= - d*GHG(T)

  • (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)*E(T, “U”)
  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))**xi2)*E(T, “C”)
  • GHG(T);
    TGHG(TLAST)… 0 =l= - d*GHG(TLAST)
  • (g11FU(TLAST)-g12(Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)*E(TLAST, “U”)
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)*E(TLAST, “C”)
  • GHG(TLAST);

UTIL1… UTILITY1 =e= SUM(T, EXP(delta1*(ORD(T)-1))(1/gam1)(mu1ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1beta12)(E(T, “U”)**beta13)
MGS(T, “U”)*eta11(GHGs/GHG(T))**eta12)*gam1);
UTIL2… UTILITY2 =e= SUM(T, EXP(delta2
(ORD(T)-1))
(1/gam2)
(mu2ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2
beta22)*(E(T, “C”)**beta23)
*MGS(T, “C”)*eta21(GHGs/GHG(T))**eta22)**gam2);


Parameters
K7
Kg7
*C7
MGS7
Ig7
GHG7
Pg7
Op7
M7
Me7
;

MODEL Nash /all/;

*############################ Lower and upper #############################


K.LO(T,N) = 10000;
Kg.LO(T,N) = 1;
Pg.LO(T) = 0.0001; Pg.up(T) = 10000;
GHG.lo(T) = 2000; GHG.up(T) = 3500;

*C.LO(T,N)= 0.01;C.UP(T,N) = 150;
MGS.LO(T,N)= 0.01;MGS.UP(T,N) = 150;
Ig.LO(T,N)= 0.01;Ig.UP(T,N) = 100;
E.LO(T,N)= 0.01;E.UP(T,N) = 20;
Op.lO(T) = 0; Op.up(T) = 10;


K.fx(TFIRST, “U”) = Ku0;
K.fx(TFIRST, “C”) = Kc0;
Kg.fx(TFIRST, “U”) = Kgu0;
Kg.fx(TFIRST, “C”) = Kgc0;
Pg.fx(TFIRST) = Pg0;
GHG.fx(TFIRST) = GHG0;

*C.fx(TFIRST, “U”) = Cu0;
*C.fx(TFIRST, “C”) = Cc0;
MGS.fx(TFIRST, “U”) = MGSu0;
MGS.fx(TFIRST, “C”) = MGSc0;
Ig.fx(TFIRST, “U”) = Igu0;
Ig.fx(TFIRST, “C”) = Igc0;
E.fx(TFIRST, “U”) = Eu0;
E.fx(TFIRST, “C”) = Ec0;

*Dummy1.lo(T) = 0;
*Dummy2.lo(T) = 0;

SOLVE Nash MAXIMIZING UTILITY1 USING RMINLP;
SOLVE Nash MAXIMIZING UTILITY2 USING RMINLP;

DISPLAY K.L, Kg.L, Q.L, MGS.L, Ig.L, E.L, Pg.L, Op.L, M.L, GHG.L, Y.L;


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Dear Arne and Luiz,

Thank you very much for your reply.


Arne,

What do you mean “Two solve statement”?


Sincerely yours,

Redwood

On Thursday, March 28, 2013 10:32:20 PM UTC-4, Redwood wrote:

Dear GAMS experts,

I coded the binary variable (Y(T)) in my model, and I think the binary variable must be 0 or 1. But in my model, I got the binary variable = 0.5 or other numbers.

I don’t know how to solve this problem. I attached my model here.

Can you help me?


Sincerely yours,

Redwood


SETS T TIME PERIODS /05/
TFIRST(T) FIRST PERIOD
TLAST(T) LAST PERIOD
N Regions /U, C/;
SCALARS
** constant
ep Exchange rate / 1.0 /
Gbar1 Limits of carbon emissions in country 1 / 4.88 /
r1 Interest rate in country 1 / 0.03 /
L1 Labor force in country 1 / 157.5 /
Gbar2 Limits of carbon emissions in country 2 / 3 /
r2 Interest rate in country 2 / 0.05 /
L2 Labor force in country 2 / 799.5 /
Pw World price of energy / 1 /
GHGs Target of greenhouse gas emissions / 2748.39 /
delta1 Discount rate / .02 /
gam1 Coefficient of utility 1 / -0.000000005964 /
eta11 Elasticity of MGS in country 1 / 0.1726 /
eta12 Elasticity of EQ in country 1 / 0.6868 /
ag1 Clean capital in country 1 / 1.675 /
alpha1 Target green house gas emissions / 1.032 /
rhoq1 Target green house gas emissions / 0.351 /
beta11 Elasticity of capital in county 1 / 0.228 /
beta12 Elasticity of labor force in country 1 / 0.472 /
beta13 Elasticity of energy in country 1 / 0.301 /
g11 Emissions coefficient in country 1 / 2.352 /
g12 Scale factor of emissions in country 1 / -0.1869 /
xi1 Target green house gas emissions / 0.8898 /
rhom1 Target green house gas emissions / 0.004 /
delta2 Discount rate / .04 /
gam2 Coefficient of utility 2 / -0.00000002672 /
eta21 Elasticity of MGS in country 2 / 0.5341 /
eta22 Elasticity of EQ in country 2 / 0.2305 /
ag2 Clean capital in country 2 / -1.239 /
alpha2 Target green house gas emissions / 0.786628 /
rhoq2 Target green house gas emissions / 0.044 /
beta21 Elasticity of capital in country 2 / 0.269 /
beta22 Elasticity of labor force in country 2 / 0.324 /
beta23 Elasticity of energy in country 2 / 0.407 /
g21 Emissions coefficient in country 2 / 0.5398 /
g22 Scale factor of emissions in country 2 / 0.015 /
xi2 Target green house gas emissions / 1.05 /
rhom2 Target green house gas emissions / 0.0453 /
d Greenhouse gas emissions discout facot / .005 /
psi1 Elasticity of offsets price / .001 /
Ku0 Initial dirty capital stock in country 1 / 43007 /
Kc0 Initial dirty capital stock in country 2 / 16113 /
Kgu0 Initial clean capital stock in country 1 / 43.007 /
Kgc0 Initial clean capital stock in country 2 / 16.113 /
Pg0 Initial price of offset / 0.005 /
GHG0 Initial greenhouse gas emissions / 3026.09 /
Cu0 Initial consumtion in country 1 / 12.8 /
Cc0 Initial consumtion in country 2 /2.84/
Igu0 Initial clean investment in country 1 /0.062460245/
Igc0 Initial clean investment in country 2 /0.081370566/
Eu0 Energy consumption in country 1 /2.22/
Ec0 Energy consumption in country 2 /2.42/
Qu0 /14.4/
Qc0 /5.93/
mu1 /0.8562/
mu2 /0.4911/
MGSu0 Initial consumtion in country 1 /2.66/
MGSc0 Initial consumtion in country 2 /1.58/;
PARAMETERS ZU(T) DISCOUNT FACTOR
ZC(T) DISCOUNT FACTOR
FU(T)
FC(T);
TFIRST(T) = YES$(ORD(T) EQ 1);
TLAST(T) = YES$(ORD(T) EQ CARD(T));
ZU(T) = EXP(rhoq1
(ORD(T)-1));
ZC(T) = EXP(rhoq2
(ORD(T)-1));
FU(T) = EXP(-rhom1
(ORD(T)-1));
FC(T) = EXP(-rhom2*(ORD(T)-1));
Parameter BigM/15000/;
VARIABLES

  • Control variables
    *C(T,N) Consumption
    MGS(T,N) Imports
    Ig(T,N) Clean investment
    E(T,N) Energy

  • State variables
    K(T,N) Dirty capital stocks
    Kg(T,N) Clean capital stocks
    Pg(T) Price of offsets
    GHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere

  • Other variables
    Op(T) Offsets
    Q(T,N) GDP(Output)
    Dummy(T)
    Utility1
    Utility2
    M(T,N)
    ;
    Binary Variable
    Y(T);
    EQUATIONS
    MMu(T,N)
    MMc(T,N)
    QQu(T,N) Output in country 1
    QQc(T,N) Output in country 2
    OOp1(T) Offsets 1
    OOp2(T) Offsets 2
    OOp3(T) Offsets 3
    OOp4(T) Offsets 4
    *OOp5(T)
    *OOp6(T)
    Ku(T,N) Dirty capital stocks in country 1
    TKu(T,N) Termial condition for dirty capital stocks in country 1
    Kc(T,N) Dirty capital stocks in country 2
    TKc(T,N) Termial condition for dirty capital stocks in country 2
    KKg(T,N) Clean capital stocks
    TKg(T,N) Terminal condition for clean capital stocks
    PPg(T) Price of offsets
    TPg(T) Terminal condition for price of offsets
    GGHG(T) The concentration of carbon dioxide (CO2) in Earth’s atmosphere
    TGHG(T) Terminal condition for the concentration of CO2
    UTIL1 Discounted utility 1 : OBJECTIVE FUNCTION
    UTIL2 Discounted utility 2 : OBJECTIVE FUNCTION;

MMu(T,N)… M(T,“U”) =e= (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))xi1)E(T, “U”);
MMc(T,N)… M(T,“C”) =e= (g21
FC(T)-g22
(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))xi2)E(T, “C”);
QQu(T,N)… Q(T,“U”) =e= ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)
(L1
beta12)(E(T, “U”)**beta13);
QQc(T,N)… Q(T,“C”) =e= ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)
(L2
beta22)*(E(T, “C”)beta23);
OOp1(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) + BigM
(1-Y(T)) =g= 0;
OOp2(T)… Gbar2 - M(T,“C”) + Gbar1 - M(T,“U”) - BigM
(Y(T)) =l= 0;
OOp3(T)… Op(T) + (1-Y(T))*Dummy(T) =e= M(T,“U”) - Gbar1;
OOp4(T)… Op(T) + Y(T)*Dummy(T) =e= Gbar2 - M(T,“C”);
OOp5(T)… Dummy1(T)-BigM(1-Y(T)) =l= 0;
OOp6(T)… Dummy2(T)-BigM(Y(T)) =l= 0;
Ku(T+1,N)… K(T+1, “U”) =e= (1-mu1)ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1
*beta12)*(E(T, “U”)**beta13)

  • MGS(T,“U”)ep - Ig(T, “U”)(1+ag1Ig(T, “U”)/(2Kg(T, “U”)))
  • Pg(T)Op(T)+ K(T, “U”);
    TKu(TLAST,N)… 0 =l= (1-mu1)ZU(TLAST)alpha1((K(TLAST, “U”)+ Kg(TLAST, “U”))**beta11)(L1**beta12)
    (E(TLAST, “U”)**beta13)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “U”)(1+ag1Ig(TLAST, “U”)/(2Kg(TLAST, “U”)))
  • Pg(TLAST)Op(TLAST)+ K(TLAST, “U”);
    Kc(T+1,N)… K(T+1, “C”) =e= (1-mu2)ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2**beta22)
    (E(T, “C”)**beta23)
  • MGS(T,“C”)/ep - Ig(T, “C”)(1+ag2Ig(T, “C”)/(2*Kg(T, “C”)))
  • Pg(T)Op(T)/ep + K(T, “C”);
    TKc(TLAST,N)… 0 =l= (1-mu2)ZC(TLAST)alpha2((K(TLAST, “C”)+ Kg(TLAST, “C”))**beta21)(L2**beta22)
    (E(TLAST, “C”)**beta23)
  • MGS(TLAST,“U”)ep - Ig(TLAST, “C”)(1+ag2Ig(TLAST, “C”)/(2Kg(TLAST, “C”)))
  • Pg(TLAST)Op(TLAST)/ep + K(TLAST, “C”);
    KKg(T+1,N)… Kg(T+1,N) =e= Ig(T,N)+ Kg(T,N);
    TKg(TLAST,N)… 0 =l= Ig(TLAST,N) + Kg(TLAST,N);
    PPg(T+1)… Pg(T+1) =e= psi1
    Pg(T)
    ((g11FU(T)- g12*(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)beta13Q(T,“U”)/(Pw+Pg(T)*Op(T)/E(T, “U”))
  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))*xi2)beta23Q(T,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1Gbar2) + Pg(T);
    TPg(TLAST)… 0 =l= psi1
    Pg(TLAST)
    ((g11FU(TLAST)-g12
    (Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)beta13Q(TLAST,“U”)/(Pw+Pg(TLAST)*Op(TLAST)/E(TLAST, “U”))
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)beta23Q(TLAST,“C”)/Pw - Gbar1 - Gbar2)
    /sqrt(Gbar1Gbar2) + Pg(TLAST);
    GGHG(T+1)… GHG(T+1) =e= - d
    GHG(T)
  • (g11FU(T)-g12(Kg(T,“U”)/(K(T,“U”)+ Kg(T,“U”)))**xi1)*E(T, “U”)
  • (g21FC(T)-g22(Kg(T,“C”)/(K(T,“C”)+ Kg(T,“C”)))**xi2)*E(T, “C”)
  • GHG(T);
    TGHG(TLAST)… 0 =l= - d*GHG(TLAST)
  • (g11FU(TLAST)-g12(Kg(TLAST,“U”)/(K(TLAST,“U”)+ Kg(TLAST,“U”)))**xi1)*E(TLAST, “U”)
  • (g21FC(TLAST)-g22(Kg(TLAST,“C”)/(K(TLAST,“C”)+ Kg(TLAST,“C”)))**xi2)*E(TLAST, “C”)
  • GHG(TLAST);
    UTIL1… UTILITY1 =e= SUM(T, EXP(delta1*(ORD(T)-1))(1/gam1)(mu1ZU(T)alpha1((K(T, “U”)+ Kg(T, “U”))**beta11)(L1beta12)(E(T, “U”)**beta13)
    MGS(T, “U”)*eta11(GHGs/GHG(T))**eta12)*gam1);
    UTIL2… UTILITY2 =e= SUM(T, EXP(delta2
    (ORD(T)-1))
    (1/gam2)
    (mu2ZC(T)alpha2((K(T, “C”)+ Kg(T, “C”))**beta21)(L2
    beta22)*(E(T, “C”)**beta23)
    *MGS(T, “C”)*eta21(GHGs/GHG(T))**eta22)**gam2);

Parameters
K7
Kg7
*C7
MGS7
Ig7
GHG7
Pg7
Op7
M7
Me7
;
MODEL Nash /all/;
*############################ Lower and upper #############################

K.LO(T,N) = 10000;
Kg.LO(T,N) = 1;
Pg.LO(T) = 0.0001; Pg.up(T) = 10000;
GHG.lo(T) = 2000; GHG.up(T) = 3500;
*C.LO(T,N)= 0.01;C.UP(T,N) = 150;
MGS.LO(T,N)= 0.01;MGS.UP(T,N) = 150;
Ig.LO(T,N)= 0.01;Ig.UP(T,N) = 100;
E.LO(T,N)= 0.01;E.UP(T,N) = 20;
Op.lO(T) = 0; Op.up(T) = 10;

K.fx(TFIRST, “U”) = Ku0;
K.fx(TFIRST, “C”) = Kc0;
Kg.fx(TFIRST, “U”) = Kgu0;
Kg.fx(TFIRST, “C”) = Kgc0;
Pg.fx(TFIRST) = Pg0;
GHG.fx(TFIRST) = GHG0;
*C.fx(TFIRST, “U”) = Cu0;
*C.fx(TFIRST, “C”) = Cc0;
MGS.fx(TFIRST, “U”) = MGSu0;
MGS.fx(TFIRST, “C”) = MGSc0;
Ig.fx(TFIRST, “U”) = Igu0;
Ig.fx(TFIRST, “C”) = Igc0;
E.fx(TFIRST, “U”) = Eu0;
E.fx(TFIRST, “C”) = Ec0;
*Dummy1.lo(T) = 0;
*Dummy2.lo(T) = 0;
SOLVE Nash MAXIMIZING UTILITY1 USING RMINLP;
SOLVE Nash MAXIMIZING UTILITY2 USING RMINLP;
DISPLAY K.L, Kg.L, Q.L, MGS.L, Ig.L, E.L, Pg.L, Op.L, M.L, GHG.L, Y.L;


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi Liu,

A wild guess is the GAMS was unable to find integer solution so it provided relaxed solution instead. You can examine you model to see whether it is logically feasible.

Regards,
Dylan

在 2014年5月13日星期二UTC+8下午12时49分22秒,Suwei Liu写道:

I use GAMS to solve a unit commitment problem ,define the binary variable U to represent the status of generator, but after I run the program, the result of U shows other values besides 1 and 0. What causes this contradiction?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Hi, Lan
thanks for your advice, I will examine my model again.

在 2014年5月15日星期四UTC+8下午4时39分42秒,Dylan Lan写道:

Hi Liu,

A wild guess is the GAMS was unable to find integer solution so it provided relaxed solution instead. You can examine you model to see whether it is logically feasible.

Regards,
Dylan

在 2014年5月13日星期二UTC+8下午12时49分22秒,Suwei Liu写道:

I use GAMS to solve a unit commitment problem ,define the binary variable U to represent the status of generator, but after I run the program, the result of U shows other values besides 1 and 0. What causes this contradiction?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Hi Liu,

Could you please attach your Unit Commitment code to tell you how you can correct it?

Regards,

Morteza Shabanzadeh
وبلاگ شخصی مرتضی شعبان زاده

image


وبلاگ شخصی مرتضی شعبان زاده
وبلاگ شخصی مرتضی شعبان زاده - I live in the present, appreciate the past, and focus on the future - وبلاگ شخصی مرتضی شعبان زاده

View on mortezash.blogfa.com

Preview by Yahoo







On Sunday, May 18, 2014 2:35 PM, Suwei Liu wrote:


Hi, Lan
thanks for your advice, I will examine my model again.

在 2014年5月15日星期四UTC+8下午4时39分42秒,Dylan Lan写道:

Hi Liu,

A wild guess is the GAMS was unable to find integer solution so it provided relaxed solution instead. You can examine you model to see whether it is logically feasible.

Regards,
Dylan

在 2014年5月13日星期二UTC+8下午12时49分22秒, Suwei Liu写道:

I use GAMS to solve a unit commitment problem ,define the binary variable U to represent the status of generator, but after I run the program, the result of U shows other values besides 1 and 0. What causes this contradiction?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Reply-to: gamsworld@googlegroups.com

sorry,I am afraid I haven’t solve this problem yet : (

And I found a sentence in the user’s guide, said “For binary and integer variable types, the consequences of the type declaration cannot be completely
undone.” but no more explainations.


在 2014年5月18日星期日UTC+8下午7时11分58秒,.::Morteza Shabanzadeh::.写道:

Hi Liu,

Could you please attach your Unit Commitment code to tell you how you can correct it?

Regards,

Morteza Shabanzadeh
وبلاگ شخصی مرتضی شعبان زاده

image


وبلاگ شخصی مرتضی شعبان زاده
وبلاگ شخصی مرتضی شعبان زاده - I live in the present, appreciate the past, and focus on the future - وبلاگ شخصی مرتضی شعبان زاده

View on mortezash.blogfa.com

Preview by Yahoo







On Sunday, May 18, 2014 2:35 PM, Suwei Liu wrote:


Hi, Lan
thanks for your advice, I will examine my model again.

在 2014年5月15日星期四UTC+8下午4时39分42秒,Dylan Lan写道:

Hi Liu,

A wild guess is the GAMS was unable to find integer solution so it provided relaxed solution instead. You can examine you model to see whether it is logically feasible.

Regards,
Dylan

在 2014年5月13日星期二UTC+8下午12时49分22秒, Suwei Liu写道:

I use GAMS to solve a unit commitment problem ,define the binary variable U to represent the status of generator, but after I run the program, the result of U shows other values besides 1 and 0. What causes this contradiction?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Hi Liu,

No problem.

Actually, I had this kind of problem when I was working on my MS thesis titled Power Transit Modeling in the Electricity Retail Market. In that time, I realized that GAMS solvers are not able to precisely optimize MINLP problems especially when the objective function is non-convex!

I recommend you using MILP model (and not MINLP ) to solve confidently the Unit Commitment problem (I mean, you have to linearize the quadratic cost function of the generation units in your UC problem).

Surely, the following papers would be helpful for you and all the Electrical Engineers interested in Electricity Market issues:

[1] J. M. Arroyo and A. J. Conejo, “Optimal response of a thermal unit to an electricity spot market,” IEEE Trans. Power Syst., vol. 15, no. 3, pp. 1098–1104, Aug. 2000.

[2] M. Carrión and J. M. Arroyo, “A computationally efficient mixed-in-teger linear formulation for the thermal unit commitment problem,” IEEE Trans. Power Syst., vol. 21, no. 3, pp. 1371–1378, Aug. 2006.

If you need any further information feel free to e-mail me.

Regards,

Morteza Shabanzadeh
وبلاگ شخصی مرتضی شعبان زاده

image


وبلاگ شخصی مرتضی شعبان زاده
وبلاگ شخصی مرتضی شعبان زاده - I live in the present, appreciate the past, and focus on the future - وبلاگ شخصی مرتضی شعبان زاده

View on mortezash.blogfa.com

Preview by Yahoo






On Monday, May 19, 2014 12:55 PM, Suwei Liu wrote:


sorry,I am afraid I haven’t solve this problem yet : (

And I found a sentence in the user’s guide, said “For binary and integer variable types, the consequences of the type declaration cannot be completely
undone.” but no more explainations.


在 2014年5月18日星期日UTC+8下午7时11分58秒,.::Morteza Shabanzadeh::.写道:

Hi Liu,

Could you please attach your Unit Commitment code to tell you how you can correct it?

Regards,

Morteza Shabanzadeh
وبلاگ شخصی مرتضی شعبان زاده

image


وبلاگ شخصی مرتضی شعبان زاده
وبلاگ شخصی مرتضی شعبان زاده - I live in the present, appreciate the past, and focus on the future - وبلاگ شخصی مرتضی شعبان زاده

View on mortezash.blogfa.com

Preview by Yahoo







On Sunday, May 18, 2014 2:35 PM, Suwei Liu wrote:


Hi, Lan
thanks for your advice, I will examine my model again.

在 2014年5月15日星期四UTC+8下午4时39分42秒, Dylan Lan写道:

Hi Liu,

A wild guess is the GAMS was unable to find integer solution so it provided relaxed solution instead. You can examine you model to see whether it is logically feasible.

Regards,
Dylan

在 2014年5月13日星期二UTC+8下午12时49分22秒, Suwei Liu写道:

I use GAMS to solve a unit commitment problem ,define the binary variable U to represent the status of generator, but after I run the program, the result of U shows other values besides 1 and 0. What causes this contradiction?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+…@ googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/ group/gamsworld.
For more options, visit https://groups.google.com/d/ optout.


\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

What is the solver being used to solve the problem? Even if your equations have a problem, if you have declared the variables to be binary, the solver should either point to the problem in the constraints (like infeasibility) or solve the problem and produce a solution, which by definition must have the binary variables at either 0 or 1.

Did the solver complete its process and report that it had found a solution or was the process interrupted prematurely? The latter could explain why you have binary variables with fractional values.

On Tuesday, September 29, 2015 at 7:09:53 AM UTC-5, kafa...@gmail.com wrote:

Dear all,

Even if I used a binary variables(0 or 1), there are some non-integer values on the result.

I want to have only binary interger number on the result.

What is the problem? (I guess that my equations might have some problems.) Please, help me.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

I am truly thankful for your concern. I used mip solver to solve my problem. The solver completed its process without problems. When I fiexed some parameter values, there were no fractional values.


2015년 9월 29일 화요일 오후 11시 21분 51초 UTC+9, Chandrashekhar Khot 님의 말:

What is the solver being used to solve the problem? Even if your equations have a problem, if you have declared the variables to be binary, the solver should either point to the problem in the constraints (like infeasibility) or solve the problem and produce a solution, which by definition must have the binary variables at either 0 or 1.

Did the solver complete its process and report that it had found a solution or was the process interrupted prematurely? The latter could explain why you have binary variables with fractional values.

On Tuesday, September 29, 2015 at 7:09:53 AM UTC-5, kafa...@gmail.com wrote:

Dear all,

Even if I used a binary variables(0 or 1), there are some non-integer values on the result.

I want to have only binary interger number on the result.

What is the problem? (I guess that my equations might have some problems.) Please, help me.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.