## Re:Re:When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

### Re:Re:When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger:

Thanks so much, I have solved this problem. I deleted "$not leader(i)" in the "profit_follower" equation. But now aonther prolem is "infeasible solution: reduced gradient less than tolerance " ,I don't know where is going wrong...

please HELP!!

Again thank you very much !!!!!

At 2016-04-20 16:00:19, "Renger van Nieuwkoop" wrote:

Hi

I had to change the following line to:

set leader(i) /6/; -> set leader(i) /s6/;

After that, I get the following error:

**** MCP pair sb.ps has unmatched equation

sb(S6)

This means that there is one equation missing or one variable too much. (if you fix one of the prices, e.g., PS.FX(â€œs6â€) = 1 the model starts solving but is infeasible.

Try to check your model formulation.

Additional material can be found in the GAMS model library (nash.gms has a Stackelberg) and Foundations of Network Optimization and Games, Chapter 10, by Friesz and Bernstein

Cheers

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of lk

Sent: Mittwoch, 20. April 2016 04:45

To: gamsworld@googlegroups.com

Subject: Re:RE: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger:

Sorry. It's my fault, here are the code for reading the xlsx.

$call GDXXRW.EXE sitanboge.xlsx dset=i rng=t!a2 rdim=1 dset=j rng=t!b1 cdim=1 par=sl rng=sl!a2 rdim=1 par=t rng=t! rdim=1 cdim=1 par=da rng=da!a2 rdim=1 par=db rng=db!a2 rdim=1 par=c rng=c!a2 rdim=1 par=dl rng=dl!a2 rdim=1

$gdxin sitanboge.gdx

Thanks !

At 2016-04-19 21:18:34, "Renger van Nieuwkoop" wrote:

But then you should also send the code for reading the xlsx. Not that it is much work for me, but if the error is there, I wonâ€™t be able to reproduce your error.

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of lkcumt@163.com

Sent: Dienstag, 19. April 2016 03:38

To: gamsworld

Subject: Re: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger;

Thanks for your reply!!

Attachment is my input file, looking forwarding your reply !

On Monday, April 18, 2016 at 9:57:30 PM UTC+8, Renger van Nieuwkoop wrote:

Hi ??

Without the possibility of running your code (as you didn't send the input files) or at least information from the listing file with the exact error message, I must have superpowers to give you an answer (but perhaps others are better in guessing ).

Cheers

Renger

Sent from my Samsung Note 4

-------- Original message --------

From: lkc...@163.com

Date: 4/18/2016 15:17 (GMT+01:00)

To: gamsworld

Subject: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Help:

When I using GAMS to solve an Economic phenomenon based on Stacklberg Modle, once I operate the system ,some error occurs, the information shows in the below picture:

Below is the whole program:

set i (*)

j (*);

$load i j

parameters

t(i,j) unit transport cost

c(j) unit product cost

sl(i) supply limit

da(j) demand constant a

db(j) demand constant b

dl(j) demand limit;

$load t c sl da db dl

$ gdxin

display i,j,t,c,sl,da,db,dl;

set leader(i) /6/;

positive variables

ps(i) supply price

pd(j) demand price

x(i,j) traffic volume between supply i to demand j;

variable benefitleader leader's benefit;

equations

profit_leader leader's profit

profit_follwer(i,j) follower's profit

sb(i) supply balance

deb(j) demand balance;

alias (i,ii);

x.lo(i,j)=0.01;

deb(j).. sum(i,x(i,j))=g=dl(j);

sb(i).. sl(i)=g=sum(j,x(i,j));

profit_follwer(i,j)$(not leader(i)).. t(i,j)+c(j)+ps(i)-pd(j)-exp(da(j))*sum(ii,x(ii,j))**db(j)=g=0;

profit_leader.. benefitleader =e=sum((i,j)$leader(i),exp(da(j))*sum(ii,x(i,j))**db(j)*x(i,j)-c(j)*x(i,j)-t(i,j)*x(i,j));

model sitanboge /sb.ps,deb.pd,profit_follwer.x,profit_leader/;

solve sitanboge using mpec max benefitleader;

option NLP=conopt;

display x.l,ps.l,pd.l;

Parameter report1(i,*) supply summary report

report2(j,*) demand summary report ;

report1(i,"supply") = sum(j,x.l(i,j)); report1(i,"capacity") = sl(i); report1(i,"prices") = ps.l(i);

report2(j,"demandl") = dl(j);report2(j,"demand")=sum(i,x.l(i,j)); report2(j,"priced") = pd.l(j);

Display report1,report2, x.l;

Sincerely ask for a solution to solve this problem !!!!

Many Many Thanks !!!!!!

--

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 https://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 https://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 https://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 https://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 https://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 https://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

### Re:RE: Re:RE: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

and it says infeassible solution..

At 2016-04-20 16:00:19, "Renger van Nieuwkoop" wrote:

Hi

I had to change the following line to:

set leader(i) /6/; -> set leader(i) /s6/;

After that, I get the following error:

**** MCP pair sb.ps has unmatched equation

sb(S6)

This means that there is one equation missing or one variable too much. (if you fix one of the prices, e.g., PS.FX(â€œs6â€) = 1 the model starts solving but is infeasible.

Try to check your model formulation.

Additional material can be found in the GAMS model library (nash.gms has a Stackelberg) and Foundations of Network Optimization and Games, Chapter 10, by Friesz and Bernstein

Cheers

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of lk

Sent: Mittwoch, 20. April 2016 04:45

To: gamsworld@googlegroups.com

Subject: Re:RE: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger:

Sorry. It's my fault, here are the code for reading the xlsx.

$call GDXXRW.EXE sitanboge.xlsx dset=i rng=t!a2 rdim=1 dset=j rng=t!b1 cdim=1 par=sl rng=sl!a2 rdim=1 par=t rng=t! rdim=1 cdim=1 par=da rng=da!a2 rdim=1 par=db rng=db!a2 rdim=1 par=c rng=c!a2 rdim=1 par=dl rng=dl!a2 rdim=1

$gdxin sitanboge.gdx

Thanks !

At 2016-04-19 21:18:34, "Renger van Nieuwkoop" wrote:

But then you should also send the code for reading the xlsx. Not that it is much work for me, but if the error is there, I wonâ€™t be able to reproduce your error.

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of lkcumt@163.com

Sent: Dienstag, 19. April 2016 03:38

To: gamsworld

Subject: Re: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger;

Thanks for your reply!!

Attachment is my input file, looking forwarding your reply !

On Monday, April 18, 2016 at 9:57:30 PM UTC+8, Renger van Nieuwkoop wrote:

Hi ??

Without the possibility of running your code (as you didn't send the input files) or at least information from the listing file with the exact error message, I must have superpowers to give you an answer (but perhaps others are better in guessing ).

Cheers

Renger

Sent from my Samsung Note 4

-------- Original message --------

From: lkc...@163.com

Date: 4/18/2016 15:17 (GMT+01:00)

To: gamsworld

Subject: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Help:

When I using GAMS to solve an Economic phenomenon based on Stacklberg Modle, once I operate the system ,some error occurs, the information shows in the below picture:

Below is the whole program:

set i (*)

j (*);

$load i j

parameters

t(i,j) unit transport cost

c(j) unit product cost

sl(i) supply limit

da(j) demand constant a

db(j) demand constant b

dl(j) demand limit;

$load t c sl da db dl

$ gdxin

display i,j,t,c,sl,da,db,dl;

set leader(i) /6/;

positive variables

ps(i) supply price

pd(j) demand price

x(i,j) traffic volume between supply i to demand j;

variable benefitleader leader's benefit;

equations

profit_leader leader's profit

profit_follwer(i,j) follower's profit

sb(i) supply balance

deb(j) demand balance;

alias (i,ii);

x.lo(i,j)=0.01;

deb(j).. sum(i,x(i,j))=g=dl(j);

sb(i).. sl(i)=g=sum(j,x(i,j));

profit_follwer(i,j)$(not leader(i)).. t(i,j)+c(j)+ps(i)-pd(j)-exp(da(j))*sum(ii,x(ii,j))**db(j)=g=0;

profit_leader.. benefitleader =e=sum((i,j)$leader(i),exp(da(j))*sum(ii,x(i,j))**db(j)*x(i,j)-c(j)*x(i,j)-t(i,j)*x(i,j));

model sitanboge /sb.ps,deb.pd,profit_follwer.x,profit_leader/;

solve sitanboge using mpec max benefitleader;

option NLP=conopt;

display x.l,ps.l,pd.l;

Parameter report1(i,*) supply summary report

report2(j,*) demand summary report ;

report1(i,"supply") = sum(j,x.l(i,j)); report1(i,"capacity") = sl(i); report1(i,"prices") = ps.l(i);

report2(j,"demandl") = dl(j);report2(j,"demand")=sum(i,x.l(i,j)); report2(j,"priced") = pd.l(j);

Display report1,report2, x.l;

Sincerely ask for a solution to solve this problem !!!!

Many Many Thanks !!!!!!

--

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 https://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 https://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 https://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 https://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 https://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 https://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

### RE: Re:RE: Re:RE: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

THat would take too much of my time.

Sorry

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of lk

Sent: Thursday, April 21, 2016 4:31 AM

To: gamsworld@googlegroups.com

Subject: Re:RE: Re:RE: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger:

Thanks so much, I have solved this problem. I deleted "$not leader(i)" in the "profit_follower" equation. But now aonther prolem is "infeasible solution: reduced gradient less than tolerance " ,I don't know where is going wrong...

please HELP!!

Again thank you very much !!!!!

At 2016-04-20 16:00:19, "Renger van Nieuwkoop" wrote:

Hi

I had to change the following line to:

set leader(i) /6/; -> set leader(i) /s6/;

After that, I get the following error:

**** MCP pair sb.ps has unmatched equation

sb(S6)

This means that there is one equation missing or one variable too much. (if you fix one of the prices, e.g., PS.FX(â€œs6â€) = 1 the model starts solving but is infeasible.

Try to check your model formulation.

Additional material can be found in the GAMS model library (nash.gms has a Stackelberg) and Foundations of Network Optimization and Games, Chapter 10, by Friesz and Bernstein

Cheers

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of lk

Sent: Mittwoch, 20. April 2016 04:45

To: gamsworld@googlegroups.com

Subject: Re:RE: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger:

Sorry. It's my fault, here are the code for reading the xlsx.

$call GDXXRW.EXE sitanboge.xlsx dset=i rng=t!a2 rdim=1 dset=j rng=t!b1 cdim=1 par=sl rng=sl!a2 rdim=1 par=t rng=t! rdim=1 cdim=1 par=da rng=da!a2 rdim=1 par=db rng=db!a2 rdim=1 par=c rng=c!a2 rdim=1 par=dl rng=dl!a2 rdim=1

$gdxin sitanboge.gdx

Thanks !

At 2016-04-19 21:18:34, "Renger van Nieuwkoop" wrote:

But then you should also send the code for reading the xlsx. Not that it is much work for me, but if the error is there, I wonâ€™t be able to reproduce your error.

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of lkcumt@163.com

Sent: Dienstag, 19. April 2016 03:38

To: gamsworld

Subject: Re: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Hi Renger;

Thanks for your reply!!

Attachment is my input file, looking forwarding your reply !

On Monday, April 18, 2016 at 9:57:30 PM UTC+8, Renger van Nieuwkoop wrote:

Hi ??

Without the possibility of running your code (as you didn't send the input files) or at least information from the listing file with the exact error message, I must have superpowers to give you an answer (but perhaps others are better in guessing ).

Cheers

Renger

Sent from my Samsung Note 4

-------- Original message --------

From: lkc...@163.com

Date: 4/18/2016 15:17 (GMT+01:00)

To: gamsworld

Subject: When solve Stackelberg problems with MPEC type, shows 1 error that "571 rows 599 columns 12094 non-zeroes 13372 nl-code 9947 nl-non-zeros "

Help:

When I using GAMS to solve an Economic phenomenon based on Stacklberg Modle, once I operate the system ,some error occurs, the information shows in the below picture:

Below is the whole program:

set i (*)

j (*);

$load i j

parameters

t(i,j) unit transport cost

c(j) unit product cost

sl(i) supply limit

da(j) demand constant a

db(j) demand constant b

dl(j) demand limit;

$load t c sl da db dl

$ gdxin

display i,j,t,c,sl,da,db,dl;

set leader(i) /6/;

positive variables

ps(i) supply price

pd(j) demand price

x(i,j) traffic volume between supply i to demand j;

variable benefitleader leader's benefit;

equations

profit_leader leader's profit

profit_follwer(i,j) follower's profit

sb(i) supply balance

deb(j) demand balance;

alias (i,ii);

x.lo(i,j)=0.01;

deb(j).. sum(i,x(i,j))=g=dl(j);

sb(i).. sl(i)=g=sum(j,x(i,j));

profit_follwer(i,j)$(not leader(i)).. t(i,j)+c(j)+ps(i)-pd(j)-exp(da(j))*sum(ii,x(ii,j))**db(j)=g=0;

profit_leader.. benefitleader =e=sum((i,j)$leader(i),exp(da(j))*sum(ii,x(i,j))**db(j)*x(i,j)-c(j)*x(i,j)-t(i,j)*x(i,j));

model sitanboge /sb.ps,deb.pd,profit_follwer.x,profit_leader/;

solve sitanboge using mpec max benefitleader;

option NLP=conopt;

display x.l,ps.l,pd.l;

Parameter report1(i,*) supply summary report

report2(j,*) demand summary report ;

report1(i,"supply") = sum(j,x.l(i,j)); report1(i,"capacity") = sl(i); report1(i,"prices") = ps.l(i);

report2(j,"demandl") = dl(j);report2(j,"demand")=sum(i,x.l(i,j)); report2(j,"priced") = pd.l(j);

Display report1,report2, x.l;

Sincerely ask for a solution to solve this problem !!!!

Many Many Thanks !!!!!!

--

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 https://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 https://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 https://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 https://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 https://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 https://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 https://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.