Error: overflow in + operation (addop)

Problems with syntax of GAMS
Jarenka
User
User
Posts: 64
Joined: 5 years ago

Error: overflow in + operation (addop)

Post by Jarenka »

Dear,

I posted a question in archive here: viewtopic.php?f=13&t=8650&p=25722#p25722

I have a problem with solving the overflow in an equation that contains just summation over three dimensions.

I need this variable, because it is used in the model.

Do you have any ideas, how to solve it?

Best
Jarenka
Fred
Posts: 372
Joined: 7 years ago

Re: Error: overflow in + operation (addop)

Post by Fred »

I replied to your question directly in the archive.

Fred
Jarenka
User
User
Posts: 64
Joined: 5 years ago

Re: Error: overflow in + operation (addop)

Post by Jarenka »

Hi,

it seems that the result of the assignment statement is > 1E300 which causes an overflow. Are you sure that you need such large numbers. And are you sure that you found the right line in your code? With include files this can be tricky, so I suggest to check the line number in the echo print of the input file https://www.gams.com/latest/docs/UG_GAM ... eInputFile

I hope this helps!

Fred
Hi Fred,

Thank you for the reply!

Yes, the equation is right. And I do not know how big/small values should be. The parameter 'tbybh' is an income, which is part of economy system and it should be included in later equations.
Probably I need pre-conditions or some kind of assumptions for this equation.
Currently, I put the predicted values into a constant value. And the loop (over years) works now.

Best
Jarenka
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Error: overflow in + operation (addop)

Post by Renger »

Hi Jarenka
As a rule, I scale my data (usually economic data from the Input-Output-Table) so the values are around 1, which is for my data than usual billion dollars. The precision of the solution is less than 1E-7, so around 100$
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Jacob
User
User
Posts: 6
Joined: 2 years ago

Re: Error: overflow in * operation (mulop)

Post by Jacob »

PVT circular with pressure loss & thermosiphon flow.gms
code file
(19.62 KiB) Downloaded 132 times
PVT circular with pressure loss & thermosiphon flow.log
process log
(6.88 KiB) Downloaded 134 times
Hello;

Greetings.

I am seeking help on the above error in my code "overflow in * operation (mulop)".
I have attached the log and code files.
Anyone with an idea on how to rectify the error will be highly appreciated.

Thank you.
Kind regards;

Jacob
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Error: overflow in + operation (addop)

Post by bussieck »

When I run the model the listing file points me to the problematic equation "**** Exec Error at line 449: overflow in * operation (mulop)". Line 449 reads "E90..I_pv =e= IL1L - (Io1L * ((exp((Vb + (I_pv * Rs1L))/(a1L + 0.01))) - 1)) - ((Vb + (I_pv * Rs1L))/(Rsh1L + 0.01));". So let's look at the ingredients of the equations: variable I_pv is unitialized, hence this is at 0, a display of the other exogenous scalars show:

Code: Select all

----    462 PARAMETER Vb                   =       32.000
            PARAMETER IL1L                 =        6.538  
            PARAMETER Io1L                 =        0.000  
            PARAMETER Rs1L                 =        0.534  
            PARAMETER a1L                  =        0.000  
            PARAMETER Rsh1L                =      513.548 
Obviously, the problematic part is the exp function. The argument to the exp function is exp((32+0*513.548)/(0+0.01)) = exp(3200) which is something 1e+1389. Doubles end around 1e308. GAMS and the solvers work with double floating point numbers. Moreover, solvers work with tolerances. What I have seen in the model (extremely large numbers and very small numbers) makes me fear that the model is not going to give you any reasonable answer (I also saw messages from Conopt "An initial function value is too large (larger than 1.0E+10)" which make Conopt stop without a solution). I suggest reading the scaling chapter in the GAMS/Conopt solver manual at https://www.gams.com/latest/docs/S_CONO ... PT_SCALING to get a sense for the problem area.

Good luck.

-Michael
Jacob
User
User
Posts: 6
Joined: 2 years ago

Re: Error: overflow in + operation (addop)

Post by Jacob »

bussieck wrote: 1 year ago When I run the model the listing file points me to the problematic equation "**** Exec Error at line 449: overflow in * operation (mulop)". Line 449 reads "E90..I_pv =e= IL1L - (Io1L * ((exp((Vb + (I_pv * Rs1L))/(a1L + 0.01))) - 1)) - ((Vb + (I_pv * Rs1L))/(Rsh1L + 0.01));". So let's look at the ingredients of the equations: variable I_pv is unitialized, hence this is at 0, a display of the other exogenous scalars show:

Code: Select all

----    462 PARAMETER Vb                   =       32.000
            PARAMETER IL1L                 =        6.538  
            PARAMETER Io1L                 =        0.000  
            PARAMETER Rs1L                 =        0.534  
            PARAMETER a1L                  =        0.000  
            PARAMETER Rsh1L                =      513.548 
