I am making available an economic planning language as first step in providing tools for the Green Plan project.

I have done this because it soon became apparent to me that the tools that I had released earlier to demonstrate the Harmony algorithm for planning were too hard to use. 

Consider that we start off from a collection of spreadsheets published by the statistical offices describing the input output and capital structure of an economy. We want to move from this to being able to specify a model of the economy in a form that can be subjected to Harmony planning. This model may well contain information that was not initially available in the input output tables, – multiple different technologies to produce electricity, carbon emissions, targets to be achieved. 

It would obviously be possible to build this model up entirely in a conventional programming language. This program would, in data structures, encode the relationships between industries, the targets to achieve, and would make calls on an algorithm library to solve the plan.

The problem with this approach is that an economic model expressed in for example Java or C would be hard to understand , debug and modify.

The standard approach in computer science to this sort of problem is to devise a domain specific language. Such a language is only able to deal with the specific problems of its domain. It will not, in most cases, be a Turing complete programming language.

Let us assume we have a language for economic planning, which, with a nod to Iverson, is called EPL. The overall planing process would then be as shown in the diagram below.

planprocessYou start off with data from published IO tables. Using this you build a model in the planning language.

This is a reasonably comprehensible textual format easily edited using a standard text editor.

The EPL plan is then fed into an EPL compiler that performs checks before evaluating the plan and producing details of a, perhaps new,  structure of the economy that would meet the constraints.

This plan report, in the form of spreadsheets can then be examined by human workers who then use editors to modify the EPL plan, depending on whether the suggested structure of the economy seems sensible.

Features of EPL

Kantorovich defined the planning problem in terms of a set of what he called techniques which combine productive resources to yield an output. Given these techniques and some initial set of productive resources, the planning problem is to determine the intensity with which each technique should be operated in order to best meet a plan target. The target itself is assumed to be a bundle of products in supplied in specified ratios.

EPL closely follows Kantorovich’s approach.

Techniques

A simple example technique is shown here:

Technique EX_FISHINGANDAQUACULTURE3 [
  755.0 FISHINGANDAQUACULTURE3
]-> 755.0 FOREX3;


What it says is that there is a technique called EX_FISHINGANDAQUACULTURE3 which takes 755 of FISHINGANDAQUACULTURE3 to produce 755 of FOREX3.

It is a very simple technique,  – the export of fishing and aquaculture products to obtain foreign exchange. The EPL language does not care what the names mean, nor what units the numbers are expressed in. In this example I have been following a convention that names all export techniques with the prefix EX_ and gives a suffix number to indicate the year of the plan that this applies to, but that use of naming conventions is optional.

A realistic economic technque, derived from information in the input output tables would be much more detailed. Below I give an abbreviated form of the technique for forestry and logging in the UK using data from 2015.

Technique	 T_FORESTRYANDLOGGING3	[
  	14.0 	CROPANDANIMALPRODUCTIONHUNTINGANDRELATEDSERVICEACTIVITIES3
   	301.0 	FORESTRYANDLOGGING3
   	1.0 	PROCESSINGANDPRESERVINGOFMEATANDPRODUCTIONOFMEATPRODUCTS3
   	1.0 	MANUFACTUREOFPAPERANDPAPERPRODUCTS3
   	3.0 	PRINTINGANDREPRODUCTIONOFRECORDEDMEDIA3
   	33.0 	MANUFACTUREOFCOKEANDREFINEDPETROLEUMPRODUCTS3
.....   	  
   	1123.08 	C__CCONSTRUCTION3
 	11.0 	CONSTRUCTION3  
.....
   	3.0 	PUBLICADMINISTRATIONANDDEFENCECOMPULSORYSOCIALSECURITYNONMARKET3
   	1.0 	ACTIVITIESOFMEMBERSHIPORGANISATIONSNPISH3
 	166.0 LABOUR3 
]-> 1069.0 FORESTRYANDLOGGING3;

The portion in the [ ] is a list of quantities of different inputs required to produce the national output of £1069 Million of forestry and logging. A couple of additional naming conventions are given here: A prefix C__ indicates a fixed capital stock required for production. So the forestry industry used £1123 M of buildings and installations produced by the construction industry, and used £11M directly in the form of new work from the construction industry.

In principle a technique could produce more than one output, in which case the list of outputs is put in brackets:

Technique A_C__GMANUFACTUREOFFABRICATEDMETALPRODUCTSEXCLUDINGWEAPONSAMMUNITION5	[ 
23.786406155016696 	MANUFACTUREOFFABRICATEDMETALPRODUCTSEXCLUDINGWEAPONSAMMUNITION5
]->	[
23.786406155016696 C__GMANUFACTUREOFFABRICATEDMETALPRODUCTSEXCLUDINGWEAPONSAMMUNITION6 
22.52543146969778 C__GMANUFACTUREOFFABRICATEDMETALPRODUCTSEXCLUDINGWEAPONSAMMUNITION7 ];

 

This takes £23.78 M of fabricated metal products in year 5 and results in an additional £23.78 million of fixed capital of that type in year 6 and just over £22M of that type of fixed capital in year 6 – less due to depreciation. But it is in effect what economists call an instance of joint production.

