Search found 15 matches

by moosavi_69
1 month ago
Forum: Tools
Topic: Exit code = 6 / Unable to open output file
Replies: 1
Views: 138

Exit code = 6 / Unable to open output file

Dear friends, I am solving a multi-echelon supply chain problem with the Benders Decomposition algorithm. When the problem becomes large, I confront with an error shown in the following. http://uupload.ir/files/lr8n_untitled.png To reduce the size of lst file, I have used two below options: Option l...
by moosavi_69
2 months ago
Forum: Tools
Topic: Generate an array of random numbers
Replies: 6
Views: 260

Re: Generate an array of random numbers

You are right. Unfortunately, the compact method of Mr. dirkse does not always work properly. The suggested method by Mr. Manassaldi works perfectly. Thanks.
by moosavi_69
2 months ago
Forum: Tools
Topic: Generate an array of random numbers
Replies: 6
Views: 260

Generate an array of random numbers

Dear Friends, I have defined set W and parameter Coef(W) as follows: Set W /1*10/; Parameter Coef(W); I would like to randomly assign binary values to Coef(W) ; where about %A of elements in W get 1, and %(100-A) of them get 0. For instance, if A is equal to 70, therefore, Coef(W) could be one of th...
by moosavi_69
1 year ago
Forum: Modeling
Topic: Division by zero for division of two continuous variables
Replies: 4
Views: 503

Re: Division by zero for division of two continuous variables

I also found another solution to this problem, specifically for the Baron solver. If you add the following code, the Baron could ignore the error and try to find a feasible solution. I think there should be similar options for other solvers as well. But what you mentioned, is a solution for all solv...
by moosavi_69
1 year ago
Forum: Modeling
Topic: Division by zero for division of two continuous variables
Replies: 4
Views: 503

Re: Division by zero for division of two continuous variables

... I used a random initializiaton as you subtract x(j,t) from x(i,t) (same for y). Initializing them with the same values would results in zeros. ... Renger Hi Renger, First of all, I have to appreciate your attention. As per as your valuable comment, I have added the following lines to the code (...
by moosavi_69
1 year ago
Forum: Modeling
Topic: Division by zero for division of two continuous variables
Replies: 4
Views: 503

Division by zero for division of two continuous variables

Dear friends, I have coded a facility layout problem as a MINLP model. Then, I used Baron as the default solver. In this model, constraint 19b determines the maximum distance between whole departments (DmaxF, a positive variable). Then, this variable is used on the right-hand sides of constraints 22...
by moosavi_69
1 year ago
Forum: Syntax
Topic: How can I force GAMS to compile this code in its written order?
Replies: 4
Views: 603

Re: How can I force GAMS to compile this code in its written order?

Dear Claudio, First of all, I have to thank you very much for your time. In fact, I want the first display Z.l shows the value "a" and the second display Z.l shows the value of "b". For more clarification, pls look at the following code: $GDXIN Name1.gdx $LOAD Z *** the value of Z here is equal to a...
by moosavi_69
1 year ago
Forum: Syntax
Topic: How can I force GAMS to compile this code in its written order?
Replies: 4
Views: 603

How can I force GAMS to compile this code in its written order?

Dear friends, When I run the following code, GAMS does not compile this code in its written order. Could you pls help me out how I can force it to do so? $onmulti Variable Z; $GDXIN Name1.gdx $LOAD Z *** the value of Z here is equal to a*** $GDXIN Display Z.l; $GDXIN Name2.gdx $LOAD Z *** the value ...
by moosavi_69
1 year ago
Forum: Modeling
Topic: Why does GAMS change binary variables to positive ones in a loop?
Replies: 2
Views: 441

Why does GAMS change binary variables to positive ones in a loop?

Dear friends, I have coded a scheduling problem in GAMS using the Sample Average Approximation. This model is a MILP mathematical model. I have chosen Cplex as the solver for this problem. The code solves a problem in a loop for multiple times, and it fixes binary variables, i.e., xa, and xaa, in ea...
by moosavi_69
1 year ago
Forum: Syntax
Topic: How can I report and store the optimality status of solutions in the GAMS (in gdx files)?
Replies: 1
Views: 327

Re: How can I report and store the optimality status of solutions in the GAMS (in gdx files)?

I found the answer to this question. After solving a model, it saves its features in its attributes. For further details, interested readers can see the following link: https://www.gams.com/latest/docs/UG_ModelSolve.html#UG_ModelSolve_ModelAttributes For instance, if we want to optimize a model enti...