Search found 13 matches

by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

Re: How to loop the matrix

Thank you very much, Renger. There is a problem now, the result it displays will follow the EX1display(only ns1 to ns4 of ex1 is infeasible) , and the subsequent EX3 to EX7 will not be displayed. ns1 to ns4 from ex3 to ex7 do not display minc1. (ex1 to ex7 are 7 different data that do not interfere ...
by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

Re: How to loop the matrix

Sorry, Renger. Bad things. Still Different dimensions at two codes. :cry: ************************************************ results(loopnr, "minc1",heatx)$(loopnr.val = loopcount) = c1.l(heatx); results(loopnr, "nsl",heatx)$(loopnr.val = loopcount) = bestns1(heatx); **************...
by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

Re: How to loop the matrix

Sorry, Still Different dimensions at two codes. Are c1.l and bestns1 problem? I don't know. :cry: ************************************************ results(loopnr, "Mincl")$(loopnr.val = loopcount) = c1.l; results(loopnr, "nsl")$(loopnr.val = loopcount) = bestns1; ***************...
by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

Re: How to loop the matrix

Sorry, It says Different dimensions. The following two codes: ************************************************ results(loopnr, "Mincl")$(loopnr.val = loopcount) = c1.l; results(loopnr, "nsl")$(loopnr.val = loopcount) = bestns1; ************************************************ set...
by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

Re: How to loop the matrix

I am very sorry, my degree is not good. Is it convenient to enter the complete code? Thank you very much for guiding me very patiently, Renger. Untitled_8.gms parameters minc1 bestns1 sumz1 sumc1 ; bestns1(heatx)$(r(heatx) ne 1)=1; minc1(heatx)$(r(heatx) ne 1)=inf; sumz1=sum(heatx,minc1(heatx)); sum...
by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

Re: How to loop the matrix

Renger, Thank you again. I am missing a small piece of code and it can converge. If I want to find the best value in these loop ranges, how should I modify my IF sentence? Because it is showing the answer is the maximum value of the loop 10. the full file. Untitled_8.gms This is sets code parameters...
by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

Re: How to loop the matrix

My problem is the first one, let it stop the loop before 10, and find the best answer among them. Untitled_8.gms I use this code. but the model is run forever. parameters minc1 bestns1 mc1 cc1 ; bestns1(heatx)$(r(heatx) ne 1)=1; minc1(heatx)$(r(heatx) ne 1)=inf; mc1=sum(heatx,minc1(heatx)); cc1=sum(...
by LiangYu
5 years ago
Forum: Syntax
Topic: How to loop the matrix
Replies: 14
Views: 8323

How to loop the matrix

Dear All. About a few days ago, I asked a similar question. I used to ask the scalar loop(Thanks Mr. Michael solve this problem), now I have problems when it becomes a matrix. This is a scalar solution. Untitled_9.gms The key code is this paragraph scalar minc1 /inf/, bestns1 /1/,n1; while(bestns1 <...
by LiangYu
5 years ago
Forum: Syntax
Topic: use loop about gradually plus one
Replies: 8
Views: 6556

Re: use loop about gradually plus one

Sorry, Can I ask another question further? I think this is the last question. About turn scalar into a matrix. This is the result of my direct optimization.(The first set of data answers are the same as the original) Untitled_6.gms If I want to use the same way of the loop, how to change to the same...
by LiangYu
5 years ago
Forum: Syntax
Topic: use loop about gradually plus one
Replies: 8
Views: 6556

Re: use loop about gradually plus one

Thank you, Michael. :) I try to change your command slightly and use the while command. Like this: scalar minc1 /inf/; scalar ns1cnt; ft1.lo=0; ft1.up=1; ft1.l = 0.5; while(ns1.l<10, ns1.fx=ns1.l+1; solve exchanger1 using minlp minimizing c1; if ((exchanger1.modelstat=1 or exchanger1.modelstat=8) an...