platon - an open optimisation framework - wseas · platon - an open optimisation framework ... -...

6
Platon - an open optimisation framework CHRISTIAN HEIMANN Institute of Scientific Computing Technical University Braunschweig 38106 Braunschweig GERMANY Abstract: - The use of optimisation algorithms in industrial application areas is not easy, not only because of possible difficult problems, but also for software reasons. The user often wants to optimise a system, for which a simulation code already exists. But these codes are mostly written in a non modular fashion and therefore not easily integrated with an existing optimisation code. Platon, developed by the Technical University of Braunschweig, is an open system, which offers interfaces to integrate new algorithms, (both optimisers and simulation codes) and hence allows to freely combine the simulation code with different optimisation algorithms in various combinations. It enables parallel analyses of the objective function by replicating a sequential simulation code on a cluster of machines, e.g. a cluster of workstations or a parallel computer. The advantage of such an open approach are shown by coupling Platon with Matlab, a well-known package for numerical analysis. It not only offers simulation codes, using Simulink, but also contains optimisation algorithms, implemented in Matlab, and hence can be used in two ways - as simulator and optimiser. We use an example from control engineering to demonstrate how the combined code and Platon interface works. Key-Words: - optimisation, parallel analyses, cluster of workstation, parallel computer, Matlab, open system, Platon, Simulink 1 Introduction Secondary conditions such as costing and time reductions in the development of large systems make the use of simulation calculations necessary. These simulations are often time intensive and therefore can benefit either from a parallelism of the simulation code or from a replication of the sequential code on a cluster of machines. In industrial application areas these simulation models often depend on several problem describing parameters, which are specified by given limits based on the physical model. The aim of the engineer is to find a set of model parameters, which specifies a good solution, according a given objective function. Optimisation software is mostly tailored to a special task and therefore very hard to transfer to other application areas, also it is difficult to integrate new optimisation algorithm in the package. Additionally the engineer knows about the application area, but he should not be an expert in computer sciences, nor a mathematician. Platon, a synonym for “Parallel Adaptive Techniques for Optimisation”, is an open system, which offers interfaces to integrate new optimisation algorithms and simulation codes and hence allows to freely combine the simulation code with different optimisation algorithms in various combinations. The system components communicate among themselves by means of the communication library Parallel Virtual Machine (PVM). The system presented here enables parallel evaluations of the objective function by replicating the sequential code on a cluster of machines, e.g. a cluster of workstations or a parallel computer. The modular approach and well-defined interfaces allow the optimisation strategies to be exchanged by third-party algorithms. In this article we focus on coupling Platon with Matlab [3], a package for numerical analysis. This approach allows to use PLATON in these application areas, where simulation codes are written in Matlab, e.g. using the toolbox Simulink [3], but also enables integrating optimisation algorithms, implemented in Matlab, into the framework. The example from the area of control engineering will demonstrate how the combined code and Platon interface works. It will be shown, that in special cases coupling optimisation and simulation codes, both written in Matlab, with Platon should be given preference to a direct coupling in Matlab itself, because of the parallel calculation of the simulation code. A prerequisite for this coupling is the availability of at least two Matlab processes.

Upload: lycong

Post on 26-Jun-2018

244 views

Category:

Documents


7 download

TRANSCRIPT

Platon - an open optimisation framework

CHRISTIAN HEIMANN Institute of Scientific Computing

Technical University Braunschweig 38106 Braunschweig

GERMANY

Abstract: - The use of optimisation algorithms in industrial application areas is not easy, not only because of possible difficult problems, but also for software reasons. The user often wants to optimise a system, for which a simulation code already exists. But these codes are mostly written in a non modular fashion and therefore not easily integrated with an existing optimisation code. Platon, developed by the Technical University of Braunschweig, is an open system, which offers interfaces to integrate new algorithms, (both optimisers and simulation codes) and hence allows to freely combine the simulation code with different optimisation algorithms in various combinations. It enables parallel analyses of the objective function by replicating a sequential simulation code on a cluster of machines, e.g. a cluster of workstations or a parallel computer. The advantage of such an open approach are shown by coupling Platon with Matlab, a well-known package for numerical analysis. It not only offers simulation codes, using Simulink, but also contains optimisation algorithms, implemented in Matlab, and hence can be used in two ways - as simulator and optimiser. We use an example from control engineering to demonstrate how the combined code and Platon interface works. Key-Words: - optimisation, parallel analyses, cluster of workstation, parallel computer, Matlab, open system, Platon, Simulink 1 Introduction Secondary conditions such as costing and time reductions in the development of large systems make the use of simulation calculations necessary. These simulations are often time intensive and therefore can benefit either from a parallelism of the simulation code or from a replication of the sequential code on a cluster of machines.

