8 Java JDK1.0 Version (GMJ0 )

1 Introduction

The Global Minimizer GMJ0 [Krapauskas, 1997] implements in Java JDK1.0 the C++ global optimization software GMC. That makes GMJ0 familiar to GMC users. GMJ0 includes all the global methods. Lbayes is the only local method. Implementation of the remaining two local methods, Nlp and Flexi, is difficult. We need to introduce specific 'Constraints' objects[*] to represent constraints, in these methods. The graphical interface and the menu system both are similar to those of GMC.

All 'java' and 'class' files are in the archive on web-sites (see section 4). The applet 'gm.html' is started by a browser. The command
appletviewer (URL address)gm.html
starts the applet, if JDK1.0.x[*] is on, and one may reach the corresponding URL address. The applet optimizes the objective function defined by ''. In the demonstration applet the '' is $sin$.

Users replace an illustrative function in the file '' by his own objective function. Then the new 'Task.class' is made by the 'javac' command. Graphical possibilities of GMJ0 include the convergence, projection and numeric parts, similar to those in GMC.

2 Running GMJ0

1 Defining Objective

The file '' represents the objective function. Figure 8.1 shows the illustrative example when the objective function is a sinus.
Figure 8.1: Example of the ''
\begin{verbatim}import java.lang.Object;
return Math.pow(x[0],2)+x[1];
The file '' describes the Task class. The class variable NUMBER OF VARIABLES defines the number of optimization parameters. The arrays 'lowerBounds' and 'upperBounds'[*] define lower and upper bounds of optimization parameters. In the illustrative example, that means variation of parameters from minus two to plus two.

The array 'initialPoints' defines the initial approximation needed by local methods and by some global ones, for example by 'Exkor'. The numbers $-1.0\ \ 0.0\ \ 1.0$ define default values of arrays 'lowerBounds', initialPoints', and 'uppperBounds' correspondingly[*]. The 'return' value is the objective function, in the illustrative example that is the product of a sinus of the first and second variables.

2 Compiling and Running

One compiles when changes the objective function $f(x)$. This function is defined by in the file ''. The compiling command is 'javac'. To run the program by a local java JDK1.0.x interpreter, one uses the command 'java Gm'. The JDK1.0.x command 'appletviewer gm.html' is for running the applet 'gm.html' from the command line. To run by browser just open the web-site and start the applet 'gm.html' of the GMJ0 system (see section 4).

3 Graphical Interface

Starting the applet 'gm.html', a window with 'Show' and 'Hidden' buttons appears (see Figure 8.2).
Figure 8.2: GMJ0 opening.
\begin{figure}\centerline{ \epsfig{file=gmjk.eps,width=12.0cm}
One starts the main program and opens the menu window (see Figure 8.3) by clicking the 'Show' button .
Figure 8.3: GMJ0 opening menu.
\begin{figure}\centerline{ \epsfig{file=gmjkmenu.eps,width=12.0cm}
The menu window controls the optimization process and is similar to that of the GMC (C++ version). To hide this window press 'Hide'. To delete, select the menu item 'File, Exit' and answer "yes." Then the 'Restart' button appears, replacing the 'Show' and 'Hide'. One creates a new menu window by clicking 'Restart'. One opens the menu window from the local interpreter by the command 'java Gm.' In this window, All the visual tools takes CPU time. Therefore, closing them speeds up the computing.

4 Implementing New Method

The class of a new method is created using the 'Method' class. The minimal class of a new method is shown in Figure 8.8.
Figure 8.8: Example of the minimal class of the new method.
\begin{figure}\centerline{ \epsfig{file=newmethod.eps,width=12.0cm}
The parameters of the 'Method' constructor $output$ is the object controlling a visual output. $n$ defines computing parameters (lower and upper bounds, initial points e.t.c.). $r$ defines the results. $fm$ and $xn$ define the arrays of current results.

An optimization algorithm is called by the method 'run()'. In the example, the method is 'newmethodcalculations ( ...)'. The name and parameters of this method may be fixed according to users needs. In the example, the internal values $x$, $a$, and $b$ of the object created by the class 'Method' are passed. Here $x$, $a$, and $b$ are some arrays of initial points, lower and upper bounds, respectively. $n$ is the number of variables. $it$ is the number of iterations. $fm$ and $xn$ are arrays of current results.

All these parameters are initialized by the constructor of the 'Method' class. In the 'Method' class, the internal variable $r$ of the class 'Results' is defined. This variable is initiated by the constructor of the 'Method' class. Using the variable $r$, we inform the program about the change of iteration (r.iteration=new.iteration), about new minimal value (r.y=new.min), about the change of the current best point
(copy.array(r.x=new.x.n)). Here the integer 'new.iteration' shows the iteration number. The double array ''new.min' defines the coordinates of the new best point. All these commands are in the method 'newmethodcalculations'. Finishing the method 'run()', the method 'Finish()' of the class 'Method' is called. Then the program returns to the initial state.

One may add a new method and extend the graphical possibilities of Java global optimization software in a simpler way by using other Java versions. These versions called as GMJ1 and GMJ2 are described in the next section. Note, that GMJ1 needs JDK1.1 support and GMJ2 needs JDK1.2 support. Thus, GMJ1 does not work on some older browsers such as Netscape-3, for example. One installs the Java Developers Kit JDK1.2 to apply GMJ2.

jonas mockus 2004-03-03