Search found 11 matches
- 2 years ago
- Forum: Syntax
- Topic: correcting syntax of the constraint
- Replies: 0
- Views: 4642
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...
- 2 years ago
- Forum: Modeling
- Topic: use the loop index list to fix a variable
- Replies: 2
- Views: 3582
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...
- 2 years ago
- Forum: Modeling
- Topic: use the loop index list to fix a variable
- Replies: 2
- Views: 3582
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...
- 2 years ago
- Forum: API
- Topic: Import a parameter from GDX file
- Replies: 3
- Views: 5284
- 2 years ago
- Forum: API
- Topic: Import a parameter from GDX file
- Replies: 3
- Views: 5284
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?
- 2 years ago
- Forum: API
- Topic: Import a parameter from GDX file
- Replies: 3
- Views: 5284
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...
- 2 years ago
- Forum: Syntax
- Topic: limiting number of nonzero elements of a variable
- Replies: 4
- Views: 3265
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...
- 2 years ago
- Forum: Syntax
- Topic: limiting number of nonzero elements of a variable
- Replies: 4
- Views: 3265
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...
- 2 years ago
- Forum: Syntax
- Topic: limiting number of nonzero elements of a variable
- Replies: 4
- Views: 3265
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) ...
- 2 years ago
- Forum: Syntax
- Topic: two conditional statement in a summation
- Replies: 2
- Views: 2485
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...