## Search found 14 matches

3 months ago
Forum: Tools
Topic: urgent: Unable to open gdx file for \$GDXIN
Replies: 1
Views: 803

### urgent: Unable to open gdx file for \$GDXIN

When I do run my code in GAMS Studio I get this error. (When I do run it on GAMS IDE it doesn't appear) *** GDXIN failed C:\Users\ .... \j10 Instanz %InstanzNr%.gdx *** Msg: No such file or directory I have two parts of the model, the first one is: set InstanzNr / 001*050/; loop(InstanzNr, put_utili...
3 months ago
Forum: Modeling
Topic: Sum of a decision variable within an equation
Replies: 2
Views: 1297

### Re: Sum of a decision variable within an equation

I decided to use a binary variable instead, because I couldn't find another solution.

z(s)=sum(zue, bV(s,zue) * zue(s))
with bV(s)=1 if zue has a value, bV(s)=0 else
and with zue > 0, which presents the value

therefore the sum in the equation is

Code: Select all

``sum(s, bV(s));``
4 months ago
Forum: Modeling
Topic: Sum of a decision variable within an equation
Replies: 2
Views: 1297

### Sum of a decision variable within an equation

I need the number of z(s)>0 in "equation". But z(s) is a variable and is also part in other equations of the same model. My first idea was the following (shorter version): Equation .. sum( (s)\$(z(s) > 0 ) ,1) =l= card(VN); But it leads to an error: 57 VAR operands relational or boolean Is it possibl...
4 months ago
Forum: Syntax
Topic: loop - with "if current set element" inside
Replies: 1
Views: 282

### loop - with "if current set element" inside

Hi,

I want to loop the set Abs. The if function should do some statements, if the current set element is "Basis1".
What´s the Synatx for this?

Code: Select all

``````set Abs / "Basis1", "Basis2" /;

loop (Abs,

if       ([b]HOW TO DO THE SYNTAX?[/b],
... ;
);
...
);
``````
Thank you very much!
5 months ago
Forum: Syntax
Topic: Path with variable inside
Replies: 5
Views: 484

### Re: Path with variable inside

Thank you very much! I do have some questions about the code you wrote. 1) The %gams.lo% in lo=%gams.lo%. What does it do? 2) Are my changes correct? I insert i.tl instead of t.tl and "fn=" infront of the path. 3) Do I have to declare fn somewhere? * The scenario driver set i / 001*100 /; loop(i, pu...
5 months ago
Forum: Modeling
Topic: Checking if an element is part of a set
Replies: 2
Views: 345

### Re: Checking if an element is part of a set

Thank you very much!

I tried, among others, the syntax if(i\$sp(i), ...

I didn´t knew that it just has to be if(sp(i),..., when i is allready a fixed value because of the loop.
5 months ago
Forum: Modeling
Topic: Checking if an element is part of a set
Replies: 2
Views: 345

### Checking if an element is part of a set

I want to check if an set element is part of another set. I wrote it here into the code as a bold highlighted text, to show where the code should be. I tried some different things, but none worked. Does one of you have an idea how it could work? Notice that the set "bearbeitet" is a dynamic set and ...
5 months ago
Forum: Syntax
Topic: Set declatation with scalar inside
Replies: 3
Views: 323

### Re: Set declatation with scalar inside

So do I understand correctly that if t_max has to be calculated, it´s not possible to use it for the defintion of the set t?

That´s my current (not working) code:

Code: Select all

``````Dmax=sum(i,d(i));

scalar   t_max;

t_max= Dmax+10  ;

set       t    / 0*t_max /  ;
``````
5 months ago
Forum: Syntax
Topic: Path with variable inside
Replies: 5
Views: 484

### Re: Path with variable inside

The paths are needed for loading some data. The code should look like this, while the bold highlighted Nummer in the path should be instead the intN value for (intN=1 to 100, \$call gdxxrw "C:\Users\manue\Daten\i10 Instanz 001 .xlsm" Squeeze=N @C:\Users\manue\Daten\Index_det.txt \$gdxin "C:\Users\manu...
5 months ago
Forum: Syntax
Topic: Set declatation with scalar inside
Replies: 3
Views: 323

### Set declatation with scalar inside

Hi,

I would like to do something like this, with t_max as a scalar:

set t /0*t_max/ ;

The problem is that this doesn`t work in GAMS. Is there a syntax which I could use?