CAMBRIAN Mono and Multiulti-Objective Optimization Platform Last versions of Cambrian are meant to be universal tools to find the optimal solution of any type of optimization problem (mono and multi objective) by assembling and combining many known optimization algorithms and also offer an easy way to implement new approaches in optimization. Since Cambrian evolved as “Genetic Algorithms Software” has its roots in the concept of nature genetics (variables are known as genes, evolution iterations are known as generations, objectives is known as phenotype, etc.) so all further implementations of methods are using this concept and convert the information so it can be understood (particle swarm interpret genes fields as location in multidimensional space). The “concept” dates from 1866 when Mendel recognized that nature stores the complete genetic information for an individual in pair wise alleles. The genetic information that determines the properties, appearance, and shape of an individual is stored by a number of strings. Later, it was discovered that the genetic information is formed by a double string of four nucleotides, called DNA. Mendel realized that nature distinguishes between the genetic code of an individual and its outward appearance. The genotype represents all the information stored in the chromosomes and allows us to describe an individual on the level of genes. The phenotype describes the outward appearance of an individual. A transformation exists – a genotype-phenotype mapping or a representation – that uses the genotype information to construct the phenotype. To represent the large number of possible phenotypes with only four nucleotides, the genotype information is not stored in the alleles itself, but in the sequence of alleles. By interpreting the sequence of alleles, nature can encode a large number of different phenotype expressions using only a few different types of alleles. When talking about individuals in a population, we must carefully distinguish between genotypes and phenotypes. The phenotype appearance of an individual determines its success in life. Therefore, when comparing the abilities of different individuals we must judge them on the level of the phenotype. However, when it comes to reproduction we must view individuals on the level of the genotype. During sexual reproduction, the offspring does not inherit the phenotype properties of its parents, but only the genotype in formation regarding the phenotype properties. The offspring inherits genetic material from both parents. Therefore, genetic operators work on the level of the genotype, whereas the evaluation of the individuals is performed on the level of the phenotype. In the following figures (A, B, C) the main panels of Cambrian application are presented, and in the next chapters the software is explained in detail. Note that Cambrian software is property of Optimal Design Centre of Technical University of Cluj-Napoca, Romania, and it is developed within the frame of PN-II-ID-PCE Projects of Romanian Government (Project Code ID_1077). Several demos of Cambrian are available at http://catomt.east.utcluj.ro/id1077/CAMBRIAN.html 1 Figure A. Execution panel 2 Figure B. Resulst panel 3 Figure C. File panel (settings save/load) 4 1. Cambrian application The application was built in two directions to increase further development (programming level) to ease its usage (user level).The programming level offers tools to ease development, increase speed and stability and is in heavy changing process without altering early developed components. The user level is somehow stable at this point and offers the graphical user interface for the user to interact and modify the algorithm. 1.1. Programming level This level refers to all libraries developed as classes in Java. The whole application was developed with heavy relations between objects so any modification could decrease the risk of malfunctioning without warnings. This offers the advantage to develop further objects and ensure the functionality of older ones. Algorithm 1 Cambrian main execution 1:reset_population(no) 2:if (generation==0) then 3: for counter=0 to before_cycle_count then 4: if (conditions_satisfied==true) then 5: before_cycle_component[counter].execute 6: end if 7: end for 8:end if 9:for iterations=0 to no_generations then for counter=0 to main_cycle_count then 10: 11: if (conditions_satisfied==true) then main_cycle_component[counter][phase].execute 12: 13: end if 14: end for 15:end for 16:for counter=0 to after_cycle_count then 17: if (conditions_satisfied==true) then 18: after_cycle_component[counter].execute 19: end if 20:end for In order to provide to the algorithm and user fully prepared population and settings, Cambrian is divided in three main cycles: • before execution cycle – designed to be executed once at generation 0 and used to initialize objects, prepare files, etc. This cycle will not be executed if the optimization cycle has stopped and a number of generations are set to continue from the actual state • main execution cycle – this cycle will be executed an amount of iterations set by the user and it contains the optimization algorithms itself. This cycle is divided in phases and can be switched from one phase to another by using certain components and proper conditions. This multiplephase principle divides the optimization into branches and offers the user to use multiple scenarios and optimization techniques. • after execution cycle – cycle used mostly to prepare the population for user analysis. Mostly this 5 component uses sorting components to exponentiate best solution with satisfying multiple criteria, visualization component like charts and graphs, etc. This cycle is executed at each stop of a number of iterations. If the user wants to analyze evolution every 10 generations this component will be used at the every 10'nth generation. Cambrian tries to decrease the probability of malfunctioning of newly implemented components by using both OS's output and its own message console. Application's console is always assisted by the status bar witch is visible in all panels and it displays last message appeared on the console. Components are independent and can be dynamically load into Cambrian using the cycle menu in order to provide an easier debugging, correction and testing. Loading components dynamically, Cambrian must comprehend compiled class structure and use same methods as the model. The model defined in Cambrian as componentModel is the base class of components. In order to function correctly each of this components must extend componentModel class and not to modify its methods declarations. componentModel class componentModel class represents the smallest unit in Cambrian application but one of most importance because based on its model, all other components are created. It was created to create one single concept both in programming and user interaction. componentModel can be modified but without altering current method definition or variable type otherwise it will render all other precompiled components useless. Properties : GUI – defines the graphical interface of the component offering the user the interaction needed to manipulate the behavior. optionsWin – offers the possibility to add global and individual execution conditions and selection of the population on witch the main execution process is applied. publicKey – offers to the component an individual signature so that it could be differentiate from other. Methods : returnInfos – used to return informations about the current state of component resetCounters – resets component's counter if exist globalOperations – method called at population reset and used to manipulate global class's properties retGUI / returnComponent – used by the Cambrian main application to retrieve graphical interface of component at redraw. retPublicKey – returns component's public key saveSettings – returns an array containing particular settings of component loadSettings – used to load component settings based on the public key from a saved file onParents – returns true if component is applied on parents. The option can be modified from the Options Window. onOffsprings – returns true id component is applied on offspring. addField – used if component need to add a field at each individual to store particular information (ex. fitness, id) execute – is the main method and is called at each iteration (generation). This method is allowed to manipulate current population and some Global properties. 6 Figure 1: componentModel class To maintain component integrity Cambrian does not allow property modification by another component. To solve communication problem between component application offers in the Global object one variable that can store any kind of information and parent properties witch can be evaluated, interpreted and modified. To assembly the algorithm all components must be placed in specific order and in specific runtime cycle in order to be fully functional. Altering the order of algorithm components will not return any error because Cambrian was designed to run any type of algorithms and will run its iterations. One runtime cycle is defined as componentPanel witch manages all components within. To perform analysis of information traffic and communication was developed the global class, static property in Cambrian (same in all classes), and manages all population, component panels, problem properties, console, etc. performing parallel population transactions, append to console, stop execution, alter status and phases. Population management class The population management class was designed and optimized for high speed information transfer between population and Cambrian or operators. To decrease risk of error, each property of population class it is private and can be accessed only through methods. With Cambrian 3.0 population management was moved from memory stored MySQL database to direct memory access to array vectors of fields and increasing its speed up to 8 times per generation. One individual carry its information in an array of fields (field class) and can be identified in population as one row of cell vector. Field class was introduced with version 3.03 in order to insert new type of variable for storing permutation arrays. Figure 2 represents population object with all containing elements, and further development directions. Stored data was structured in private access vectors to avoid alteration of Cambrian's speed and stability. Ex. interrogating certain information cell of certain individual the method uses both fields list and only preferred individual values list without parsing the whole array. 7 Figure 2: Population object and component Field class Field class represents the smallest information cell that assembles one individual into population. Properties geneType – used to define whether the filed is a gene type field or common information storage unit type – sets the field type (double, permutation) tip – integer version of the type variable used for faster paring methods (0 – double, 1 – permutation) permvalue – integer array containing the order of permutation elements permlength – integer variable used to store number of permutation elements prec – precision of double variables in decimals value – field's value min, max – if field is defined as gene those variables are used to store gene's domain Methods isGene – returns true whether the field is defined as gene or false otherwise setupPermGene – resets the field as permutation field using leng argument to define its number of elements geneDef – method used into population reset process for faster definition of field as gene setDomain – defines gene's domain 8 returnType – return 0 if field is gene and defined as double, 1 if field is gene and defined as permutation and 2 if field is not gene as an error message returnMin – returns smallest domain value returnMax – returns greatest domain value returnPrecision – returns precision in decimals if field is defined as double returnPermLength – return number of elements if field is defined as permutation returnTypeS – returns gene's type in string format regenerateWSeed – used to reset the field. The seed is used if field is defined as gene to obtain the exact value on all reset processes. regenerate – used to obtain a random value within domain if field is defined as gene retDouble – return field's double value retPerm – return field's permutation value in integer array format returnPosition – used for permutation gene types to restore position in permutation of certain element returnString – return permutation value in string format setValue – sets field's double value setPerm – sets fields' permutation value retSettings – return all field's definition used in the save process setSettings – sets field as defined in the a argument used in the load process Figure 3: Field object properties and methods 9 Figure 4: Population properties and methods 10 Properties cell storage vector of population's individuals childscell - storage vector for temporary individual storage. In GA this vector is used to store and sort offspring individual before merging with main population selected – storage vector of number pairs used to mark further parents in offspring creation fields – stores name of population fields, materialized into visualization area as table header transition – variable used by components to communicate information during execution. Confusion is avoided by evaluating one private key used by both components that need to transfer information. geneData – stores gene information data in string format. Used for faster saving procedure noFields – returns in integer format the number of fields used by population phase – returns current phase of current population Methods passesCondition – used to evaluate whether specific individual satisfies all conditions declared by user in the individual conditions field or custom condition declared into condition argument. Method is available also for offspring subpopulation getSize – return number of individual of subpopulation retField – used for parsing certain field data. (e. g. check whether field is gene type, gene domain, etc.) addField – used to insert field into current population. Called by the reset population method at parsing component panels to check whether component need its own tracking field addPermGeneField – used to insert one gene of type permutation with field argument as name and with certain number of elements defined by length addGeneField – used to insert one gene of type double, declaring its domain and used precision for evaluation moveCellDown – decreases specific individual in hierarchy moveCellUp – increases specific individual in hierarchy remakeIndex – recreates population indexes by rewriting id field. Method used by all sort components after altering hierarchy returnValue – returns specific individual defined by row argument at col field in double format returnPermValue – returns specific individual defined by row argument at col field in integer array format returnPermString – returns specific individual defined by row argument at col field in string format returnFields – returns one array of strings with fields names insertSelected – insert to selection list sel individual getFields – return field names in string format getField – return certain field name in string format addNull – method used to add one null individual to any subpopulation. Individual will have its value 0 on all double type genes and identical permutation for permutation type genes noFields – return number of fields increaseFieldsNo – increases number of fields by one. decreaseFieldsNo – decreases number of fields by one, deleting the last one added returnIndex – returns index of field argument setValueOf – sets double value of certain field and specific individual of any subpopulation setPermValueOf – sets permutation array value of certain field and specific individual of any subpopulation getValueOf – return value in double format of certain field and specific individual of any 11 subpopulation getPermValueOf – return integer array of certain field and specific individual of any subpopulation setPhase – sets the current phase of population in evolution getPhase – returns current phase of population in evolution setNof – sets number of fields getNof – returns number of fields getStd -returns parents subpopulation in vector format setSelected – sets individual selection vector getSelected – returns all selected individuals getCellSize – returns size of parents subpopulation getChildsCellSize – returns size of offspring subpopulation setTransition – adds one transition variable defining its value getTransition – returns transition variable Algorithm 2 Component model with population manipulation gene1_index=population.returnIndex( gene1 ) objective1_index=population.returnIndex( objective1 ) constraint1_index=population.returnIndex( constraint1 ) if (component_apply_on_parents=true) if (individual_satisfy_conditions=true) for i=1 to no_of_genes do gene(i)=population.getValueOf(gene1_index+i, parents_subpopulation) end for res_array=calculate(gene) for i=1 to no_of_objectives do population.setValueOf(objective1_index+i,res_array[i], parents_subpopulation) end for for i=no_of_objective to no_of_constraints+no_of_objectives do population.setValueOf(constraint1_index+i,res_array[i] parents_subpopulation) end for end if if (component_apply_on_offsprings=true) if (individual_satisfy_conditions=true) for i=1 to no_of_genes do gene(i)=population.getValueOf(gene1_index+i, offspring_subpopulation) end for res_array=calculate(gene) for i=1 to no_of_objectives do population.setValueOf(objective1_index+i,res_array[i], offspring_subpopulation) end for for i=no_of_objective to no_of_constraints+no_of_objectives do population.setValueOf(constraint1_index+i,res_array[i] offspring_subpopulation) end for end if end if 12 Algorithm 2 represents common execution method of objects developed on componentModel class. Version 3 of Cambrian was built optimized for speed by grouping individual fields such as genes, objectivs, constrants, etc. allowing storing only the position of first element in group and size of group and using common cycles to get or write information 1.2. User level The user level is referred to Cambrian interface used to offer and get information from the user, communicate messages (information, warnings, errors) and assemble algorithms. The graphical user interface uses common widgets (buttons, combo boxes, list boxes, etc.) customized for better visualization. Customization of graphical components was necessary to offer user the possibility to view as much as possible information on the screen to ease comprehension and algorithm composing and debugging. Cambrian button SWING button Figure 5: Optimization on visual components Cambrian's interface is four tab elements: Execution – used to assemble the algorithm Results – used to analyze population File – common file save/load operations and adjusting main settings Diagram – algorithm viewer as diagram Execution tab The execution tab is used mostly for algorithm building, evaluation and modification being designed with flexible parallel panels for each phase of execution. One single panel of the execution tab is related to the “insert component” option button used to insert known Cambrian objects into the preferred phase. Insert component button displays at click one popup menu with all components grouped in nine sub-menus (objective, additional, fitness, selection, crossover, mutation, sorting, local search, PSOA). Selection one of the components from preferred sub-menu will add desired object at the end of the parent panel. Figure 6: Add component menu 13 At startup the execution tab will contain three empty phases Before cycle, Phase 1, After cycle witch can be modified by adding more phases (or removing) from the file tab. Modification of the number of phases is made in real time and no refresh is needed from the user. After deleting one phase all components contained will be destroyed also and can not be restored after adding it back. Save and restore of all runtime including before and after cycle is made by using save/load buttons from the file panel (for named savefiles) or by pressing F6 key (for default saving file) Results Figure 7: Part of results tab The results tab is used only for evaluation and analyzing of population at one certain time in the evolution. It contains one query text box at the top of the panel, the main table and the execution button witch is used to execute the query. The layout was designed in order to allow copy of table contents but any alteration of values will not modify population fields. For better visualization the table cells width will not be modified for a larger number of population field and will be used scrollbars both vertical and horizontal. File The file tab has more attributes than any other tab used in Cambrian. It is used for saving and restoring execution from custom file and default, loading objective function, set population size, number of population, number of phases and evaluating console results. 14 File tab operation groups global algorithm operation new – clears all settings and resets the component panels save – saves current settings to default file for faster loading (ex. F6 key) save as – saves current settings to named file at preferred location in the filesystem load – loads settings from file at preferred location in Figure 8: save restore group the filesystem new/modify algorithm settings problem/load problem sub-group – composed from one list box witch displays all loaded objective functions and one button for confirming the modification is used mostly in new algorithm assembly. Altering the content of the list box and confirming the modification will not replace the calculate components from the execution panels number of individuals – modifies the number of individuals per population at reset number of populations – modifies the number of parallel population at reset reset button – initializes specified number of populations and number of Figure 9: Basic algorithm settings individuals contained with a given seed. number of phases – group containing one text box and two buttons used to alter the number of execution panels and phases used in the algorithm. The text box is made read-only modification being possible by clicking one of the Add phase or Remove phase button because of complex operations. Figure 10: Number of phases console – the console was built to help the user to notify and correct the errors appeared in the algorithm assembly. It was necessary since from version 4 of Cambrian all objects saved as components cannot communicate between and are totally independent. The console have three types of messages : information messages – notifies the user with harmful common messages (ex. optimization started, population initialized, etc.) warning messages – notifies the user with operations that may alter good execution of the optimization algorithm without stopping the evolution 15 error messages – notifies the user in order to correct critical error and stops the evolution from running. The console is divided in three visual spaces : icon area – used to indicate type of message (information, warning, error) time of occurrence area – built for speed optimization of Cambrian it displays the time when message appeared message area – displays actual message of notification Figure 11: Console displaying messages Diagram The diagram tab is designed only for global visualization of algorithm and no modification can be made within this tab. This visual component displays content of component panels in horizontal lines with different rendered graphics. The diagram cell is divided into three compartments: Figure 12: Diagram sample 16 North – name of component Center – on witch subpopulation component is applied and component condition South – individual condition and the number of component / phase Component interfaces Cambrian components are written to be user friendly by maintaining same graphical user interface witch follows certain rules in design process. The component can change execution functions and content of its window and not the top elements. The top section of each component contains : options button – used to display the options window title string – displays the title of the component up button – moves component higher in execution hierarchy down button – moved component lower in execution hierarchy delete button (x) – erases component from execution cycle and flushes content from memory Figure 13: Top section of the component The options window contains: subpopulation selection check boxes – (Apply on parents, Apply on offspring) can be selected at the same time and runs the execution function on preferred subpopulation (or both) Operator condition – Check whether the component, population or condition satisfies the regular expression and runs the component if true of skip to next in hierarchy if it returns false. In the example the component will be executed with a probability of 70%. Individual condition – This condition written also as regular expression and is used to filter individuals of selected subpopulation on witch the execution function will be applied. In the example the individual witch has the score field equal to 0 and id field smaller than 50 will be evaluated and altered. Figure 14: Options window 17 Figure 15: Fitness SP component Figure 15 illustrates the graphical user interface of the previously exemplified component with both upper elements and component particular elements. The component can enable and disable elements within options window to ensure a correct execution. Fitness SP component contains one altering component (Selection pressure) and one result display (pressure graph). 18 2. Cambrian visualizing component 2.1. Charting tool The charting tool is one of most powerful evolution visualizing tool. The charting tool is written as Cambrian component and follows the same rules and can be executed on preferred subpopulation with certain rules written as regular expressions. In optimization process this tool can be used to display : population distribution – individual location on a 2D field using regular expressions to filter and divide individuals into series. Filtering individuals and attaching them series insure a correct display of its status by using different color. The following example represents the feasible area filtered as series one by selecting every individual in parents subpopulation who satisfies all constraints and the infeasible area filtered as series two by selecting individuals witch does not satisfies at least one constraint. Figure 16: 2D distribution of individuals with series applied 19 Figure 17: Chart settings to display points’ distribution Pareto front – population objective functions in 2D plane. The multi objective optimization problem (MOP) (also called multi criteria optimization, multi performance or vector optimization problem) can be defined (in words) as the problem of finding a vector of decision variables which satisfies constraints and optimizes a vector function whose elements represent the objective functions. These functions form a mathematical description of performance criteria which are usually in conflict with each other. To analyze Pareto front in the optimization process, the chart requires two objectives to be entered in the (and at least one condition related to the front field to be entered. Figure 18: Chart settings to display first Pareto front Using the charting tool in different phases will result in displaying multiple windows with parent window rules and it will be refreshed only when component will be executed to ensure a faster optimization process. The chart widget supports zooming in and out, panning, auto ranging and export to .PNG format for further reports. This tool can also be used as overall population evolution within time and analyze point of premature convergence in time. The premature convergence it is displayed on graph as one straight line representing the uniformity of individuals in the displayed objective. 20
© Copyright 2025 Paperzz