The initial idea of experiment environment configuration is as follows:
There must be a class dedicated to managing various experiment environment parameters, such as site length and width. For convenience, you can read files in the constructor of this class, use external XML as the configuration file to load various parameters. In this way, you can do the following during use:
Config =NewConfig ();//This is my environment configuration management class.VaRWidth = config. width;
But for the framework, this method seems to be easy to use, but it is actually difficult to do. Why? You are not sure about the parameters. Different experiments have different types of parameters. The parameters in Experiment 1 are long and wide. Experiment 2 is about length, width, and height. How can I set config. Property...
When I think about it again, I think the problem is complicated. The experiment environment configuration is still used for specific algorithms. Therefore, the framework only needs to provide a class to manage various parameters.
There is only one problem here. A class is required to save and obtain the variables.
// when initializing the experiment environment, save variable config. setproperty ( " width " , 500 ); /// Get variables during use var value = ( double ) config. getproperty ( " width " ); // get the variable var value = ( int ) config. getproperty ( " width " );
The problem is that when a variable is saved, the variable type is degraded to an object, so you need to remember the type of the variable.
Setting environment configuration during experiment initialization does not require writing static functions, initializing constructors, and reading files. Instead, it is not intuitive.