## Search found 439 matches

5 days ago
Forum: Syntax
Topic: creation of vectors from normal distribution
Replies: 3
Views: 85

### Re: creation of vectors from normal distribution

Hi You could search in this forum for Error 149 as strongly advised in the "Forum rules" ... 115 parameter a(i,j); 116 a(i,j)= normal(x(j,i),t(j,p)); or study the error message "149 Uncontrolled set entered as constant". You define a parameter over the sets i and j, but on the right-hand side you us...
5 days ago
Topic: two shock in two time in a loop
Replies: 1
Views: 42

### Re: two shock in two time in a loop

Hi You can loop over the whole horizon and change the parameters for the shocks. Here some example code: set t Periods /1*20/; set sc /BAU, SHOCK/; parameter parshock(sc,t) Shock some parameters parshock(sc,t) = 0; parshock("SHOCK",t)\$(t.val < 5) = 2; parshock("SHOCK",t)\$(t.val > 4) = 3; loop(sc, lo...
5 days ago
Forum: Modeling
Topic: adding more constraint to gams
Replies: 3
Views: 117

### Re: adding more constraint to gams

looks fine.
R
1 week ago
Forum: Solvers
Topic: Different results with zero optimality gap: MIP against SOS2
Replies: 2
Views: 144

### Re: Different results with zero optimality gap: MIP against SOS2

Hi
Perhaps your problem has multiple solutions? You could use the solution of the first method as starting point for the second and see if the second algorithm and see if this reproduces this first solution. (the same vice versa).
Cheers
Renger
1 week ago
Forum: Modeling
Topic: adding more constraint to gams
Replies: 3
Views: 117

### Re: adding more constraint to gams

Hi
You could just split the constraint in:

Code: Select all

``````upperb(x)..  1.3 * w(x)  =L=r(x);
lowerb(x)..   r(x) =L= 1.6 * w(x);
``````
Cheers
Renger
1 week ago
Forum: API
Topic: how to add fromula at parameter
Replies: 3
Views: 222

### Re: how to add fromula at parameter

Hi
You made your model non-linear as the variables C and X are multiplied with each other.
If you change your solve instruction into

Code: Select all

``````Solve struktura using NLP maximizing f;
``````
it solves nicely.
Cheers
Renger
1 week ago
Forum: API
Topic: how to add fromula at parameter
Replies: 3
Views: 222

### Re: how to add fromula at parameter

Hi I might be missing the point, but why don't you use the profit equation as described in your question? equation profit(j) Profit equation; c(j)=E= a('T1',j) - a('N1',j) - a('N2',j) If you paste code, please use the button "</>" in the editor. It will keep the formatting. Furthermore, without the ...
3 weeks ago
Forum: Syntax
Topic: execute_load all parameters with wildcard or similar
Replies: 1
Views: 953

### Re: execute_load all parameters with wildcard or similar

Hi THe only thing I can think of is starting the outer loop before the assignments of the default values. In your simple example: *set up all default data parameter x; loop(i, x = 0; loop(j, *manipulate parameters x=x+j Objective=E=f(i,j) solve model min Objective ) ) Cheers Renger
1 month ago
Forum: Syntax
Topic: Sum of the dynamic set
Replies: 2
Views: 184

### Re: Sum of the dynamic set

Hi Sue
Could you write out examples of the equation you want in point 1. It is not clear to me.
Point 2: You could use a set defining which elements you don't want (e.g. set src(nt) /n3/; and write the equation q4(nt)\$(not src(nt)).

Cheers
Renger
1 month ago
Forum: Syntax
Topic: Sum of Rows = Sum of Columns
Replies: 5
Views: 309

### Re: Sum of Rows = Sum of Columns

Hi
The problem is that you use both i and j in two different ways: as an index for the equation and as summation index.
You need an alias:

Code: Select all

``````alias(i,ai), (j,aj);
eq6(i,j).. sum(ai, Q(ai,j)) =e= sum(aj, Q(i,aj));
``````
This resolves the confusion on what to do with "i" and "j".
Cheers
Renger