Search found 373 matches

by Fred
3 years ago
Forum: Modeling
Topic: Modelling index operations in parameter subscript
Replies: 2
Views: 2808

Re: Modelling index operations in parameter subscript

Hi Patrick, aa and bb are sets (or aliases). Set elements are strings (even if you use numbers). Hence, something like Occ_Fac(k,x+aa-1,y+bb-1) is not possible. Maybe the ord operator or the .val attribute is useful for you. In general, helping becomes easier if you share code that can be executed t...
by Fred
3 years ago
Forum: Modeling
Topic: Conditional variables
Replies: 4
Views: 3578

Re: Conditional variables

For example, the solver might run into numerical difficulties.

Best,
Fred
by Fred
3 years ago
Forum: Modeling
Topic: Conditional variables
Replies: 4
Views: 3578

Re: Conditional variables

Hi, you could use a big M formulation and change your model as follows: $eolcom // set y year /0*10/ parameter a(y) / 1 -5.5 2 -16.5 3 -20.5 4*10 30.5 / display a; scalar bigM /100/; free variable b obj fake objective; negative variable c ; positive variable d ; binary variable e ; equation eq1 eq2 ...
by Fred
3 years ago
Forum: Modeling
Topic: Problem with set declaration
Replies: 4
Views: 2950

Re: Problem with set declaration

Hi,

The documentation on subsets might be helpful.

Best,
Fred
by Fred
3 years ago
Forum: Modeling
Topic: Assign previous iteration result to starting value of next iteration
Replies: 3
Views: 3648

Re: Assign previous iteration result to starting value of next iteration

If I understand correctly what you try to do, you could just write

Code: Select all

[...]
if(ord(it)=1,
  R.fx('s1')=4;
  Q.fx('s1')=4;
else
  R.fx('s1') = R.l('s3');
  Q.fx('s1') = R.l('s3');
);

Solve rolling using LP minimizing cost;
[...]
I hope this helps!

Fred
by Fred
3 years ago
Forum: Syntax
Topic: gdxxrw command not found
Replies: 1
Views: 3868

Re: gdxxrw command not found

Hi, GDXXRW is a Windows only tool (see tools/platform matrix ). The reason is that the Excel program on the Mac lacks the OLE interface, so the approach gdxxrw uses under windows is not possible on Mac. Workarounds could be to create the GDX under Windows and bring it to the MAC or to export Excel d...
by Fred
3 years ago
Forum: Syntax
Topic: Clear variables and parameters to perform a loop
Replies: 2
Views: 3557

Re: Clear variables and parameters to perform a loop

Hi, It is hard to guess why you experience problems with your code without being able to reproduce such problems. In general, if you solve a MIP to optimality (i.e. you have to set the termination criterion accordingly, e.g. optcr=0 ), the objective function value should be the same. The solution ca...
by Fred
3 years ago
Forum: Syntax
Topic: Problem loading parameters
Replies: 2
Views: 3034

Re: Problem loading parameters

Hi, The parameters you are trying to load have domain sets. You need to make sure that those domain sets are known. There are different ways how to do that. I don't know where data of the sets INTERVAL, GEN, MG_GEN comes from in your case. If those sets can be defined through the same gdx files, you...
by Fred
3 years ago
Forum: Modeling
Topic: Assign previous iteration result to starting value of next iteration
Replies: 3
Views: 3648

Re: Assign previous iteration result to starting value of next iteration

Hi, You can see in the column listing column listing that R(s1) and Q(s1) are fixed to 4 for the first iteration which seems to be intended. For subsequent iterations you do if (ord(it)>1, R.fx(s)$(ord(s)=1)=R.l(s)$(ord(s)=ch and ord(it)=ord(it)-1); Q.fx(s)$(ord(s)=1)=Q.l(s)$(ord(s)=ch and ord(it)=o...
by Fred
3 years ago
Forum: Modeling
Topic: Different indexing for same variable
Replies: 7
Views: 4456

Re: Different indexing for same variable

Hi,

What about

Code: Select all

set p      plants / Oil, gas, coal, nuclear /
    p1(p)         / Oil, gas, coal /
    p2(p)         / nuclear /
;
When you need to refer to all of them, use p.
When you need to refer to Oil, gas, coal, use p1.
When you need to refer to nuclear, use p2.

Fred