Data Definition Language
A Data Definition Language (DDL) file describes the structure of data used by EvoAl. It defines what dimensions your data has,
what type of values each dimension holds, and optionally what constraints apply to those values.
DDL files use the .ddl file ending (see the import categories table in the common file syntax).
Basic Structure
A DDL file follows the same module and import rules as other EvoAl DSL files. The data
descriptions are placed inside a data: block within the module with 'x:0' and 'x:1' denoting any possible features. Here, 'x:0' could also be exchanged for 'temperature' and 'x:1' for 'time' for example.
module com.example {
data:
quotient real data 'x:0';
quotient real data 'x:1';
}
Each line inside the data: block declares one data dimension. A dimension declaration has
the following structure:
<scale> <representation> data <name>;
Scales
The scale describes the mathematical properties of a dimension’s values. EvoAl supports four scale types:
| Scale | Keyword | Description |
|---|---|---|
| Nominal | nominal |
Values are categories with no order, e.g. colours or labels |
| Ordinal | ordinal |
Values have a defined order, but differences are not meaningful, e.g. rankings |
| Cardinal | cardinal |
Values have a meaningful order and differences, but no true zero, e.g. temperatures in Celsius |
| Quotient | quotient |
Values have a meaningful order, differences, and a true zero, e.g. distances |
Representation Types
The representation type describes how values are stored. EvoAl supports four representation types:
| Type | Keyword | Description |
|---|---|---|
| Real | real |
Floating-point numbers, e.g. 3.14 |
| Integer | integer |
Whole numbers, e.g. 42 |
| Boolean | boolean |
True or false values |
| String | string |
Text values |
Annotations
Annotations attach additional information to a dimension declaration, such as constraints on the
allowed values. Annotations are placed before the dimension declaration they apply to.
Please remember that you have to import (c.f. Common File Syntax) the corresponding definition files to use the annotations.
An annotation starts with @, followed by its name and a block of key-value pairs:
@AnnotationName { 'key' := value; }
Multiple annotations can be stacked on a single dimension. The following example restricts the
dimension x:0 to values between -32768.0 and 32768.0, with both boundaries being inclusive:
@LowerBoundary { 'boundary' := -32768.0; 'inclusive' := true; }
@UpperBoundary { 'boundary' := 32768.0; 'inclusive' := true; }
quotient real data 'x:0';
Note that boundary annotations require the corresponding constraint definitions to be imported:
import "definitions" from 'de.evoal.core.constraints';
Constraints
The constraints section after the dimensions declares constraints between dimensions. Each
constraint compares two arithmetic expressions over the searched dimensions and the objectives
with <, <=, >, >= or =, and belongs to a named group:
import "definitions" from de.evoal.optimisation.constraint;
module search {
data:
quotient real data 'x:0';
quotient real data 'x:1';
constraints:
constraint(data 'x:0' + data 'x:1' >= 1.0, "budget");
'standard-deviation'(data 'x:0', 0.05);
}
'standard-deviation' declares the measurement uncertainty of a dimension, which the
'tolerance-measure' uses. How the optimisers measure and handle the groups is described in the
Optimisation Language.
Correlations
The constraints section can also declare correlations between two search features. They do
not restrict the search space; correlation-aware operators of the evolutionary algorithm and
the writer 'correlation-statistics' use them:
constraints:
correlation(data 'x:0', data 'x:1', 0.8);
'ranged-correlation'(data 'x:1', range(-1.12, 3.00), data 'x:2', range(-2.00, 0.00), 0.9);
| Declaration | Meaning |
|---|---|
correlation(f, g, rho) |
The features f and g are correlated with the coefficient rho in [-1, 1] |
'ranged-correlation'(f, range(l, u), g, range(l, u), rho) |
Like correlation, but only while both features lie in their ranges (bounds included) |
The coefficient is the Pearson correlation for cardinal and quotient features and the Spearman
rank correlation if a feature is ordinal. Nominal features have no order, so a correlation with
a nominal feature stops EvoAl when the file is loaded. Both
declarations come from de.evoal.optimisation.constraint. How the evolutionary algorithm uses
them is described in the
Optimisation Language.
Modules of Constraints
A module can hold only constraints and refer to the data of another module that it imports, e.g. correlations that a pipeline estimated from data (see the Generator Language):
import "definitions" from 'de.evoal.optimisation.constraint';
import "data" from 'search';
module 'estimated-correlations' {
constraints:
correlation(data 'x:0', data 'x:1', 0.802);
}
The constraints of a module count for a problem if the module declares one of its features or if
the OL module that specifies the problem imports it with import "data" from
'estimated-correlations'; (see the
Optimisation Language). Imports of a module are found on the
search path, i.e. relative to the working folder, so a generated module is best written next to
the configuration files.
Building Blocks
A building block is a group of search features that interact, i.e. the problem is not separable in them. Unlike a correlation, it has no coefficient:
constraints:
'building-block'([data 'x:0', data 'x:7', data 'x:12']);
'building-block'([data 'x:12', data 'x:20']);
A building block needs at least two features, none of them twice, and all of them search
features. A feature may belong to several building blocks (overlapping building blocks, as in
the second line). Building blocks may contain features of every type. The declaration comes
from de.evoal.optimisation.constraint. The term follows Harik and Goldberg (Learning
linkage, FOGA 4, 1996, section 2): the linkage of a building block is the probability that
crossover preserves it. The linkage-crossover of the evolutionary algorithm keeps building
blocks together, and the writer linkage-statistics measures how often recombination
preserves them; see the
Optimisation Language.
Structured Data
Structured data holds a model, a tree of objects, instead of a single value; an optimiser can
search such models (see Optimisers).
data 'policy' of instance policy; takes the classes of the model from the DL type policy
and its subtypes (see Annotations of model attributes).
The classes can also come from an existing Ecore metamodel (.ecore files). The annotation
@EcoreType of the module de.evoal.core.ecore names the files and the class of the root:
import "definitions" from 'de.evoal.core.ecore';
module search {
data:
@EcoreType { files := [ "policy.ecore", "conditions.ecore" ]; root := "policy.ecore#//Policy"; }
data 'policy' of instance 'ecore-model';
}
fileslists every.ecorefile the models need. A relative file is looked up beside the DDL file first, then in the working directory. All files are loaded together: a class can extend or contain classes of another file, and an abstract class can hold every concrete subclass of all files. A file that a listed file refers to but that is not listed, and a reference that does not resolve, are errors.rootis the class of the data as<file>#//<class>(<file>#//<package>/<class>in a subpackage), the file written as infiles.- The multiplicities and enums are the ones of the metamodel. A single-valued containment with
lower bound 0 is optional; an attribute only if it also is
unsettable. References to the container, derived, volatile, transient and unchangeable features are not searched; other non-containment references are not supported. - Number boundaries come from the facets
minInclusive,maxInclusive,minExclusiveandmaxExclusiveof the attribute’s data type (Ecore’s extended metadata), also from its base types. Attributes of the types boolean, int and double (also restricted ones) and enums can be searched; strings, longs and floats cannot. - The scale of an attribute is the annotation
https://evoal.de/v202704/models/core/scalewith the detailscale(e.g.ordinal); without it the attribute is nominal. - A plugin that brings generated Java code for the metamodel registers its packages; a listed file with the namespace URI of such a package is then only compared with it, and the models consist of the generated classes.
The writer model-xmi writes the found models as XMI
files of the metamodel, which other EMF tools can read.
Documentation Comments
You can document individual dimensions using documentation comments (/** ... */), placed
directly before the dimension declaration or its annotations:
/**
* The x-coordinate of the input data.
*/
@LowerBoundary { 'boundary' := -32768.0; 'inclusive' := true; }
@UpperBoundary { 'boundary' := 32768.0; 'inclusive' := true; }
quotient real data 'x:0';
The editor will provide give you this documentation as a tooltip, whenever you hover of the usage of a data entry.
A Complete Example
The following example shows a complete DDL file describing input and output dimensions for the Ackley function, including boundary constraints on the input dimensions:
import "definitions" from 'de.evoal.core.constraints';
module ackley {
data:
/**
* Input dimension for the Ackley function.
*/
@LowerBoundary { 'boundary' := -32768.0; 'inclusive' := true; }
@UpperBoundary { 'boundary' := 32768.0; 'inclusive' := true; }
quotient real data 'x:0';
/**
* Output dimension for the Ackley function.
*/
quotient real data 'y:0';
}