In industrial application areas these simulation models often depend on several problem describing parameters, which are specified by given limits based on the physical model. The aim of the engineer is to find a set of model parameters, which specifies a good solution, according a given objective function.

Optimisation software is mostly tailored to a special task and therefore very hard to transfer to other application areas, also it is difficult to integrate new optimisation algorithm in the package. Additionally the engineer knows about the application area, but he should not be an expert in computer sciences, nor a mathematician.

Platon, a synonym for “Parallel Adaptive Techniques for Optimisation”, is an open system, which offers interfaces to integrate new optimisation algorithms and simulation codes and hence allows to freely combine the simulation code with different optimisation algorithms in various combinations. The system components

communicate among themselves by means of the communication library Parallel Virtual Machine (PVM).

The system presented here enables parallel evaluations of the objective function by replicating the sequential code on a cluster of machines, e.g. a cluster of workstations or a parallel computer. The modular approach and well-defined interfaces allow the optimisation strategies to be exchanged by third-party algorithms.

In this article we focus on coupling Platon with Matlab [3], a package for numerical analysis. This approach allows to use PLATON in these application areas, where simulation codes are written in Matlab, e.g. using the toolbox Simulink [3], but also enables integrating optimisation algorithms, implemented in Matlab, into the framework.

The example from the area of control engineering will demonstrate how the combined code and Platon interface works. It will be shown, that in special cases coupling optimisation and simulation codes, both written in Matlab, with Platon should be given preference to a direct coupling in Matlab itself, because of the parallel calculation of the simulation code. A prerequisite for this coupling is the availability of at least two Matlab processes.

2 Motivation As we mentioned above, the engineer, knowing well his application area, is not always an expert in computer sciences, nor a mathematician.

The user of an optimisation package wants to get a solution for his problem as fast as possible and as accurately as achievable. Also there should be as little as possible overhead by installing, learning and using the software package. This mostly leads to a highly integrated software package, written for a special application, and very hard to adapt to other application areas.

Using a numerical package like Matlab makes it easier for the engineer to test new optimisation algorithms, if he is familiar with this topic, or to use third-party codes. But there will always be technical difficulties combining the application code with the optimisation algorithm, implemented in Matlab.

Implementing the simulation code in Matlab means a very hard and time-intensive reengineering process, even if the source code is available. Additionally this implementation may hurt the runtime requirements of the code and is then worthless.

We try to solve this problem, defining interfaces between Matlab and Platon on the one side and between Platon and the simulation code on the other side. As a matter-of-fact the Matlab user will have some new commands, to interact with the Platon system. This enables calling Platon from inside the Matlab environment. A request for an evaluation has the same syntax, even if it is send via the Platon environment. 3 Separation of Tasks An optimisation software system basically consists of a definition section, which could be a kind of user interface, an optimisation algorithm g and the objective function f(x), where x is the search space. If we look for the solution in a subspace of the this search space, we call the variables, spanning this subspace, the design parameters, whereas the other parameters are called fixed. The variable, which contains the function value, is called the objective parameter. If we have additionally information about the function at special points in the search space, like the gradient and the hessian, the values are stored in parameters called free. Figure 1 shows this three-divided modular approach: the definition, the optimisation and the simulation module. The search space consists of the subspace of design and fixed parameters, whoose values are needed for the simulator to determine the objective function.

Fig.1: abstract optimisation model

