## Search found 16 matches

- 9 months ago
- Forum: Syntax
- Topic: Record optimality gap at different CPU times
- Replies:
**1** - Views:
**398**

### Record optimality gap at different CPU times

Dear experts, Suppose a hard constraint mathematical model that could be solved by the CPLEX solver. I want to automatically record the optimality gap at different CPU times, e.g., 5 secs, 10 secs, 30 secs and 60 secs. What is the syntax that I can use to record the above information? If you need mo...

- 1 year ago
- Forum: Tools
- Topic: Exit code = 6 / Unable to open output file
- Replies:
**1** - Views:
**650**

### 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...

- 1 year ago
- Forum: Tools
- Topic: Generate an array of random numbers
- Replies:
**6** - Views:
**941**

### 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.

- 1 year ago
- Forum: Tools
- Topic: Generate an array of random numbers
- Replies:
**6** - Views:
**941**

### 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...

- 2 years ago
- Forum: Modeling
- Topic: Division by zero for division of two continuous variables
- Replies:
**4** - Views:
**931**

### 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...

- 2 years ago
- Forum: Modeling
- Topic: Division by zero for division of two continuous variables
- Replies:
**4** - Views:
**931**

### 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 (...

- 2 years ago
- Forum: Modeling
- Topic: Division by zero for division of two continuous variables
- Replies:
**4** - Views:
**931**

### 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...

- 2 years ago
- Forum: Syntax
- Topic: How can I force GAMS to compile this code in its written order?
- Replies:
**4** - Views:
**1059**

### 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...

- 2 years ago
- Forum: Syntax
- Topic: How can I force GAMS to compile this code in its written order?
- Replies:
**4** - Views:
**1059**

### 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 ...

- 2 years ago
- Forum: Modeling
- Topic: Why does GAMS change binary variables to positive ones in a loop?
- Replies:
**2** - Views:
**781**

### 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...