General Description
Internally, EvoAl uses the Properties (not Java properties) structure to represent individuals or training data. It can be found in de.evoal.core.api.properties
. A properties instance consists of an array of data and a PropertiesSpecification
. The specification lists for each index what data is stored at the index. A single PropertySpecification
consists of a name and a corresponding DataDescription
which is part of a data description file.
classDiagram
class Properties {
-Object [] values
}
class PropertiesSpecification {
}
class PropertySpecification {
+name : String ~readonly~
+type : DataDescription ~readonly~
}
Properties *-- PropertiesSpecification : specification
PropertiesSpecification *-- PropertySpecification : properties
This modelling allows us—at every point in time—to determine the data type of a value. A PropertiesSpecification
can be created, using the provider PropertiesSpecification.Builder
class which implements the builder pattern.
Manually creating a properties specification
In the case that you have to create a Properties
by hand, e.g., when writing a test case, you have to create all the mentioned stuff by hand:
import de.evoal.core.api.properties.Properties;
import de.evoal.core.api.properties.PropertiesSpecification;
import de.evoal.languages.model.ddl.*;
class Example {
public void method() {
final UntypedDataDescription description = DdlFactory.eINSTANCE.createUntypedDataDescription();
description.setName("name");
description.setRepresentation(RepresentationType.REAL);
description.setScale(ScaleType.ORDINAL);
final PropertiesSpecification specification = PropertiesSpecification.builder()
.add(Stream.of(description))
.build();
final Properties props = new Properties(specification);
props.put(specification.get(0), 3.0);
}
}