Search found 54 matches

by GabrielYin
11 months ago
Forum: Syntax
Topic: Continued Equality for Condition
Replies: 3
Views: 1015

Continued Equality for Condition

Hi all, Long time no see! I have one question about the implementation of continued equality for a break condition of my algorithm. I want to achieve the following pseudocode: If: a(1) = a(2) = a(3) = ... = a(n), then Break; else: Continue; In a GAMS code manner: loop(n, ... break$(a(1)=a(2) and a(1...
by GabrielYin
1 year ago
Forum: Modeling
Topic: fixing binary variable
Replies: 1
Views: 367

Re: fixing binary variable

The former one is simple and efficient. I never use the latter method to do this so I do not know which one performs better w.r.t. running time. But the former one is simply good and easy to implement. Execution time of the solver might not be influenced with how you define the variable. But the lat...
by GabrielYin
1 year ago
Forum: Modeling
Topic: Generate Equation and Column Listing without solving
Replies: 3
Views: 444

Re: Generate Equation and Column Listing without solving

I'm also interesting in this issue :idea: After checking the documentation, I know that 'solve' statement takes the role of importing and generating all the equations and columns in the predefined model ( https://www.gams.com/latest/docs/UG_GAMSOutput.html#UG_GAMSOutput_TheEquationListing ). Thus an...
by GabrielYin
1 year ago
Forum: Modeling
Topic: HELP! Augmenting master problem with cuts: GAMS does not permit conditional equations
Replies: 5
Views: 466

Re: HELP! Augmenting master problem with cuts: GAMS does not permit conditional equations

I can't understand. As you say, the 3rd iteration constraint "2.5 <= x <= 8" will be added iff z result in the 2nd iteration is <= 1, but z reaches its optimum 2 in 2nd iteration. So the constraint will not be triggered. You can observe the Equation list in .lst file to check the constraints appear...
by GabrielYin
1 year ago
Forum: Modeling
Topic: HELP! Augmenting master problem with cuts: GAMS does not permit conditional equations
Replies: 5
Views: 466

Re: HELP! Augmenting master problem with cuts: GAMS does not permit conditional equations

I can't understand. As you say, the 3rd iteration constraint "2.5 <= x <= 8" will be added iff z result in the 2nd iteration is <= 1, but z reaches its optimum 2 in 2nd iteration. So the constraint will not be triggered. You can observe the Equation list in .lst file to check the constraints appeare...
by GabrielYin
1 year ago
Forum: Modeling
Topic: HELP! Augmenting master problem with cuts: GAMS does not permit conditional equations
Replies: 5
Views: 466

Re: Augmenting master problem with cuts: GAMS does not permit conditional equations

Hi Anby, First of all, your model is apparently infeasible because you have w <= 22 and w >= 26, which is contradictory. Then the way you add your constraint is weird. But it is still doable in GAMS. I have written the code for you, which shows integer infeasible. Positive Variable x; Integer Variab...
by GabrielYin
1 year ago
Forum: Syntax
Topic: How to keep it compact
Replies: 1
Views: 373

Re: How to keep it compact

Hi, If you only need to reduce the times you write the term "Parameter", it is very easy: Parameter AH Maximum absolute humidity in hood in g water.(kg dry air)-1 l(c) latent heat for the steam condensation at pr(c) in kJ.kg-1; l(c)= 1.6807*pr(c)*pr(c)-40.975*pr(c)+2270.9 ; AH = 4.8101*exp(0.0577*dp...
by GabrielYin
1 year ago
Forum: Modeling
Topic: Altering the standard transportation problem
Replies: 3
Views: 459

Re: Altering the standard transportation problem

Suggest you to post your code which others can run, either using BBcode or attachment :) Then we are more convenient and comprehensive to help you!

Best,
Gabriel
by GabrielYin
1 year ago
Forum: Syntax
Topic: binary variable fixed value for 1 place - solution searched
Replies: 1
Views: 356

Re: binary variable fixed value for 1 place - solution searched

solution is simple

Code: Select all

ow.fx('w1') = 1;
Suggest you to search relevant documentation first when encountering problem :)

Cheers.
Gabriel
by GabrielYin
1 year ago
Forum: Modeling
Topic: how to use a loop statement into dynamic recursive model?
Replies: 2
Views: 481

Re: how to use a loop statement into dynamic recursive model?

Hi Rodrigue, To store/use values in each loop, I recommend two alternatives. 1. Define a global parameter to store the value and update it in each iteration. An illustrative example is shown below. Set k /1*100/; Parameter store(n); store(n) = *something initial*; loop(k, param(n) = store(n); * para...