Make your own free website on

FunctionViewer v1.0

FunctionViewer class is a part of Optimizer package that gives you possibility to visualize your own functions and test different methods of optimization.

Main features:
  • Easy user function inclusion
  • 3D representation of functions
  • Light source animation
  • Selection among several optimizing algorithms
  • Zoom in/out, shift in all directions
  • Control over initial step and maximum number of steps
  • Easy set up of limits


Easiest way to visualize your own functions includes the following simple steps:

Short version of file:

import com.javir.Optimizer.*;

public class MyFunctionViewer extends FunctionViewer 

public MyFunctionViewer(){

public String getFunctionName(int i){
	String Names[]={
	"Function1: hills+banana",
	"Function2: random hils",
	"Function3: circles"};
if (i>=Names.length) return null;
return Names[i];
public String getFunctionText(int i){
switch (getCurrentFunction()){
	case 0: return "0.6*(x*x+y*y)\n"+
	case 1: return "Y=0.6*(x*x+y*y)\n"+
		"for(int i=0;i<20;i++)// kn are random\n"+
		" Y+=k1/[k2*((x-k3)^2+(y-k4)^2)+1]\n";
	case 2: return "see source for details";
default: return "";}

public double getValue(double xx[]){
switch (getCurrentFunction()){
	case 0: return hills_and_banana(xx);
	case 1: return hills(xx);
	case 2: return circles(xx);}
return 0;} 
public double hills_and_banana(double xx[]){
public double hills(double xx[]){
public double circles(double xx[])

<- Back to JAVIR homepage