Search found 11 matches

by shaparak
2 months ago
Forum: Syntax
Topic: correcting syntax of the constraint
Replies: 0
Views: 1040

correcting syntax of the constraint

Hello friends, I have defined a constraint, in which related SolEQUE is not correct. here is the constraint: Con35(busp,nodep) $ (conex(busp,nodep)) .. sum( (bus,node)$ (conex(bus,node) and bus.val<node.val ) , Inci(busp,nodep,bus,node)* (Pl(bus,node)) ) =l= 1; In which Inci is a parameter, Pl and P...
by shaparak
3 months ago
Forum: Modeling
Topic: use the loop index list to fix a variable
Replies: 2
Views: 1683

Re: use the loop index list to fix a variable

[/quote] Hi Shaparak, Not sure what you want to achieve, but you might want to free the attack variable again after the solve, that way the variable only is fixed for the index i it is currently looping over. Regards, GFA loop(i, attack.fx(i)=0; solve T maximizing o using mip; attack.lo(i) = -inf; a...
by shaparak
3 months ago
Forum: Modeling
Topic: use the loop index list to fix a variable
Replies: 2
Views: 1683

use the loop index list to fix a variable

Hello every one I want to use the loop index list to fix an element of a variable. I used this code: loop(i, attack.fx(i)=0; solve T maximizing o using mip; ); but the output is not exactly what I need. in every loop, it fixes some elements of attack variable up to i value. It means, in the last run...
by shaparak
5 months ago
Forum: API
Topic: Import a parameter from GDX file
Replies: 3
Views: 1291

Re: Import a parameter from GDX file

dirkse wrote:
5 months ago
The GDX file is not so large. Perhaps you could attach it.

-Steve
it is a test model, Sir. I want to enter a large parameter
by shaparak
5 months ago
Forum: API
Topic: Import a parameter from GDX file
Replies: 3
Views: 1291

Re: Import a parameter from GDX file

I do not know why this post is not shown in recent posts! could anyone help me with this, please?
by shaparak
5 months ago
Forum: API
Topic: Import a parameter from GDX file
Replies: 3
Views: 1291

Import a parameter from GDX file

Hello I am trying to import a parameter through MATLAB within a GDX file. $GDXIN 'data.gdx' Set bus / 1*14 / slack(bus) / 1 / parameter Inc(*,*); $load Inc $GDXIN I get the error (error 492): Symbol not in GDX While I have a parameter named Inc in data.gdx file as shown below. image.png what is wron...
by shaparak
6 months ago
Forum: Syntax
Topic: limiting number of nonzero elements of a variable
Replies: 4
Views: 903

Re: limiting number of nonzero elements of a variable

Two issues. Even if you define a binary variable using $(binary_variable eq 0) is not allowed. Second, if you have defined binary variables, you should then be using a MIP or MINLP solver instead of an NLP solver. Hope this helps. If none of the above two issues are relevant, provide exact constrai...
by shaparak
6 months ago
Forum: Syntax
Topic: limiting number of nonzero elements of a variable
Replies: 4
Views: 903

Re: limiting number of nonzero elements of a variable

Optimization programs are not sequentially executed as your usual codes. Therefore when you say attack(bus)=0, it makes no sense to the program because attack(bus) does not have any value until it is solved. With such a condition, it is not possible to create defined equation blocks beforehand that...
by shaparak
6 months ago
Forum: Syntax
Topic: limiting number of nonzero elements of a variable
Replies: 4
Views: 903

limiting number of nonzero elements of a variable

Hello I want to add a constraint that says the number of nonzero elements of a variable couldn't be more than a certain value. So following constraints passed through my mind (By defining an extra variable counting nonzero elements of a variable called "attack"): Con20(bus).. nonzero(bus) $ (attack(...
by shaparak
6 months ago
Forum: Syntax
Topic: two conditional statement in a summation
Replies: 2
Views: 590

Re: two conditional statement in a summation

what do you want to achieve with node > bus? Are these sets with numerical values? You can consider using ord(node) > ord(bus) or node.val > bus.val ord() gives position of the element .val understands that the set element is a number and uses that value. Hope this helps. - Atharv Thank you! The er...