Subsections
8 Java JDK1.0 Version (GMJ0 )
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
websites (see section 4). The
applet 'gm.html' is started by a browser. The command
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 'Task.java'. In the demonstration applet
the 'Task.java' is .
Users replace an
illustrative function in the file 'Task.java' 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.
The file 'Task.java' represents the objective function. Figure
8.1 shows the illustrative example when the objective
function is a sinus.
Figure 8.1:
Example of the 'Task.java.'

The file 'Task.java' 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
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.
One compiles when changes the objective function . This function is defined
by in the file 'Task.java'. The compiling command is 'javac
Task.java'.
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 website 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.

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.

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,
 provides the possibility.

provides the choice of global optimization methods:
,
, , , , .
 'Local' provides
the choice of local methods:
, , (now
only is there).
 is for the computing
control:
is for starting or restarting, is for
temporary stopping, and ends the computing.
 is just for
that opens the
parameter window. The window shape depends on the method chosen.
One may change the parameters at any moment but the new settings
will be ignored until the next 'run'.
 is for
. It opens the results window showing the best
obtained objective function and the corresponding parameters.
 is for choosing a visualization format.
 shows in numbers the current objective and
parameters (see Figure 8.4).
Figure 8.4:
Current results.

 shows how the best obtained objective value
depends on the iteration number (see Figure 8.5).
Figure 8.5:
Best objective depending on iteration number.

 shows how the objective depends on some fixed
parameter (see
Figures 8.6 and 8.7).
Figure 8.6:
Projection 1.

Figure 8.7:
Projection 2.

 is for changing the form of points on the
window: or
.
 just opens the window .
All the visual tools takes CPU time. Therefore, closing them speeds
up the computing.
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.

The parameters of the 'Method' constructor is the
object controlling a visual output. defines computing
parameters (lower and upper bounds, initial points e.t.c.).
defines the results. and 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 , , and of the
object created by the class 'Method' are passed. Here , ,
and are some arrays of initial points, lower and upper bounds,
respectively. is the number of variables. is the number
of iterations. and are arrays of current results.
All
these parameters are initialized by the constructor of the
'Method' class. In the 'Method' class, the internal variable
of the class 'Results' is defined. This variable is initiated by
the constructor of the 'Method' class. Using the variable , 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 Netscape3, for example.
One installs the Java Developers Kit JDK1.2 to apply GMJ2.
jonas mockus
20040303