Hi Maryam
Yuu can write the equation Y(i) as follows;
Y(I)… SUM (J , A(I,J) * P(J))=E=K(I)
Have a closer look at the first chapter of the Gams manual. Here you will see how to use an index in an equation.
There are still some mistakes in your model, but that is up to you.
Cheers
Renger
Von: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] Im Auftrag von Maryam Bodaghi
Gesendet: Montag, 1. April 2013 16:53
An: gamsworld@googlegroups.com
Betreff: Re: Different equation types
Dear Renger;
In my subject to part, I have 3 types equation. So I cant define them in equation.
my problem is as attached.
and my codes are as below:
SETS
J COSTS/C1C8/
I CONSTRAINTS/K1K14/;
PARAMETERS
K(I)
/K1 400
K2 250
K3 250
K4 230
K5 240
K6 250
K7 0
K8 160
K9 190
K10 0
K11 250
K12 230
K13 240
K14 250/
C(J)
/C1 2
C2 17
C3 20
C4 28
C5 0
C6 0
C7 0
C8 0/;
TABLE A(I,J)
C1 C2 C3 C4 C5 C6 C7 C8
K1 1 1 1 1 0 0 0 0
K2 0 0 0 0 1 1 1 1
K3 1 0 0 0 0 0 0 0
K4 0 1 0 0 0 0 0 0
K5 0 0 1 0 0 0 0 0
K6 0 0 0 1 0 0 0 0
K7 0 0 0 0 1 0 0 0
K8 0 0 0 0 0 1 0 0
K9 0 0 0 0 0 0 1 0
K10 0 0 0 0 0 0 0 1
K11 1 0 0 0 1 0 0 0
K12 0 1 0 0 0 1 0 0
K13 0 0 1 0 0 0 1 0
K14 0 0 0 1 0 0 0 1;
VARIABLES
PRICE
POSITIVE VARIABLES
P(J);
EQUATION
OBJECTIVE
Y(I);
OBJECTIVE… PRICE=E=SUM(J , C(J)*P(J));
Y(1)… SUM (J , A(1,J) * P(J))=E=K(1)
Y(2)… SUM (J , A(2,J)*P(J))=G=K(2)
Y(3)… SUM (J , A(3,J)*P(J))=L=K(3)
Y(4)… SUM (J , A(4,J)*P(J))=L=K(4)
Y(5)… SUM (J , A(5,J)*P(J))=L=K(5)
Y(6)… SUM (J , A(6,J)*P(J))=L=K(6)
Y(7)… SUM (J , A(7,J)*P(J))=E=K(7)
Y(8)… SUM (J , A(8,J)*P(J))=L=K(8)
Y(9)… SUM (J , A(9,J)*P(J))=L=K(9)
Y(10)… SUM (J , A(10,J)*P(J))=E=K(10)
Y(11)… SUM (J , A(11,J)*P(J))=L=K(11)
Y(12)… SUM (J , A(12,J)*P(J))=L=K(12)
Y(13)… SUM (J , A(13,J)*P(J))=L=K(13)
Y(14)… SUM (J , A(14,J)*P(J))=L=K(14);
MODEL TEST / ALL /;
SOLVE TEST USING MINIMIZING PRICE;
DISPLAY P.L ,P.M;
Regards
Maryam
On Mon, Apr 1, 2013 at 5:52 PM, Renger van Nieuwkoop wrote:
Hi ?
I can only repeat myself as it looks like you have missed all the advice below…
(Post from Deember 10th, 2012):
I get the impression that more and more questions in this mailing list are coming from “Microsoft usersâ€:
With that, I mean users who believe that a complex program like Excel or Gams can be mastered by just clicking around and that manuals are for Dummies.
So here some urgent advice before you post a question:
-
RTFM: Read the fucking manual from page 1 to the end (or at least chapter 1 with the introductory example)
-
If you still have a problem: Search the Mccarl User Guide.
-
If you still have a problem: Search the two mailing lists.
-
If you still have a problem: Try to solve your problem in a smaller, more manageable model (“Toy modelâ€).
-
If you still have a problem:
a. Formulate your question in a clear and concise way.
b. Add the code and if available the errors Gams reported.
c. Start your E-Mail with a greeting.
d. End it with your name.
Cheers
Renger van Nieuwkoop
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Maryam Bodaghi
Sent: Monday, April 1, 2013 2:40 PM
To: gamsworld@googlegroups.com
Subject: Different equation types
hello everyone;
I have different equation types( greater than, smaller than and equality) in may ‘’ subject to " part and I don’t know how to define them.
\
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.
\