# As a Perl function: re.#!/usr/bin/env perl use Sim::OPT::Interlinear Sim::OPT::Interlinear::interlinear( "./sourcefile.csv", "./configfile.pl", "./obtainedmetamodel.csv" ); # or as a script, from the command line: perl ./Interlinear.pm . ./sourcefile.csv # (note the dot). # or, again, from the command line, for beginning with a dialogue question: interlinear interstart
Interlinear is a program for computing the missing values in multivariate datasieries through a strategy entailing distance-weighting the nearest-neihbouring gradients between points in an n-dimensional space. The program adopts a distance-weighted gradient-based strategy. The strategy weights the known gradients in a manner inversely proportional to the distance of their pivot points from the pivot points of the missing nearest-neighbouring gradients, then utilizes recursively the gradients neighbouring near each unknown point to define it, weighting the candidates by distance. In this strategy, the curvatures in the space are reconstructed by exploiting the fact that in this calculation a local sample of the near-neighbouring gradients is used, which vary for each point. The strategy in question is adopted in Interlinear since version 0.103. Before that version, the gradients were calculated on a global basis. Besides the described strategy, a), the following metamodelling strategies are utilized by Interlinear:
b) pure linear interpolation (one may want to use this in some occasions: for example, on factorials);
c) pure nearest neighbour (a strategy of last resort. One may want to use it to unlock a computation which is based on data which are too sparse to proceed, or when nothing else works).
Strategy a) works for cases which are adjacent in the design space. For example, it cannot work with the gradient between a certain iteration 1 and the corresponding iteration 3. It can only work with the gradient between iterations 1 and 2, or 2 and 3. For that reason, it does not work well with data evenly distributed in the design space, like those deriving from latin hypercube sampling, or a random sampling; and works well with data clustered in small patches, like those deriving from star (coordinate descent) sampling strategies. To work well with a latin hypercube sampling, it is usually necessary to include a pass of strategy b) before calling strategy a). Then strategy a) will charge itself of reducing the gradient errors created by the initial pass of strategy b).
A configuration file should be prepared following the example in the "examples" folder in this distribution. If the configuration file is incomplete or missing, the program will adopt its own defaults, exploiting the distance-weighted gradient-based strategy. in the last column in the last column The only variable that must mandatorily be specified in a configuration file is $sourcefile: the Unix path to the source file containining the dataseries. The source file has to be prepared by listing in each column the values (levels) of the parameters (factors, variables), putting the objective function valuesin the last column in the last column, at the rows in which they are present.
The parameter number is given by the position of the column (i.e. column 4 host parameter 4).
Here below is an example of multivatiate dataseries of 3 parameters assuming 3 levels each. The numbers preceding the objective function (which is in the last colum) are the indices of the multidimensional matrix (tensor).
Note that the parameter listings cannot be incomplete. Just the objective function entries can be. The program converts this format into the one preferred by Sim::OPTS, which is the following:
After some computations, Interlinear will output a new dataseries with the missing values filled in. This dataseries can be used by OPT for the optimization of one or more blocks. This can be useful, for example, to save computations in searches involving simulations, especially when the time required by each simulations is long, like it may happen with CFD simulations in building design.
The number of computations required for the creation of a metamodel in OPT increases exponentially with the number of instances in the metamodel. To make the increase linear, a limit has to be set for the size of the net of instances taken into account in the computations for gradients and for points. The variables in the configuration files controlling those limits are "$limit_checkgrades" and "$limit_checkpoints". By default they are both set to 10000. If a null value ("") is specified for them, no limit is assumed.
To call Interlinear as a Perl function (best strategy): re.pl # open Perl shell use Sim::OPT::Interlinear; # load Interlinear Sim::OPT::Interlinear::interlinear( "./sourcefile.csv", "./configfile.pl", "./obtainedmetamodel.csv" ); "configfile.pl" is the configuration file. If that file is an empty file, Interlinear will assume its defaults. "./sourcefile.csv" is the only information which is truly mandatory: the path to the csv dataseries to be completed.
To use Interlinear as a script from the command line: ./Interlinear.pm . "./sourcefile.csv" "./configfile.pl "; (Note the dot within the line.) If "./sourcefile.csv" is not specified, the default file "./sourcefile.csv" will be sought. If "./configfile.pl" is not specified, the program goes with the defaults.
Or to begin with a dialogue question: ./Interlinear.pm interstart; .
Gian Luca Brunetti (2018-19) <firstname.lastname@example.org>
Copyright (C) 2018-19 by Gian Luca Brunetti and Politecnico di Milano. This 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, version 3 or newer.