|
|
Elements of an object-oriented version of Nelson-Winter models | |
|
Old NELWIN
|
This program is part of a set of evolutionary-economic programs. It is intended to be used in connection with E.S. Andersen, Evolutionary Economics: Post-Schumpeterian Contributions, Pinter, London, 1994/1996 - especially chapter 4 and the appendix. The book includes some information on the Maple programming language (for further information see Maple tutor, Maple books, and Maple sites). The program cannot be developed without applying the Maple procedures for the generation of random numbers.
IntroductionAn object-oriented approach represents a rather fundamental rethinking and reprogramming of existing programs (see e.g. Budd, T., An Introduction to Object-Oriented Programming, Addison-Wesley, Reading, Mass., 1991, which has also beenavailable in a preliminary 2nd edition found on WWW). An interesting task is to formulate the Nelson and Winter family of models in terms of the object-oriented programming paradigm. This paradigm has its roots back in the Simula programming language and is now spreading both by means of specialised languages like Smalltalk and as an extension of existing languages like ObjectPascal, Objective-C, C+ +, Scheme, etc. Maple's programming language is not constructed for implementing the fundamental object-oriented concepts like encapsulation of data, messages and classes. For modelling purposes these design principles are, however, implementable in a Maple programming environment.In the present context, object-oriented programming can, with some right, be translated to actor-oriented programming. This means, that the units of the program are actors who react upon key words. These 'Requests' are names starting with a capital letter, like 'Supply', 'InvestmentDemand', 'Decide', etc. The requests may be supplemented by one or more arguments of importance for the response to the request. These arguments are names without an initial capital letter (except in the case of the standard names for the state variables: A and K). All actors have to be created explicitly. The initial group of actors is created at the start of the computation but later new actors (firms) may emerge as the result of entrepreneurial activity. In order to create an actor, the creating procedure must be supplied with a sequence of parameter values which determine much of the behaviour of the actor. Later some actors may, however, change their behavioural pattern because of their decisions to change the rules underlying their behaviour. An example procedureCreateFirm := proc()
local Firm;
Firm := subs(
{args},
proc(Request)
local A, actualMarkUp, deprCapital, desCapital, desFinance,
desMarkUp, expandContract, externalFinance, I_act, I_des,
I-max, imiEffort, info, innoEffort, K, Lottery,
marketShare, price, priceLid, profit, supply, targetMarkUp;
A := proc()
option remember;
end;
K := proc()
option remember;
end;
# InitialiseState
if Request = InitialiseState then
A() := A_init;
K() := K_init;
# Supply (and change technology)
elif Request = Supply then
supply := A()*K();
innoEffort := d_in*r_in*K();
A(in) := TechnoSpace(Decide, innoEffort, A());
imiEffort := d_im*r_im*K();
A(im) := max(seq
(Firm.i(TechnoInfo, country, imiEffort),i = 1..n));
A(next) := max(A(), A(in), A(im));
RETURN(supply);
# InvestmentDemand
elif Request = InvestmentDemand then
totalSupply := args[2];
price := args[3];
profit := price*A()*K() - (c + r_in + r_im)*K();
marketShare := A()*K()/totalSupply;
targetMarkUp := eta + (1 - marketShare)*psi/
(eta + (1 - marketShare)*psi - marketShare);
priceLid := .999*(price + P_max)*A(next)/(2*c);
desMarkUp := min(targetMarkUp, priceLid);
actualMarkUp := price/(c/A(next));
expandContract := 1 - desMarkUp/actualMarkUp;
desCapital := K()*(1 + expandContract);
deprCapital := K()*(1 - delta);
I_des := desCapital - deprCapital;
desFinance := I_des - profit - delta;
externalFinance :=
FinancialSector(Decide, desFinance, profit, K());
if externalFinance = bankruptcy then
A() := 0;
K() := 0;
else
I_max := delta + profit + externalFinance;
I_act := max(0, min(I_des, I_max));
K() := K()*(1 - delta) + I_act;
A() := A(next);
fi;
# OfficialStats
elif Request = OfficialStats then
RETURN(A(), K());
fi;
end);
Firm(InitialiseState);
RETURN(op(Firm));
end;
Other proceduresThe above procedure is only one of several procedures necessary to make an object-oriented version of a Nelson-and-Winter model. Among the other procedures are constructors for
|
|
Maintained by Esben Sloth Andersen, email: esa@business.aau.dk. Revision: 09 August 2004, 13:35.
|
||