Wegner, I tried what you suggested above but it did not work with me, may be I have growth factor in my equation and later i have to discount it. I will appreciate if u can also guide me…i checked fifty times, and had the calculations before and now i touched and changed somethiung but gives an error…thanksss

I have the followings

Sets

t years /1991*1997/

e set of all goods /good1, good2, good3, good4, good5/

f inputs /sugar,salt,spice/

alias (t,tt);

table u(e,f) unit cost per mwh

sugar salt spice

good1 0.206 0 0

good2 0.213 0 0

good3 0 0.220 0

good4 0 0 0.145

good5 0 0 0.180;

parameter p(e) annual percent increase in unit consumption

/ good1 0.01

good2 0.01

good3 0.02

good4 0.02

good5 0.02/;

table ip(f,t) input prices annual prices

1991 1992 1993 1994 1995 1996 1997

sugar 100 110 120 125 130 130 130

salt 200 210 220 230 240 240 250

spice 150 160 160 160 160 160 160;

scalars

r “interest rate” /0.10/;

parameter mc(e,t) marginal cost of units of goods plants ;

mc (e,t)= (u(e,f)*(1+p(e))*ip(f,t))**(9-ord(t)-1)/((1+r)**ord(t))

in the end it says uncontrolled set as a constant.

On Monday, November 3, 2014 12:10:04 PM UTC, wegner.jn wrote:

The time of happiness is over The solution is working for 2 of 3 problems. Then GAMS returns the following statement for the new formula DifOptM(u) … s(u) =e= sum((i,j), w(i)*x(i,j)$o(u,j)) :

Implied bounds make row ‘DifOptM(10)’ infeasible.

Presolve time = 0.02 sec. (19.01 ticks)

…

MIP status (103): integer infeasible

Cplex Time: 0.02sec (det. 19.15 ticks)

CPLEX Error 1217: No solution exists.

Problem is integer infeasible.

Do you have an idea why it works but not for one problem?

Thanks a lot

Jan

On Wednesday, October 29, 2014 2:28:34 PM UTC+1, wegner.jn wrote:

Oh yeah!! That’s what I was looking for!! It’s running now!! Thanks a lot for your help, Renger!!

On Wednesday, October 29, 2014 11:38:41 AM UTC+1, Renger van Nieuwkoop wrote:

(Closing parenthesis still missing)

How about this: sum((i,j), w(i)*x(i,j)$o(u,j)) on the LHS, this sums x(i,j) such that j in O(u,j).

Cheers

Renger

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of wegner.jn

Sent: Wednesday, October 29, 2014 11:18 AM

To: gams...@googlegroups.com

Subject: Re: NEED HELP on set of sets

Ok, here you go:

Equations

MaxMPair(u,j) Max. mass of a pair of positions u

DifOptM(u,j) Difference of the mass of all pallets i on the positions j which belong to a pair of positions u from the optimum mass of the pair of positions u

;

MaxMPair(u,j) … sum((O(u,j),i), w(i)*x(i,j) =l= p(u) ; (p(u) is the max. possible mass of a pair of positions u)

DifOptM(u,j) … s(u) =e= sum((O(u,j),i), w(i)*x(i,j)) - o(u) ; (o(u) is the optimum mass of a pair of positions u)

Jan

On Wednesday, October 29, 2014 11:04:07 AM UTC+1, Renger van Nieuwkoop wrote:

It is still not clear to me what you want to express: Is this equation for every u and do you want to sum just the left part of the equation (there is a summing parenthesis missing).

You canâ€™t sum over u,i, and j if you have o(u) and s(u) on the RHS. In that case you should sum over u on the RHS.

Can you write down the equation as you intend

For example:

Equation

pair(u);

Pair(u)…

Sum((O(u,j), w(i)*x(i,j)) =E= o(u) + s(u); ??

Renger

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of wegner.jn

Sent: Wednesday, October 29, 2014 10:13 AM

To: gams...@googlegroups.com

Subject: Re: NEED HELP on set of sets

Hi Renger,

yes, you are right. My function is a little confusing. ‘=’ means of course ‘=e=’:

sum((O(u,j), i), w(i)*x(i,j) =e= o(u) + s(u)

What I want to do is:

I want to sum over u (of j) and i. w(i) ist the mass of a palet and x(i,j) just tells me if a palett i is on a position j. That equals the optimum mass of a pair of positions u (consisting of j’s, which are single positions) plus the deviation of the mass of of the paletts on the positions j (which belong to a pair of positions u) from the optimum mass on the specific pair of positions.

Is it possible to sum over O(u,j) and i?

Thanks a lot for your help

Jan

On Wednesday, October 29, 2014 9:53:02 AM UTC+1, Renger van Nieuwkoop wrote:

Hi Jan

You have to define O(u,j) as set (mapping).

I donâ€™t know what you are trying to do here: â€œsum((O(u,j), i), w(i)*x(i,j) = o(u) + s(u)â€. Is this an equation with variables, what do you want to sum? Do you want to sum over the â€œ=â€ sign?

Here is code that probably is not doing what you want it to do, but perhaps it helps you to implement what you want to do.

set

j /1,2,3,4,5/,

u(j) /1,2,3/,

O(u,j)

/ 1.(1,2)

2.(3,4)

3.5 /,

i /1,2/;

parameter w(i), x(i,j), op(u), s(u);

** Some dummy initialization:

w(i) = 1;

x(i,j) = 1;

op(u) = 1;

s(u) = 1;

parameter ps;

ps = sum((O(u,j), i), w(i)*x(i,j) - op(u) - s(u));

display ps;

Hopes this helps anyway.

Renger

\

Modelworks

Gewerbestrasse 15

3600 Thun â€“ Switzerland

+41 79 818 53 73

In…@modelworks.ch

## blog.modelworks.ch

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of wegner.jn

Sent: Wednesday, October 29, 2014 8:06 AM

To: gams...@googlegroups.com

Subject: NEED HELP on set of sets

Hi,

I am new in the GAMS world and trying to solve the following problem. I tried a lot of things but nothing worked - so I hope you can help me!

I have a set j /1*39/ [j element of P]. Now I am introducing a new set u /1*27/ which consists of elements of set j [u]. Therefore u is a subset of j:

u=1 consists of j=1 and j=2

u=2 consists of j=3 and j=4

…

u=27 consists od j=39

That was my last approach:

parameters:

O(u,j)

/ 1.(1,2)

2.(3,4)

…

27.39 /

Then there is a sum-function where I want to sum over u or more specifically the j’s belonging to each u: sum((j Element P(u), i), w(i)*x(i,j) = o(u) + s(u)

So my approach was this one:

sum((O(u,j), i), w(i)*x(i,j) = o(u) + s(u)

It’s not working - why? Please help me!!

Thanks a lot in advance!

Jan

\

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.

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