How to optimize a function with several variables

145 Views Asked by At

I need to develop code to optimize a set or variables based on the following conditions.

  1. I don't have the source of function.
  2. The function gets a point (x,y) and generate a mapped point (x',y') using a set of parameters (around 10 parameter)(Mapping_Function)..
  3. I have an array of points with desire mapped ones (input[N], mapped[N]).
  4. I have a function that can calculate distance between two points (for example input point and mapped one). This function is in fact Euclidean distance (GetAbsError).
  5. I need to wrote code to optimize parameters to function so the distance between input points and mapped one became minimized (Optimize_Parameters).

The sample code is as follow:

Point[] InputPoints=GetInputPoints();
Point[] TargetMappedPoints=GetInputmappedPoints();
double[] Parameters=GetInitialParameters();
double error=1000000000;
double validerror=.000000001;
While(error> validerror)
{
    Parameters=Optimize_Parameters(TargetMappedPoints,MappedPoints,Parameters);
    Point[] MappedPoints=Mapping_Function(InputPoints,Parameters);
    error=GetAbsError(TargetMappedPoints,MappedPoints);
}

I need to write Optimize_Parameters function to do the optimization.

How can I do this?

What library can I use to write this function?

Where can I find more information on this?

I can write it in c++ or c#, but prefer to do this in c++ as it is faster.