possible bug in version 4.2.4

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

possible bug in version 4.2.4

Postby cgranda » Wed Dec 21, 2011 2:50 am

Dear Dynare team,

I just wanted to let you know about a possible bug I stumbled upon while trying to run a code on the latest version of Dynare. The code in question runs very well in previous versions of this software. However, I got the following error message when I tried to run it on version 4.2.4:

??? Error using ==> dynare_solve at 42
You can't use solve_algo=0 since you don't have MATLAB's Optimization Toolbox

I guess it would be good for you to check whether there is any incompatibility with MATLAB's Optimization Toolbox.

In appreciation of your time and attention,

Catalina
cgranda
 
Posts: 6
Joined: Thu Jul 22, 2010 3:16 pm

Re: possible bug in version 4.2.4

Postby HoutanBastani » Fri Dec 30, 2011 10:05 am

Hi, this is a bug in the way we were testing for the existence of a license in Matlab. It has been fixed in the unstable branch on Dec 19. To fix it, you can replace lines 41-43 of dynare_solve.m with the code below. Similar fixes were applied in solve_one_boundary.m and dynare_config.m.

Code: Select all
    if ~exist('OCTAVE_VERSION')
        [has_optimization_toolbox junk] = license('checkout','optimization_toolbox');
        if ~has_optimization_toolbox
            error('You can''t use solve_algo=0 since you don''t have MATLAB''s Optimization Toolbox')
        end
     end
Best,
Houtan
HoutanBastani
 
Posts: 197
Joined: Fri Jan 22, 2010 4:11 pm
Location: Paris, France

Re: possible bug in version 4.2.4

Postby joasi » Sun Jan 29, 2012 9:55 am

Hi, thanks for the patch, I applied it to dynare_solve.m:41-43 and I get the following error in Matlab 7.9.0:

??? Error using ==> license
Too many output arguments.

Error in ==> dynare_solve at 42
[has_optimization_toolbox junk] = license('checkout','optimization_toolbox');

Error in ==> dynare_solve_block_or_bytecode at 66
[x, check] = dynare_solve('bytecode_steadystate', ...

Error in ==> steady_ at 126
[oo_.steady_state,check] = dynare_solve_block_or_bytecode(oo_.steady_state,...

Error in ==> steady at 54
steady_;

Error in ==> dsge4_dynare at 259
steady;

Error in ==> dynare at 120
evalin('base',fname) ;
joasi
 
Posts: 5
Joined: Tue Jan 17, 2012 11:45 am
Location: Singapore

Re: possible bug in version 4.2.4

Postby HoutanBastani » Mon Jan 30, 2012 10:55 am

Hi,

Yes, there is a problem with the previous solution because it's only valid for Matlab version >= 2011a. A solution that works for all Matlab versions >= 7.0 is as follows:

In dynare_solve.m, enter:

Code: Select all
if ~user_has_matlab_license('optimization_toolbox')


Then, add a file called user_has_matlab_license.m with the following code:

Code: Select all
function [hasLicense] = user_has_matlab_license(toolbox)
%[hasLicense] = user_has_matlab_license(toolbox)
% checks for license using the appropriate function call
%
% INPUTS
%   toolbox: string for toolbox name
%
% OUTPUTS
%   hasLicense: bool indicating whether or not the user has the license
%
% SPECIAL REQUIREMENTS
%   none

% Copyright (C) 2012 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

if matlab_ver_less_than('7.12')
    hasLicense = license('test', toolbox);
else
    [hasLicense ~] = license('checkout',toolbox);
end
end


Similar changes need to be made to dynare_config.m and solve_one_boundary.m. If you are comfortable with git, you can see the changes on the 4.2 branch in commit 5a580341337e51fcf17a4a877201a3bbf0be59d4
Best,
Houtan
HoutanBastani
 
Posts: 197
Joined: Fri Jan 22, 2010 4:11 pm
Location: Paris, France


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 11 guests