# 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 "

32 views

### lkc...@163.com

Apr 18, 2016, 9:17:17 AM4/18/16
to gamsworld
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 (*);
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;
positive variables
ps(i) supply price
pd(j) demand price
x(i,j) traffic volume between supply i to demand j;
equations
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));
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 !!!!!!

### Renger van Nieuwkoop

Apr 18, 2016, 9:57:30 AM4/18/16
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
--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
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.

### lkc...@163.com

Apr 18, 2016, 11:09:47 PM4/18/16
to gamsworld
Hi Renger;

sitanboge.xlsx

### Renger van Nieuwkoop

Apr 19, 2016, 9:19:20 AM4/19/16

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

### lk

Apr 20, 2016, 3:17:01 AM4/20/16
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 !

### Renger van Nieuwkoop

Apr 20, 2016, 4:01:08 AM4/20/16

Hi

I had to change the following line to:

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

### lk

Apr 21, 2016, 12:02:48 AM4/21/16
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...

Again thank you very much !!!!!

### Renger van Nieuwkoop

Apr 21, 2016, 5:32:28 AM4/21/16

THat would take too much of my time.

Sorry

### lk

Apr 21, 2016, 5:33:41 AM4/21/16
and it says infeassible solution..