Obviously, the problematic part is the exp function. The argument to the exp function is exp((32+0*513.548)/(0+0.01)) = exp(3200) which is something 1e+1389. Doubles end around 1e308. GAMS and the solvers work with double floating point numbers. Moreover, solvers work with tolerances. What I have seen in the model (extremely large numbers and very small numbers) makes me fear that the model is not going to give you any reasonable answer (I also saw messages from Conopt "An initial function value is too large (larger than 1.0E+10)" which make Conopt stop without a solution). I suggest reading the scaling chapter in the GAMS/Conopt solver manual at https://www.gams.com/latest/docs/S_CONO ... PT_SCALING to get a sense for the problem area.

Good luck.

-Michael
Hello Micheal, thank you for the guidance. I managed to modify the model as per guidance. However, I now added some modifications and I am getting some new errors related to the previous one.

Here requesting for assistance on my GAMS model, when I execute it I get the following errors:

Exec Error at line 710: division by zero (0)
Exec Error at line 710: A constant in a nonlinear expression in equation E96 evaluated to UNDF

I applied bounds and initial values on some variables but still no success. Attached is the GAMS file and input data file.
Anxiously waiting for your response.

Thank you.
PVT circular with tube insulation.gms
(21.16 KiB) Downloaded 42 times
Jacob
Sunny3(Input).xlsx
(12.5 KiB) Downloaded 41 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Error: overflow in + operation (addop)

Post by bussieck »

Before looking into consequences of the third solve, I would first look at the second solve. Conopt fails because the Jacobian values are too big. Knitro can't make the model feasible. You did not share the log/lst of your run. Did you succeed solving the second ("Thermal") model? Only if this succeeds with good variable values it makes sense to analyze what's going on in the third solve.

-Michael
Jacob
User
User
Posts: 6
Joined: 2 years ago

Re: Error: overflow in + operation (addop)

Post by Jacob »

bussieck wrote: 1 year ago Before looking into consequences of the third solve, I would first look at the second solve. Conopt fails because the Jacobian values are too big. Knitro can't make the model feasible. You did not share the log/lst of your run. Did you succeed solving the second ("Thermal") model? Only if this succeeds with good variable values it makes sense to analyze what's going on in the third solve.

-Michael
Hello Micheal;
The first model that I corrected executes perfectly and is attached below. I had to add some bounds and limits.
Sunny3(Input).xlsx
(12.5 KiB) Downloaded 47 times
The new one where I made some modifications is the one having the errors.
PVT circular with tube insulation.gms
(21.16 KiB) Downloaded 44 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Error: overflow in + operation (addop)

Post by bussieck »

I don't see any difference from the last iteration:

Code: Select all

--- Generating NLP model Thermal[LST:1279]
--- PVT circular with tube insulation.gms(678) 7 Mb[FIL:"C:\Users\mbuss\Downloads\PVT circular with tube insulation.gms",678,0]
---   3,691 rows  3,692 columns  10,897 non-zeroes
---   15,296 nl-code  4,468 nl-non-zeroes
--- Range statistics (absolute non-zero finite values)
--- RHS       [min, max] : [ 3.295E-03, 3.444E+05] - Zero values observed as well
--- Bound     [min, max] : [ 1.000E-08, 1.000E-06]
--- Matrix    [min, max] : [ 1.660E-08, 3.059E+18] - Zero values observed as well
--- PVT circular with tube insulation.gms(678) 5 Mb[FIL:"C:\Users\mbuss\Downloads\PVT circular with tube insulation.gms",678,0]
--- Executing CONOPT (Solvelink=2): elapsed 0:00:04.069[LST:4700]

CONOPT 3         42.2.0 ef14ea53 Feb 16, 2023          WEI x86 64bit/MS Window

 
 
    C O N O P T 3   version 3.17N
    Copyright (C)   ARKI Consulting and Development A/S
                    Bagsvaerdvej 246 A
                    DK-2880 Bagsvaerd, Denmark
 
 
 ** An initial function value is too large (larger than 1.0E+10).
    Scale the variables and/or equations or add bounds.
Conopt is very explicit about the equations it doesn't like:

Code: Select all

**** ERRORS/WARNINGS IN EQUATION E74(72)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(1)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(2)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(3)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(4)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(5)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(6)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(7)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(8)
     1 error(s): Initial function value too large = 3.0E+10

**** ERRORS/WARNINGS IN EQUATION E75(9)
     1 error(s): Initial function value too large = 3.0E+10
I guess this should give you enough information to improve the situation. Perhaps you use a different solver and get stuck at a different place. You should share your log file in this case.

-Michael
Post Reply