Resources

Resource statements are very simple, for example

Resource 	 928459.0	LABOUR1;

 

States that there is a resource of £928459 M of employable labour power in year 1. Similar statements can specify either initial stocks of fixed capital or allowable carbon quotas etc.

 

Targets

The target to be optimised is specified as a list of quantities of final outputs

Target[
	 14106.0 	CROPANDANIMALPRODUCTIONHUNTINGANDRELATEDSERVICEACTIVITIES1
	 141.0 	FORESTRYANDLOGGING1
	 516.0 	FISHINGANDAQUACULTURE1
	 197.0 	MININGOFCOALANDLIGNITE1
	 458.5 	EXTRACTIONOFCRUDEPETROLEUMANDNATURALGASMININGOFMETALORES1
	 102.72 	OTHERMININGANDQUARRYING1
...
];

etc, where … indicates lines left out.

Qualifiers

Techniques and products can be qualified. If a technique is defined thus:

Frozen Technique[ ....

It is specified that it must always operate at unit intensity.

An input can be specified to be non produced – that is to say, only available from pre-declared resources. You might declare labour or carbon quotas to be non produced in this sense.

Nonproduced[ LABOUR1];

One should also specify any products for which no final target need be set as non final.

Nonfinal[ LABOUR1];

In this case the planning algorithm will attempt to balance output + resources of the product with productive consumption.

Time

There is no real concept of time in the planning language. You can if you wish use naming conventions to indicate that particular variables denote economic quantities in different time periods. But this is purely for the human reader. From the standpoint of the language, the internal structure of names do not mean anything.

Usage

The command to run the compiler is

java planning.Eplc sourcefile productionresultsfile [options]

a -h as a suffix produces the following help information

java planning.Eplc -h
usage:
java planning.Eplc sourcefile productionresultsfile [options]
 options
-V 			verbose
-Ixxx 			xxx number of iterations to run the optimiser for 
			 default 10
-phaseTwoadjustxx 	where xx are two digits specifying the percentage
			adjustment done in phase 2
			 default 40
-capacityTargetxx 	where xx are two digits specifying the percentage
			utilisation of resource aimed at
			 default 98
-startingtempxx 	where xx are two digits specifying the percentage
			move in intensity each iteration
			 default 2
-nophaseX 	where X =1 or 2 switch off phases of re scaling 
-usemeanmethod 	base expansion or contraction on mean input harmony not derivatives
-h 			print this text


 

In general you will not use the flags.

Source

The java source of the compiler is available from github here.

Formal Syntax Specification

The following syntax is given in Sable
/*
 EPL
 
Languge for specifying economic plans
*/


Package Epl;
 
Helpers
  letter = [['A'..'Z']+['a'..'z']];
  digit = ['0'..'9'];
  ubar='_';
  alphanum = [letter+['0'..'9']]|ubar;
  cr = 13;
  lf = 10;
  tab = 9;
    digit_sequence = digit+;
    fractional_constant = digit_sequence? '.' digit_sequence | digit_sequence '.';
    sign = '+' | '-';
    exponent_part = ('e' | 'E') sign? digit_sequence;
    floating_suffix = 'f' | 'F' | 'l' | 'L';
  eol = cr lf | cr | lf;        // This takes care of different platforms
  not_cr_lf = [[32..127] - [cr + lf]];
  exponent = ('e'|'E');
  quote = ''';
  
  all =[0..127];
  schar = [all-'''];
  not_star = [all - '*'];
  not_star_slash = [not_star - '/'];
  not_star_ket =[not_star -')'];

/* The tokens section defines the terminal symbols of the grammar.*/
Tokens
  floating_constant =  fractional_constant exponent_part? floating_suffix? |
        digit_sequence exponent_part floating_suffix?|digit_sequence;
 frozen='Frozen';
 tech='Technique';
res='Resource';
targ='Target';
nonft='Nonfinal';
nonpt='Nonproduced';
bra='[';
ket=']';
semicolon=';';
arrow='->';

/*  identifiers come after reserved words in the grammar */
 identifier = letter alphanum*;  
 blank = (' '|cr|lf|tab)+;
 comment = '/*' not_star* '*'+ (not_star_slash not_star* '*'+)* '/';
 codecomment = '(*' not_star* '*'+ (not_star_ket not_star* '*'+)* ')';

Ignored Tokens 
	blank,comment;
 
Productions
 program =statementlist;
 bralist= bra list ket;
 list = head atom*;
 head =atom;
 nonf = identifier;
 nonp = identifier;
 nonfin= nonft bra nonf* ket;
 nonprod= nonpt bra nonp* ket;
 atom = floating_constant identifier;
 target = targ bralist;
 resource = res atom;
 technique = tech identifier bralist arrow product;
   
 product= producttail;
 producttail = atom |{joint}bralist;
 statement = {resstat}resource
     |{techstat}technique
     |{ftechstat}frozen technique
     |{targstat}target
     |{finalstat}nonfin
     |{prodstat}nonprod;
 statementlist 	= statement semicolon statements*;
 statements 	= statement  semicolon;