Speed up model.control proc

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator

gmcatee
Posts: 9
Joined: Wed Oct 29, 2014 8:28 am

Speed up model.control proc

Postby gmcatee » Fri Nov 01, 2024 2:05 pm

This post is long overdue, but when I upgraded from EViews 8.1 to EViews 12, I noticed that the model.control procedure was taking much longer to complete. Is there a difference in how the two versions perform this procedure? Are there any settings I can change to speed up the calculation?

I've constructed an example from the Fair Model (workfile attached).

Running the following code in EV8 takes about 5 seconds but takes almost 24 seconds in EV12

Code: Select all

tic for !repeat = 1 to 20 for %v CD CN CS CUR DF HF HO IHH IM INTG JF KK L1 L2 L3 LM MF PF RB RM RS WF Y fma_ev.control {%v}_a {%v} {%v} next next !time = @toc show !time
Attachments
usev242.wf1
(1.41 MiB) Downloaded 178 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13415
Joined: Tue Sep 16, 2008 5:38 pm

Re: Speed up model.control proc

Postby EViews Gareth » Fri Nov 01, 2024 2:24 pm

I’m afraid the control proc has undergone many revisions since EViews12, so you’re unlikely to get much feedback on such an old version.
Follow us on Twitter @IHSEViews

gmcatee
Posts: 9
Joined: Wed Oct 29, 2014 8:28 am

Re: Speed up model.control proc

Postby gmcatee » Fri Nov 01, 2024 2:40 pm

Understood. It sounds like there are no options that can be adjusted by the user -- is that right?

I am curious though -- are you able to run the code with this workfile in EV14 to see how long it takes there? I get similar results using a 7-year-old laptop and a brand new one, so the system specs shouldn't make a difference. We use this function hundreds of times when updating the forecast, so the few seconds difference adds up.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13415
Joined: Tue Sep 16, 2008 5:38 pm

Re: Speed up model.control proc

Postby EViews Gareth » Fri Nov 01, 2024 3:01 pm

16 seconds.
Follow us on Twitter @IHSEViews

gmcatee
Posts: 9
Joined: Wed Oct 29, 2014 8:28 am

Re: Speed up model.control proc

Postby gmcatee » Fri Nov 01, 2024 4:19 pm

Got it, thanks. If you stumble on anything that might make this run faster please let me know. For now, we're clinging on to EV8 for this part of our process

tvonbrasch
Posts: 548
Joined: Fri Apr 15, 2011 5:35 am

Re: Speed up model.control proc

Postby tvonbrasch » Sat Nov 02, 2024 10:14 am

Hi,

It’s not a perfect solution, but rewriting the equation might help, i.e. from "equation" to "-x_a+equation" and then solve for x_a. See the details below and in the attachment. This adjustment reduces the execution time from 25 seconds to 8 seconds.
t


Code: Select all

' '-------------------------------------------------------------------- !i=!i+1 %mn=%m+%v %mn=@getnextname(%mn) copy {%m} {%mn} {%mn}.scenario(n,alias="_zer") zero %equation="eq??_"+%v %equation=@wflookup(%equation, "equation") %subst={%equation}.@subst %add=%v+"_a" %subst0 = "-"+%add+"+"+%subst {%mn}.drop {%v} {%mn}.append {%subst0} {%mn}.solve copy(o) {%add}_zer {%add} delete {%mn} *_zer '--------------------------------------------------------------------
Attachments
control_rewrite_equation.prg
(857 Bytes) Downloaded 171 times

gmcatee
Posts: 9
Joined: Wed Oct 29, 2014 8:28 am

Re: Speed up model.control proc

Postby gmcatee » Mon Nov 04, 2024 7:12 am

Thanks Thomas - I'll give this a try when I have some down time this week

EViews Matt
EViews Developer
Posts: 574
Joined: Thu Apr 25, 2013 7:48 pm

Re: Speed up model.control proc

Postby EViews Matt » Mon Nov 04, 2024 5:47 pm

Hello,

Elaborating on Gareth's response, there was a major update to the Model::control procedure in EView 12 when we introduced the ability for multivariate controls. While I'd describe the new algorithm as numerically superior overall, it can be more computationally intensive even in the univariate case. If you absolutely can't afford the resulting extra time, it's still possible to use the old pre-EViews 12 univariate control algorithm by adding the "legacy" option to the control procedure, e.g.

Code: Select all

fma_ev.control(legacy) {%v}_a {%v} {%v}

gmcatee
Posts: 9
Joined: Wed Oct 29, 2014 8:28 am

Re: Speed up model.control proc

Postby gmcatee » Wed Nov 06, 2024 12:28 pm

Great, thanks for the tip Matt - that works for my application


Return to “Models”

Who is online

Users browsing this forum: No registered users and 1 guest