Search found 1048 matches

by bussieck
12 hours ago
Forum: Syntax
Topic: sum with different values
Replies: 1
Views: 118

Re: sum with different values

Here is a working minimal example. Hope this helps. -Michael set i 'departments' / i1*i5 / j '8 hour slice' / j1*j8 / t 'one week in hours' / t1*t168 /; parameter d(i,t) 'demand'; d(i,t) = UniformInt(1,10); parameter d8(i,t) 'demand for the next 8 hours'; d8(i,t) = sum(j, d(i,t++(ord(j)-1))); displa...
by bussieck
3 days ago
Forum: Solvers
Topic: GAMS to Mosel syntax
Replies: 1
Views: 218

Re: GAMS to Mosel syntax

I am not aware of a GAMS to Mosel converter. Moreover, the Convert options AMPL etc will translate a model instance (the outcome of a GAMS "solve" statement). not an entire GAMS model. If you have an LP/QP/MIP model instance, you can just export this in the MPS format (via convert) and giv...
by bussieck
4 days ago
Forum: Tools
Topic: Assinging values within a table to a parameter
Replies: 1
Views: 157

Re: Assinging values within a table to a parameter

The documentation about $load (see https://www.gams.com/latest/docs/UG_Dol ... DOLLARload) should help. In your case you need to load Data1 as g:

Code: Select all

$GDXIN inputs.gdx
$LOAD g=Data1
$gdxIn
-Michael
by bussieck
5 days ago
Forum: Modeling
Topic: Nonlinear Programming/ Steiner Weber Modell with barriers
Replies: 3
Views: 1506

Re: Nonlinear Programming/ Steiner Weber Modell with barriers

GAMS has no simple user defined functions (only extrinsic function implemented in a shared library where you need to provide derivatives etc). Anyhow, you can define your function as a macro. Moreover, arcus sinus is called arcsin in GAMS not asin. I have made the changes for you in the attached mod...
by bussieck
1 week ago
Forum: Modeling
Topic: Can I use multithreading to run multiple iterative solves?
Replies: 1
Views: 600

Re: Can I use multithreading to run multiple iterative solves?

Correct, async solves (solveLink=3/6) won't help because you want to run some GAMS code in parallel. This can be done by running GAMS asynchronously. There is a complex example in the GAMS Model Library that shows how to do this: asyncloop (https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_asyn...
by bussieck
2 weeks ago
Forum: Modeling
Topic: Error on finding max value in MIP
Replies: 1
Views: 936

Re: Error on finding max value in MIP

Hi, you need to reformulate this in a linear way. There is plenty of good literature out there that gives this type of reformulation tricks. I personally like the book Model Building in Mathematical Programming by HP Williams . Knowing the literature and understanding the basics helps you write good...
by bussieck
3 weeks ago
Forum: Modeling
Topic: How can I random the consecutive number?
Replies: 5
Views: 1503

Re: How can I random the consecutive number?

You can just check if no 1-sequence starts in r1 or ends in r10. If that's the case you just take first column or last column to be the start/end. -Michael set i /r1*r10/, j /c1*c6/, iter /1*3/; parameter rowstart, cnt, randval(i,j) Random values, randvalloop(iter, i,j) Store the random values; $set...
by bussieck
3 weeks ago
Forum: Tools
Topic: GDX MPS2GMS
Replies: 2
Views: 1232

Re: GDX MPS2GMS

MPS2GMS reads an MPS file and provides you with a pretty generic GMS file and the data (coefficients, bounds, rhs) in the GDX data. Hence, you can solve your MPS file abc.mps by running "mps2gms abc.mps" and afterwards "gams abc.gms".


Good luck,
-Michael
by bussieck
3 weeks ago
Forum: Syntax
Topic: BESS modeling Error 148 and 258 in obj function.
Replies: 1
Views: 1019

Re: BESS modeling Error 148 and 258 in obj function.

Hi, First the is a very nice formatting control to copy and paste code. Please use that. On the particular question. You have an objective variable obj(h,z), so for every h and z there is a variable and you ask the solver to optimize it. A solver can only optimize a single variable not h times z man...
by bussieck
3 weeks ago
Forum: Modeling
Topic: How can I random the consecutive number?
Replies: 5
Views: 1503

Re: How can I random the consecutive number?

Here is some GAMS code of what I think you want to accomplish. Not sure what the iter was about, but I create now iter many of such tables with random starting position of 4 consecutive ones in the columns: set i /r1*r10/, j /c1*c6/, iter /1*3/; parameter rowstart, cnt, randval(i,j) Random values, r...