Fig.1 shows the abstract model of an optimisation process. The input values of the objective function (1) have to be of parameter type free (fr), design (d) or fixed (fx), whereas there must be exact one ouput value of the objective type (o). Values of type free can be used for a bi-directional exchange of values between simulation and optimisation codes.. f(d,fr,fx) = [o,fr] (1) The optimisation task is to find a “good” parameter set according to the given objective function. Therefor a minimizer has to be found for the subspace [fx, d] (2) using additional information offered by the objective value and the probably available values of free type (3). The function g represents an optimisation algorithm. minimize f([d, fx]) (2) [d, fx] = g([d, fx, fr, o) (3) It is easy to understand that such a modular approach, motivated by the principle of modularity, allows to exchange optimisation strategies or to use more than one simulator at the same time for a parallel evaluation of the objective function.

Fig.2: parallel evaluation of the objective function

Fig.2 outlines the theoretical approach coupling an optimisation algorithm with an simulation code running in parallel. Here we use a simple coarse grain parallelism on the simulation code layer, because of the independence of the objective-function evaluation. As a-matter-of-fact this kind of parallelism simplifies an integration of simulation codes without running a reengineering process on the code itself. The arrows mark the well-defined

interfaces between the different modules with the parameter handing. Fig.2 indicates that the optimisation algorithm g itself is responsible to create the search points in the space. 4 The Platon System In this section we will discuss the conversion of the ideas we just presented. Fig.3 shows the modular system of Platon, the design of, is driven by the concept of separation of tasks. All components fulfil a well-defined task and can be separately exchanged by other modules due to their interface specification.

Fig.3: modular system of Platon

The central component is the interface bus (a piece of software), which synchronises the interaction between the several modules, based on the communication library PVM. On the left hand side optimisation modules are illustrated, which may run in parallel on different machines. This is beneficial if the objective function shows locally strongly varying behaviour, and hence we may have specific optimisation strategies for certain function topologies.

Another module is the user interface (UI), which offers all functionality to define and control an optimisation flow. The use of the standard interface GEDO1, implemented in the programming language Java, is not necessary in the Matlab context. This Interface includes a graphical description language to define an optimisation process.

The POI2, formerly built for the optimisation system MEPO3[1], is the interface to the simulation environment. This component, designed and implemented in co-operation between the Technical University of Braunschweig and industrial partners, is responsible for distributing the function evaluations on a workstation cluster using the communication library PVM. It also provides checkpointing and loadbalancing algorithms. 1 Graphical Environment for Distributed Optimisation 2 Parallel Optimisation Interface 3 Multi Purpose Environment for Parallel Optimisation

The whole Platon environment has some more modules, as we described above, but they are not so important in this Matlab context. These modules are used in the area of data storing, data analysis and data visualisation 5 Coupling Matlab – Platon In section four we pointed out the main modules of the Platon environment. Now, we will focus our view on integrating Matlab code, both simulator and optimiser.

Fig.4: integrating Matlab code Fig. 4 shows the integration of simulation and optimisation codes. The shaded components on the right hand side of this figure indicate, that more than one simulator can be started in parallel on different processors. 5.1 Simulation Codes The POI’s task is to start simulation codes on every available processor according to it’s actual utilisation. So, we have to guarantee that each of these processors can start a so called Matlab engine, a non-interactive interface to Matlab. As a matter-of-fact each of the processors, which is executing a simulation, must have access to the Matlab engine. Nevertheless there must be a sufficient number of Matlab licenses available. When the engine is started and the input parameters are passed to the workspace, it interprets the simulation code, written in Matlab and calculates the objective value depending on the input values. All toolboxes available in this numerical environment, e.g. Simulink, can be used in this evaluation. After this the objective value and the optional free values are returned from the workspace to the calling simulation code. The results of such an calculation are passed back to the Platon environment, where they are send via the communication channel to the corresponding optimisation code.

5.1.1 Parameter Specification File The specification of the different design, fixed, free and objective parameters is stored in a separate file. This makes it possible to look for the solution in an subspace of the search space without compiling the whole simulation code, only by exchanging the parameter type of fixed and design values. Table 1 shows the structure of such a file. name type kind value left

bound right bound

Length Quality

Double Double

Design Objective

12.0 #

10.0 #

20.0 #

Table 1: parameter specification file All parameters are specified through six components: A name, to distinguish the parameter, a type, which defines the internal representation, a kind, to specify the use of the parameter, the default value, and two values to determine the number range by lower and upper limits. In Table 1 the parameter, named “Length” is a double value and can be changed by the optimisers. The number range will be between 10.0 and 20.0. The default value is 12.

The second parameter, called “Quality”, is of type double and used to contain the objective value, calculated by the simulator. The “#” stands for default values. If this symbol is used to specify the value range of the parameter, this means that “#” stands for the smallest or the biggest system number, depending on the position in the parameter row. Only the value of an objective parameters can be defined using a “#” symbol, because the value will always be defined by the simulation code. 5.2 Optimisation Codes On the left hand side of Fig.4 the coupling with Matlab in the area of optimisation codes is pointed out. In contrast to Fig.3 the user interface and the optimisation algorithm are both running in the same Matlab process. This approach allows to save resources and to control the Platon system from inside the Matlab environment. The user can start the Platon communication bus ant it’s components using new Platon commands, extending the build-in commands. As a matter-of-fact the Platon extension of Matlab behaves like an ordinary Matlab toolbox.

At some points inside the optimisation algorithm, the objective function is called. There we have to replace it by calling a new function, which is named calculateQuality(). The function’s

task is to send a calculation request, using the search points as input parameters, to the communication bus. While waiting for an answer this function is blocking the program flow.

CalculateQuality will return the free values and the objective one, which are used to find a new search point depending on the optimisation algorithm.

6 The Matlab-Platon- User Interface Until now we have discussed the system interfaces to integrate simulation and optimisation codes. In this section we will deal with the user interfaces offered by the Platon system.

Fig.5: matlab extension

Fig.5 shows the interface hierarchy of the Matlab extension. The Platon toolbox is partly written in Matlab code and C. All functions related to the communication are written in the native language C, whereas functions, manipulating and visualising data are directly implemented in Matlab code. The graphical user interface (see fig.5) is positioned on the top of the interface hierarchy. It only calls the build-in functions, respectively the functions, offered by the Platon toolbox. This approach minimises the maintenance cost of the system, because changes must only be considered at the command layer. 6.1 Matlab Commands Table 2 shows some commands of the Platon toolbox. Using this commands enables controlling an optimisation process from inside the Matlab environment. First you have to start the communication bus, calling startbus(). This function will invoke both PVM tasks, the communication bus and the POI. Using the showsim() function all information about available simulators are displayed. Now you can start your preferred simulator calling startsim(“simulator”). After this the Platon system is ready and waiting for any request. Calling the calculateQuality function will invoke a simulation task using the search points as input parameters.

If the optimisation algorithm is able to process more than one parameter set at the same time, all sets can be committed together. The parameter sets were sent to the waiting simulation tasks. This will be done by the POI. Depending on the available number of processors, the simulation tasks can run in parallel. If all search points are evaluated, the results are collected by the POI and sent back to the calling optimisation algorithm for further use.

toolbox commands Task calculateQuality Calculates the objective value cleanPlaton Clean the Platon workspace dspStatistic Displays statistical information getinfo Get Information on the simulatorgetKind Display the kind of parameter getProperty Get system property guiPlaton Start the graphical interface killPlaton Shutdown all Platon tasks showTasks Show all running pvm tasks showsim Show all available simulators startbus Start the communication bus startsim Start a chosen simulator Platonclone Make a clone of the actual

solution Table 2: some Matlab commands

6.2 Matlab GUI Fig.6 shows a screenshot of the graphical user interface built on top of the Platon tolbox. The centre of the interface is used to display graphically actual information on the optimisation process. In Fig.6 a variation of one of the input parameters is displayed. The menus on top of it offer commands to print the results or to display additionally information e.g. the status of running PVM tasks.

Fig.6: graphical user interface On the right hand side there are some buttons

and choices listed to define an optimisation run. A green button symbolises, that the status of a running action is okay, whereas a red one indicates some trouble. The pink background stands for an

action to be continued. The three green boxes on top of the command buttons display the actual status of the Platon system: the communication bus is running, a simulator is selected and running, and an optimisation algorithm, implemented in Matlab, is defined.

When an optimisation process is finished the information on this process, e.g. run time, results, and so on, are displayed in an additional text window on top of the user interface. The user then can continue the optimisation run with a new starting point or continues with the actual best solution.

7 A Use Case We use an example from control engineering to demonstrate the advantages of our approach. In this example we will couple a simulator and an optimisation algorithm, both written in Matlab code. On the first view it does not seem to be very clever to use the Platon optimisation framework, if simulator and optimisation module are running in the same Matlab environment, because of the overhead, created by changing the environment from Matlab to Platon, Platon to Matlab and back. This use case will show, that using the Platon package might be advantageous, if more than one Matlab license is available and the optimisation algorithm evaluates the objective function at more than one search point at the same time step. This speeds up the convergence time, because of the parallel evaluation of the objective function, offered by the POI. 7.1 Control Engineering

Fig.7: Simulink application Fig. 7 shows a use case, take away from the area of control engineering, using the Simulink toolbox. The task is to find the best set of values of the controllers parameters to minimise the objective

function of the given problem. Table 3 shows the parameter specification file for the Simulink application. There are five input parameter, each of type double and kind design. Each of the variables is unbounded. description file Meaning [info] Beginning info section Simulink simulation Description # comment Comment xelt.0,double,3,design,#,#, xelt.1,double,100,design,#,#, xelt.2,double,50,design,#,#, xelt.3,double,1,design,#,#, xelt.4,double,1,design,#,#,

parameter description

[output] Beginning output section result, double, ,objective, , , result

Table 3: parameter specification file We used an evolutionary algorithm [2] to minimise the objective function. This kind of algorithm creates different independent search points and is therefor very suitable for our parallel evaluation of the objective function. 7.1 Environment All calculations have been done using a cluster of Pentium PCs, each with 64 MByte memory, running the Linux operating system. Fig.8 points out the hard- and software environment.

Fig.8: environment

The simulators and the optimisation module are coupled using the PVM communication library. Additionally the involved PCs had access to Matlab, version 5.3 and Simulink. There was at most one simulation task running on a PC. Depending on the systems utilisation and number of available processors, there were other system task running on this processors, too. 7.2 Results Table 4 shows some results of the calculations. All values are average values of five measurements, to pay attention to the different system utilisation. The

linear curve on top displays the pure Matlab implementation without using the Platon framework. In this case, the number of available processors does not matter.

The second curve shows the elapsed time coupling Matlab with Platon. Having one simulator means running the simulator, the optimisation module and the whole Platon system on the same processor. As a matter-of-fact, the run time is here 40 % higher than we have measured using the pure Matlab implementation. Running a second simulation task in parallel on a different machine, creates a visible speed-up of nearly two.

Table 4: results 8 Conclusion In our article we have tried to show the advantages of a modular approach, not only for software engineering reasons, but also for practical ones. This approach allows to freely combine the simulation code with different optimisation algorithms in various combinations. In the uses case it is validated integrating optimisers and simulators, both written in Matlab, especially the simulator using the Simulink toolbox. It can be shown running more than one simulator in parallel is faster than the pure Matlab implementation. The speed-up depends on the relation between calculation time and communication overhead. Platon should only be used running time-intensive simulation tasks. References [1] Mathias Hadenfeld, MEPO – ein System zur

effektiven parallelen Bearbeitung von Optimierungsaufgaben, Operation Research Proceedings, Springer Verlag Heidelberg, 1999

[2] Nikolaus Hansen, Verallgemeinerte individuelle Schrittweitenregelung in der Evolutions-strategie, Mensch & Buch Verlag, 1998

[3] Daren Redfen and Colin Campbell, The MATLAB 5 Handbook, Springer-Verlag New York Berlin Heidelberg

Optimisation using Platon

050

100150200250300350

1 2 3 4 5

numer of simulators

time using Platon

stand alone