Search found 127 matches

by dirkse
1 month ago
Forum: Modeling
Topic: Problem with set declaration
Replies: 4
Views: 218

Re: Problem with set declaration

Rodrigue, If I understand correctly, you have a set of activities a1*a43, and these activities belong to one of the following 4 types: agr, ind, ser, sad. You want to make this assignment and use it. This is a very standard thing to do. You should use a multi-dimensional set as described here: https...
by dirkse
2 months ago
Forum: Modeling
Topic: Error 352
Replies: 5
Views: 756

Re: Error 352

Hello, Many of the compilation errors that occur have to do with syntax - e.g. using symbols that are not declared, declaring an EEEQUATION, etc. But during compilation GAMS also checks for logical errors that would occur during the execution of the GAMS source. That's was error 352 is: an indicatio...
by dirkse
2 months ago
Forum: Solvers
Topic: Different solutions with MCP and NLP formulation
Replies: 1
Views: 722

Re: Different solutions with MCP and NLP formulation

Renger, Essentially, things work as you were expecting if you use the negative of the objective derivative in the FOC. This is to be expected, since you have a maximization. With min you just use the derivative. So, change: c_foc(d).. -log(P(d)) - 1 - LAMBDA * x(d) - GAMMA =E= 0; to c_foc(d).. log(P...
by dirkse
2 months ago
Forum: Syntax
Topic: Running GAMS in phases
Replies: 4
Views: 1169

Re: Running GAMS in phases

Hi, There is a tendency to overuse the word "model" in this area. For example, a GAMS model can be: A bunch of GAMS code stored in a file. A GAMS symbol denoting a collection of equations, e.g. model m / all /; The latter can be solved using the solve statement, but the former isn't something to "so...
by dirkse
2 months ago
Forum: Tools
Topic: Importing data from GMAS to MATLAB
Replies: 3
Views: 1018

Re: Importing data from GMAS to MATLAB

It looks like you need to do a filtered read. This is typical. I can't explain it better than already done in the manual: https://www.gams.com/31/docs/T_GDXMRW.html#GDXMRW_RGDX I suggest you read this section completely and thoroughly. Also, in the code you sent, you reuse/reassign U. That makes it ...
by dirkse
2 months ago
Forum: Tools
Topic: Importing data from GMAS to MATLAB
Replies: 3
Views: 1018

Re: Importing data from GMAS to MATLAB

It would be best if you showed us the output of your run so we knew exactly what you are getting. Without that, it's hard to say precisely what the issue is. But I'll guess you are confusing full (aka dense) and sparse format. Have a look at the 'form' field in the input structure for rgdx. Try your...
by dirkse
3 months ago
Forum: Modeling
Topic: Double bound variable in an MCP
Replies: 2
Views: 373

Re: Double bound variable in an MCP

Tatjana, Let's take a simple MCP as an example. Let's start with an optimization problem, so we have some intuition from the optimization world we can lean on. min f(x) := sqr(x-1) s.t. L <= x <= U, where L and U can be finite or the expected infinity. Taking the KKT conditions we get this MCP: F(x)...
by dirkse
3 months ago
Forum: Modeling
Topic: implementation problem
Replies: 4
Views: 580

Re: implementation problem

Danesh, You should not take an equality and make it two inequalities. This is a bad idea computationally. Just use the equality with a free multiplier. You asked me to elaborate, but there's a lot to say. Much of it is spelled out explicitly in the attached kkt.pdf document. In particular, if you re...
by dirkse
3 months ago
Forum: Solvers
Topic: Using convert
Replies: 2
Views: 301

Re: Using convert

Oyvind, You don't say what the model type is but since you mention a Hessian I'll guess you're solving an NLP. In this case, your can select the convert solver by the statement option NLP = convert; in your GAMS code. Assuming my guess on the model type was correct, you then solve with SOLVE NLA MAX...
by dirkse
3 months ago
Forum: Modeling
Topic: Calculate after getting the optimal solution
Replies: 1
Views: 237

Re: Calculate after getting the optimal solution

Sandy, What you ask about is very easy to do. Outside of a solve statement, a variable is similar to a parameter. You can assign to it, display it and use it in calculations. For example: * setting a level value is good practice for nonlinear models x.L(i) = X0(i); * now solve a model - this changes...