|
<< Click to Display Table of Contents >> New features |
![]() ![]()
|
This version of Gekko is part of the 3.3.x development series, extending the official Gekko 3.2. The 3.3.x development versions are intended to be non-breaking regarding Gekko 3.0 and Gekko 3.2, and just as stable. The development versions are published on the Gekko website here (see also the changelog for more details, or Github for even more details).
If you are upgrading from for instance Gekko 2.4 or older, beware that the syntax changed quite a bit between Gekko 2.x and Gekko 3.x, so in general, Gekko 2.x programs cannot be run unchanged in Gekko 3.x. There is an automatic translator available, and see also the cheat sheet regarding syntax differences. (Gekko .gbk databanks are compatible between Gekko 2.x and 3.x, however).
Gekko 3.3.x
•Gekko package for Python: PyGekko (follows Gekko version numbering)
•COPY and DELETE can now be used with array-series indexes, too (import/export of .xlsx/.csv/.prn files already supports array-series).
•Apache Parquet files supported, see import and export. More info on Gekko's implementation of the format here.
•New FLOW statement.
•New options: option databank file gbk underscore, option interface gcm ndec, option missing, option model gams scalar data, option plot png scale, option plot emf size, option plot pdf size, option plot png size, option plot svg size.
•New functions branch(), commit(), deletefile(), existfolder(), getfiles(), getfolders(), pathparts(), reverse(), runfolder(), traceBanks(), user(), userdomain().
•PLOT upgraded, now using gnuplot 6.0 internally, and copy-pastes to clipboard via .png now.
•MODEL with optional time period stated: used to time-truncate GAMS scalar models for faster loading.
Gekko 3.2
Care is taken to ensure that Gekko 3.2 version is stable and backwards compatible with the official Gekko 3.0 (from April 2019). Compared to Gekko 3.0, Gekko 3.2 implements the following:
•Data-tracing for timeseries, storing detailed info on how the timeseries data have been constructed back in time, including data-traces of other precedent timeseries (cf. TRACE). Also program dependency tracking is possible: which (data) files are read/written during a run of a system of .gcm files?
•New DECOMP with many new features, among other things recursive decomposition and dimensionality. Also supports GAMS models including scalar models. Includes new FIND statement and window.
•New flowgraphs to visualize decompositions (see more under DECOMP). The Flow button in the DECOMP window activates a flowchart-like graph depicting the dependencies among variables. The graph can be thought of as a visual representation of a recursive DECOMP.
•GAMS equations/models are now fully supported (via so-called scalar equations) and can be used with the new DECOMP (cf. MODEL). For GAMS scalar models, SIM<res> works, too.
•New PLOT window, with buttons similar to the DECOMP window. The plot window includes an All button to show first-position and Ref (reference) values next to each other. Also, an Index button to show indexed values (value = 100 in the first period), and a YoY button to show year-over-year differences for quarterly and monthly series (4 and 12 lags, respectively).
•New operators <i>, <a> and <yoy> for PRT/PLOT/SHEET. As mentioned regarding PLOT, <i> is indexed values, <a> is first-position and Ref (reference) values ("all"), and <yoy> is year-over-year differences.
•Autocomplete on series names, including array-series. Is triggered with [Tab] or [Ctrl+Space].
•Weekly and daily frequencies (w and d) are introduced, with dates like 2019w50 or 2019m12d24. There are also new functions to bridge between Gekko daily dates and Excel dates.
•Gekcel: an Excel add-in (xll file) that makes it possible to (among other things) read/write to Gekko databanks via Excel functions from within Excel, without starting up Gekko. This component is downloaded separately, at the same download pages as the normal Gekko system.
•Improved and less voluminous error messages. Also better way to show warnings, so they do not flood the main Gekko window. Warnings can be inspected at the end of a Gekko run.
•Local options: normal options that only apply to the current Gekko statement.
•User-defined functions and procedures allow prompting and default values for arguments. For functions and procedures, you may omit default arguments, or you may use ? to make Gekko prompt (input window) regarding such default arguments, for instance p?; to call a procedure p with prompting, or f?(); to call a function f with prompting. See more under FUNCTION and PROCEDURE.
•User-defined functions and procedures can be stored in library zip files (cf. the LIBRARY statement). Gekko libraries use lazy loading so that you may load a large library quickly without slowing down Gekko. Normal files can also be accessed from the \data subfolder of a library. Libraries can be loaded in a hierarchical fashion, and similarly to databanks, you may use colon : to refer to a function/procedure/file from a particular library (like lib1:f() or lib1:data.csv). There are capabilities regarding encapsulation (this: designation and private __ prefixes).
•OLS improvements, showing parameter stability, fit and decomposed values. Trend polynomials can be added automatically, and endpoint restrictions can be stated easily (so-called 'Finnish' trends). OLS<dump> will transform the estimation into an equation suitable for Gekko models (FRML).
•New equation types for Gekko models (.frm files). In addition to the usual Y-type equations (typically containing reverted J-factors and similar technical stuff), you may use T-type equations, too. The difference is purely semantic, but the idea is that T-type may denote that the equations are 'interesting' (for instance used for tabelling), rather then purely technical. Equations may also be P-type: these are not not be part of the model at all, but can be called with the new PREDICT statement. In addition, via RUNBEFORE$ and RUNAFTER$ tags, you may put normal Gekko program statements inside the model file, to be run before or after the simulation proper. These features are experimental at the moment.
•PREDICT statement to call individual Gekko model equations.
•Python interface implemented, see RUN_PYTHON and EXPORT<python>. This is similar to the R interface, which has been simplified.
•SHEET<import list> and SHEET<import map> to transfer an Excel sheet into a nested list or map for further processing.
•Better selection and indexing possibilities regarding nested lists. This makes it possible to import an Excel sheet as a nested list, and handle the cells in a matrix-like fashion (similar to how NumPy deals with n-dimensional arrays).
•Dynamics checking from version 3.1.7 an onwards. A statement like x = x[-1] + 1 with the lagged dependent/endogenous x[-1] on the right-hand side will fail with a 'dynamics error' if the statement is not decorated with <dyn>, <dyn = no>, or is put inside a block series dyn = yes|no. See more here.
•For PRT/PLOT/SHEET, it is now possible to use <label> to show labels instead of series names, or the more advanced <meta=...> to show other meta information.
•Possibility to restore statements from a previous interactive Gekko session easily (by clicking a link).
•Improvements in the GAMS to Gekko equation translator, can also be used with mark and right-clicking text.
•In the Gekko main window, you may choose how [Enter] and [Ctrl+Enter] works in the editor (lower part of the main window). For instance, RStudio style is possible, where [Enter] issues a newline, and [Ctrl+Enter] executes the line. See OPTION interface edit style = ... .
•Use the root() function to avoid hard-coded paths in your system of Gekko programs, databanks, etc. Using root() simplifies portability: the possibility of painless copying/moving a folder Gekko files to another location.
•File paths allow so-called "zip paths", for instance g:\projects\storage.zip\data.csv to refer to the file data.csv inside storage.zip. (the .csv file is automatically extracted). This only works for file reading, not writing.
•SPLICE supports multiple series, date intervals, and different methods. The SPLICE statement also has an option to set a limit on the max number of overlapping observations used. Function splice() is also implemented.
•INTERPOLATE now has the Denton, Cholette and 'Olsette' methods, too.
•INDEX supports array-series.
•PRT<view> to show nested lists in a list window.
•IMPORT<px> supports new short variable codes.
•IMPORT<aremos> can be used to transfer timeseries from AREMOS with higher precision (significant digits) than the tsd format.
•EXPORT<array> implemented, using the Apache Arrow data format for easy use in for instance R or Python (and others). See more under R_RUN and PYTHON_RUN.
•CLOSEALL statement (= CLOSE *; CLEAR;).
•ELSEIF statement.
•PIPE<echo> to both print on screen and to file at the same time.
•Function laspchain() with annualoverlap argument, for non-annual chain indexes.
•Function comparefolders() to compare the contents of to file folders.
•Drag & drop of files into the main Gekko window (the files will show up as strings including paths).
•In the F2 databank list window, databanks can be swapped by drag and drop (to ease comparisons).
•Fencing options, restricting read/write of files to certain folders. See options option global fence ... .
•New gekko version statement to check Gekko version validity in .gcm files.
•New eps concept: a value very close to 0 with special capabilities, for instance %x = eps();. The eps values have special calculation rules, for instance eps() + eps() == eps(), not 2 * eps(). The eps concept will be further developed and is used to signify a 0 that is "verified" data wise to be 0. An eps value could be, for instance, the number of children in elderly care (meaningless).
•64-bit versions available (both Gekko and Gekcel).
•Loading of models and databanks uses multi-core cache files. For large models and gdx files, the speedup can be a factor 3-5x.
•Quite a lot of smaller fixes and improvements regarding statements and inbuilt functions, and the consistency of these.
•New statements: CLOSEALL, ELSEIF, FIND, GEKKO, LIBRARY, PREDICT, PYTHON_RUN, TRACE.
•New functions: allmiss(), arraypack(), arrayunpack(), bankflatten(), bankreplace(), binary(), ceiling(), collapse(), comparefolders(), currentdate2(), currentDay(), currentFolder(), currentHour(), currentMinute(), currentMonth(), currentSecond(), currentYear(), date(), design(), difa(), diffa(), diffq(), difq(), dloga(), dlogq(), eps(), existFile(), floor(), flush(), fromBank(), fromExcelDate(), fromTrace(), gekkoBitness(), gekkoInfo(), gekkoVersionDate(), getDay(), getFixType(), getMonth(), getParent(), getSpecialDay(), getWeek(), getWeekday(), includes(), int(), interpolate(), is0OrEps(), isAlpha(), isArraySeries(), isEps(), isLibraryLoaded(), isLower(), isMiss(), isNull(), isNumeric(), isTimelessSeries(), isUpper(), isUtf8File(), lhsRhs(), max(), min(), mod(), modelRawEqs(), modelRawVars(), modelScalarEqs(), modelScalarVars(), nl(), null(), observations(), pcha(), pchq(), getElements(), readScreen(), rebase(), rename(), reorder(), root(), rootify(), setFixType(), smooth(), splice(), split(), subseries(), tanh(), tic(), tiny(), toc(), toExcelDate(), traceBank(), traceDelete(), traceDelete2(), traceStats(), traceStats2(), truncate(), type(), upperfirst(), val(), venn(), yesno().
•New options: option databank file cache, option databank trace, option databank trace divide, option databank trace dublets, option decomp flowgraph depth, option decomp plot zoom, option decomp res missing, option fit ols rekur dfmin, option gams trim, option global color, option global dependency tracking, option global fence black folders, option global fence black folders read, option global fence black folders write, option global fence sys, option global fence white folders, option global fence white folders read, option global fence white folders write, option global warnings ignore, option global warnings limit, option global warnings pauseat, option global warnings print, option interface csv delimiter, option interface csv ignoremissing, option interface csv ndec, option interface edit style, option interface errors, option interface excel ignoremissing, option interface mute, option interface prn decimalseparator, option interface prn delimiter, option interface prn ndec, option interpolate method, option interpolate olsette trend, option library cache, option model gams dep current, option model gams dep method, option model gams scalar data, option model gams scalar normalize, option plot all dash order, option plot palette, option plot zoom dpiscale, option print disp model gams scalar, option print index date, option print index value, option python exe folder, option series array table missing, option series data missing, option series dyn check, option series failsafe, option solve data create auto, option solve newton robust, option splice obs, option string interpolate format val, option system read encoding, option system threads, option system write encoding, option system write utf8 bom.
Gekko 3.0
Syntax-wise the syntax changes from 2.0/2.2/2.4 to 3.0 are not quite as dramatic as the changes from 1.8 to 2.0. Version 3.0 is more a question of new capabilities, improving upon existing capabilities, cleaning up the syntax, and providing general consistency. Regarding model solving and the way databanks are opened and closed, nothing has been changed from 2.4 to 3.0, in order to keep these parts of Gekko stable. There is an automatic translator from 2.0/2.2/2.4 available, cf. TRANSLATE. The most significant changes from 2.4 to 3.0 are the following:
•All variables types, series, value, string, date, list, map, and matrix, now reside in databanks, and all variable types can be stored in .gbk databank files.
•Assignment of variables no longer needs to include type. So series x = 5; val %v = 100; matrix #m = [1, 2]; can now be written more compactly x = 5; %v = 100; #m = [1, 2];. To be completely sure of the type of for instance %v, you can still use for instance val %v = 100;. Note also that in Gekko 3.0, you must use % or # type symbols on the left-hand side, so for instance val v = 100; must be val %v = 100; in Gekko 3.0.
•Series variables all use frequency indicator !a (annual), !q (quarterly), !m (monthly), !d (daily) or !u (undated). These indicators can often be omitted, for instance prt x; to print out x of the current frequency. Use the indicators to access a series of another frequency than the current, or for mixed frequency use.
•Map is a new variable type that stores variables by name. Maps are like mini-databanks and are among other things handy for bundling variables together, for instance when getting variables in and out of user-defined functions.
•Lists may now store any type of variables, not just strings. The list functionalities have been augmented, including list functions. Two-dimensional listfiles (lists of lists) are supported, using a .csv-like format. Note that list definitions in Gekko 3.0 generally include parentheses, for instance ('a', 'b') for a list of two strings. However, in the LIST and FOR statements, you may use a 'naked' list definition, for instance #m = a, b; being equivalent to #m = ('a', 'b'), or #m = 1, 2; being equivalent to #m = (1, 2);. Instead of LIST<direct> from Gekko 2.4, the user can just use a naked list in Gekko 3.0. See more on naked lists.
•Introduction of local and global databanks. The local databank is used for temporary/discardable variables (for instance inside functions/procedures), and the global databank can be used for permanent storage of settings etc. that are intended to survive for instance READ and CLEAR statements. In combination with these banks, there are the new statements LOCAL and GLOBAL to denote such variables. Apart from that, the databank logic is exactly the same as in Gekko 2.4. The local databank is searched first, and the global databank last (also in sim-mode).
•BLOCK ... END is a new structure to set time period and/or other options temporarily, setting them back after the block is finished.
•Since series statements are calculated in a vector-like fashion in Gekko 3.0/3.1.x (in contrast to the Gekko 2.x versions), lags no longer automatically accumulate period-for-period, if the left-hand side variable is present with lags on the right-hand side (lagged dependent/endogenous variable). See more on the help page on dynamic statements. In Gekko versions >= 3.1.7, a statement like for instance x = x[-1] + 1 will need to be decorated with an indication regarding whether it should accumulate (<dyn>) or not (<dyn = no>), cf. examples on the linked help page. Note that for absolute accumulations like x <dyn> = x[-1] + 1, you may use x <d>= 1, x ^= 1 or dif(x) = 1 instead (and there are also variants regarding relative accumulations, see below). Note that setting <dyn> (or block series dyn = yes) unnecessarily entails a speed penalty and should therefore not be used unless needed.
•Wildcard lists are syntactically changed from for instance [a*x] to ['a*x'] to obtain a list of strings matching the wildcard, or {'a*x'} if the matched strings are going to be used as variable names (for instance in PRT, etc.). In statements that do not accept expressions, for instance COPY, INDEX, DISP, etc., the shorter 'naked' wildcard a*x is legal too.
•PRT and PLOT now handle mixed frequencies in the same plot/print.
•PRT/PLOT works on non-indexed array-series, for instance prt x; instead of prt x[#i, #j]; (where x is an array-series).
•User-defined functions and procedures have been reworked for Gekko 3.0: they can be accessed from anywhere, as long as they have been defined chronologically before the call. The old option library file is now obsolete. A Gekko program file (.gcm) with user functions/procedures can just be loaded with RUN in gekko.ini, and subsequently the functions/procedures will be available until the next RESET/RESTART (functions/procedures are not stored in databanks). Functions/procedures support default values and prompting.
•User-defined functions and procedures may use a <>-field to indicate time parameters. Hence, a user-defined function scale() may be called like scale(<2010 2020>, x), and a procedure scale may be called like scale <2010 2020> x;. Inside the functions/procedures, these time parameters can be accessed as dates, and if they are omitted in the call, the time parameters are set to correspond to the the local/global Gekko time period. The new <>-field is also used in some of the inbuilt functions: avgt(), sumt(), hpfilter(), laspchain(), laspfixed(), pack(), unpack(), time().
•All functions (including user-defined functions) can be called as object functions on the first argument (not counting time parameters): this is called Uniform Function Call Syntax (UFCS). So a function like for instance f(x, y) can generally be written as x.f(y). Therefore, instead of for instance f(#m, %s), you may use #m.f(%s). Such functions can be chained, for instance #m.extend(#m1).remove('a').sort(), providing a more fluent syntax than the equivalent and 'backwards' sort(remove(extend(#m, #m1), 'a')).
•A new name type is introduced for function and procedure arguments, in order to avoid unnecessary single quotes. You may define for instance procedure f name %x; prt ref:{%x}; end; f a1;. After this, f a1; will print out a1 from the Ref databank, which is more convenient than having to type f 'a1';. Inside the function/procedure, the name %x works just like a string %x.
•The NAME statement is obsolete, so for instance NAME %s = 'a'; is not legal. Instead, use STRING and refer to the string with {}-curlies. For instance %s = 'bvat'; prt {%s};. Note that there is a name-type for functions/procedures in order to avoid quoted argument strings.
•A lot of new in-built functions are added to deal with variable names represented as strings, for instance the string 'b2:x[a, y]'. There are functions to add/set/get/remove the databank, frequency, index, etc. part of such a string.
•Faster gdx read/write. Optional equation browser for GAMS equations. In option model type = gams mode, ENDO/EXO has been reworked to interface with GAMS.
•Alias names may be used, for instance providing a mapping from old to new variable names. See option interface alias.
•Better abort red button that should work in all cases where Gekko needs to be stopped.
•PLOT can export to pdf.
•m() can be used instead of miss() to indicate missing value.
•OLS<dump> can dump results as FRML equation for use in models.
•Enhanced format() function that can control width and alignment, and {}-curlies inside strings can be formatted.
•New statements: BLOCK, CUT, LOCAL, GLOBAL, MAP, VAR.
•Removed statements: NAME (use strings and {}-curlies), SHOW (use PRT), UNSWAP.
•New functions: addbank(), addfreq(), append(), contains(), count(), data(), dates(), except(), extend(), flatten(), getbank(), getdomains(), getendoexo(), getfreq(), getfullname(), getindex(), getmonth(), getname(), getnameandfreq(), getquarter(), getsubper(), getyear(), index(), isopen(), map(), pop(), preextend(), prefix(), prepend(), readfile(), remove(), removebank(), removefreq(), removeindex(), replacebank(), replacefreq(), replaceinside(), rotate(), seq(), series(), setbank(), setdomains(), setfreq(), setname(), setnameprefix(), setnamesuffix(), sort(), strings(), stripend(), stripstart(), substring(), suffix(), timeless(), unique(), vals(), writefile().
•Removed (renamed) functions: difference() is now except(), piece() is now substring(), search() is now index(), strip() is now replace(), trim() is now strip(). The following functions have reordered parameters regarding dates: avgt(), sumt(), hpfilter(), fromseries(), unpack().
•New options: option decomp maxlag, option decomp maxlead, option gams time freq, option interface alias, option interface remote file, option interface table operators (renamed from 'printcodes'), option model type, option plot elements max, option plot using, option print elements max, option print split, option series array calc missing, option series array print missing, option series dyn, option series normal calc missing, option series normal print missing, option series normal table missing.
•Removed options: option databank logic, option interface table printcodes (renamed to 'operators'), option library file, option series array ignoremissing (renamed).
Gekko 2.4
Gekko 2.4 is a relatively small update on the top of Gekko 2.2, and 2.4 should be just as stable as 2.2. The main focus of development is the upcoming Gekko 3.0, but still 2.4 contains the following augmentations:
•PROCEDURE implemented. User-defined functions and procedures can be put in a general library file (lib.gcm), so they can be stored in a central place.
•IMPORT<collapse> for collapsing high-frequency data (for instance daily observations) into monthly, quarterly or annual Gekko-timeseries. The data must reside in an Excel spreadsheet, more formats will be supported later on.
•Array-series, with $-conditionals, summing etc, cf. under the SERIES statement. Array-series are further developed in the upcoming Gekko 3.0.
•Robust Newton (better handling of illegal starting values). This is managed by means of OPTION solve newton robust = yes|no, and with robust = yes (default), Gekko will handle illegal stating values (like the logarithm of a negative number) much better.
•Read/write of GAMS datafiles (gdx-files): IMPORT<gdx> and EXPORT<gdx>. See also the OPTIONs under OPTION gams ... regarding how gams files are handled.
•Reading of PC-Axis files: IMPORT<px>.
•Export of R-datasets: EXPORT<r>.
•New 'ser' (series) files format: IMPORT<ser>. This entails fast reading of flat SERIES-like lines like "x 2020 2023 100.0 210.0 150.5 200.7".
•Better engine regarding IMPORT and EXPORT of xlsx-files. The new system (default) does not depend upon Excel being installed on the pc, and should be more stable and leak less memory.
•MATRIX definition with row/colnames.
•Remote control of Gekko is made possible via using a remote.gcm Gekko program file, cf. OPTION interface remote = yes|no.
•EXPORT<cols> implemented for .csv and .prn files.
•Some new functions: avgt(), sumt(), time(). The two first handle sums and averages over time (for timeseries).
•Stand-alone html equation browser generator (DOC<browser>).
•OLS<dump> can dump results as FRML equation for use in models.
Gekko 2.2
Gekko 2.2 most notably adds a lot of new graphing capabilities (PLOT) to Gekko.
•PLOT statement completely overhauled, see demo plots here. Graphs can be controlled in a lot of new ways, either as options in the PLOT statement, or in a template file (.gpt), or both. Histograms/bars/boxes are supported, too. There is a special handy option to separate boxes and lines vertically: PLOT<separate>, and many other possibilities.
•OPEN<edit> should be used instead of OPEN<prim>, and LOCK/UNLOCK statements can lock/unlock already opened databanks. Opened databanks (OPEN without options) are now opened last in the list of databanks. Opened databanks are now protected (non-editable) per default.
•OLS statement improved, including linear restrictions on parameters.
•INTERPOLATE and REBASE statements implemented.
•XEDIT statement to open up a dedicated and in-built xml editor (for graph and table templates).
•MATRIX statement allows all kinds of indexers on left-hand side.
•SHEET<import matrix> imports a matrix from an Excel sheet.
•IMPORT accepts dates.
•PIPE improvements.
•Functions: random number functions, see rseed(), runif() and rnorm(). Functions pchy(), dify() and dlogy() to handle yearly differences. Functions movavg(), movsum() for moving averages/sums, and lag() for lags. Function chol() for Cholesky decomposition of matrices. See here.
•Some new table options: 'mdateformat', 'decimalseparator', 'thousandsseparator' and 'stamp'. See under OPTION, in the OPTION table ... section. With these options, a number like 12345.67 can be printed as 12,345.67 or 12.345,67, and this may be combined with negative decimal places (for instance "f9.-2", to produce 12,300 or 12.300). Monthly dates can be formatted as for instance 'Jan. 2020' instead of '2020m1'. Menu files accept links to .gcm files.
•The .gbk databank file format now uses a datafile called 'databank.data' internally (instead of 'databank.bin'). The old name caused problems when sending databank files over email. To produce a databank file suitable for Gekko 2.0 or 1.8, see the note in the WRITE help file.
•Options: see the end of the OPTION statement regarding new options in Gekko 2.2.
Regarding Gekko 2.0 and earlier, see this page.