Hi, everyone.
I want to express the row of a set in my code.for example, I get a multi-dimension set and I hope to write the row of the set.
I want to write the red part.
thank you so much
how to write the row of sets
-
- User
- Posts: 9
- Joined: 3 years ago
how to write the row of sets
Last edited by zhiping fan 3 years ago, edited 2 times in total.
Re: remove the duplicate item
Hi
Use the same logic for i and k for b(j,i,k):
Cheers
Renger
Use the same logic for i and k for b(j,i,k):
Code: Select all
b(j,i,k)$(ord(i) ne ord(k) .....)
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
-
- User
- Posts: 9
- Joined: 3 years ago
Re: remove the duplicate item
Hi,
Thank you so much for your help.
Maybe a misunderstand existing in my text, I try it as your advice, the correct answer is b(j,i,k)$(ord(i) = ord(k))=no;it can realize my target.
Due to I am a beginner and no experience in GAMS, I have other questions in my study.
How can realize the following aim. As a previous statement. I have declared the node and its parentnode and now I do not know how to control the sign 'B' in a general form or how to declare it. Thanks again.
regards
Thank you so much for your help.
Maybe a misunderstand existing in my text, I try it as your advice, the correct answer is b(j,i,k)$(ord(i) = ord(k))=no;it can realize my target.
Due to I am a beginner and no experience in GAMS, I have other questions in my study.
How can realize the following aim. As a previous statement. I have declared the node and its parentnode and now I do not know how to control the sign 'B' in a general form or how to declare it. Thanks again.
regards
-
- User
- Posts: 9
- Joined: 3 years ago
Re: remove the duplicate item
Hi, everyone.
The last email maybe has an error and I want to realize the following aim. But no idea in my mind. ,
how can I control the sign B.
thanks again.
The last email maybe has an error and I want to realize the following aim. But no idea in my mind. ,
how can I control the sign B.
thanks again.
-
- User
- Posts: 9
- Joined: 3 years ago
Re: remove the duplicate item
Hi,
Now I have a question about the row of sets.
I get a set-a like fig11, now I need to use the result of set a and set b, but how can I express the row of a and b?
I try it like fig14 but it is wrong, could you help me?
thanks.
Now I have a question about the row of sets.
I get a set-a like fig11, now I need to use the result of set a and set b, but how can I express the row of a and b?
I try it like fig14 but it is wrong, could you help me?
thanks.
Re: remove the duplicate item
Hi
From your question, it is not clear for me what you are trying to do. Please submit the code that produces the error and write what you want to achieve with your equation that produces an error.
Cheers
Renger
From your question, it is not clear for me what you are trying to do. Please submit the code that produces the error and write what you want to achieve with your equation that produces an error.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
-
- User
- Posts: 9
- Joined: 3 years ago
Re: remove the duplicate item
Hi Renger,
Thank you for your reply.
in my case, I want to express the relationship between the node and its parent nodes.
In previous work, I have got the matrix like fig 1.now I need to write the constraint between the node and its parent nodes, for example, in fig 1, I want to give the constraint of j and the element of j is {a,b,c,d,e}, and its parent node is B , its element is {a.b a.c a.d a.e b.c b.d b.e c.d c.e....}, I want to write the general constraint.
now I put B as a set, so when I express B, the error is listed as the attachments. regards
Thank you for your reply.
in my case, I want to express the relationship between the node and its parent nodes.
In previous work, I have got the matrix like fig 1.now I need to write the constraint between the node and its parent nodes, for example, in fig 1, I want to give the constraint of j and the element of j is {a,b,c,d,e}, and its parent node is B , its element is {a.b a.c a.d a.e b.c b.d b.e c.d c.e....}, I want to write the general constraint.
now I put B as a set, so when I express B, the error is listed as the attachments. regards
Re: remove the duplicate item
Hi
Your equation should read
Note, that you always should correct the first error that appears in your code and don't pay too much attention to the errors that follow as they are often caused by the first error. In your case, equation eqt is missing the "..".
Furthermore, it is easer for the person who wants to help you to provide the code that causes the error (instead of including screenshots). You can either attach a file or put the code in a code block (the </> symbol in the editor.
Cheers
Renger
Your equation should read
Code: Select all
cons10(j,n)..
a0(j,n) =G= 0;
Furthermore, it is easer for the person who wants to help you to provide the code that causes the error (instead of including screenshots). You can either attach a file or put the code in a code block (the </> symbol in the editor.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
-
- User
- Posts: 9
- Joined: 3 years ago
Re: remove the duplicate item
Hi Renger,
Thank you for your reply.
I try to modify the code as your advice, but the errors still exist.
Thank you for your reply.
I try to modify the code as your advice, but the errors still exist.
Re: remove the duplicate item
You have the same kind of problem in equation eqt: you use a lot of indices on the RHS, but z has no indices, nor has the equation itself. You should have the same number of dimensions/indices on both sides and in the equation name.
Examples
Cheers
Renger
Examples
Code: Select all
Eq1(j) z(j) =e= a(j)*f;
Code: Select all
Eq2.. p =e= sum(j, b(j));
Code: Select all
Eq3.. t =e= h("1");
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist