Black box optimization part 1

Write a hillclimber to maximize the function double eval(int *vec) contained in each of the the two object files below. These are two black box functions and I want you to try maximize both. Black box means that you do not know what the function does -- all you know is that if you send it a (int *vec) , it will return a double, in the range 0 through 100. main.cpp contains a sample call and return from eval. The size of the integer vector is 100.

Not only do I want the maximum returned by the function, I also want the value of each element in vec when evaluating vec causes the function to reach its maximum.

A sample main.cpp and links to

  1. (70 points) eval.o (max == 100) and
  2. (10 points) eval1.o (max = 100) for linux machines

You will need to use g++ for your compilation. You can use C or C++ to implement your algorithm but you must use the linux g++ compiler for compilation.

% g++ -o solver main.cpp eval.o

Should compile your hill climber in main.cpp with the eval function in eval.o

Assume that vec can only contain 0's or 1's, that is, it is a bit string. Going thru all 2^100 combinations of the 100 bit vector is not a viable option.

Answer the following questions:

  1. (20 points) What is the time complexity of your algorithm? In terms of number of evaluations. If you cannot compute time complexity in general, answer a simpler version of the question: You may be more precise and answer the question for a specific one hill function.
  2. (10 points) What is the space complexity?
  3. Is the algorithm complete?
  4. Is the algorithm guaranteed to find the optimum?
  5. If the algorithm finds the optimum, will it find it minimum time?
If you find the correct solution (s), you have to explain how and why your algorithm worked. If it failed, I once again want to know why. Thus, simply applying an algorithm you found on the web is also not a viable option -- only apply an algorithm you know and understand.


General rules
You may talk strategies but no code sharing. You are, of course, free to use the web or other resources to come up with implementations that attack the problem below. Good Luck


Turning it in

Please turn in
  1. A report that describes your strategy and an explanation of why it failed (or succeeded) as well as an analysis of your algorithm's strengths and weaknesses.
  2. Answers to the numbered questions above.
  3. A script of your algorithm running. I will also need your hillclimber code eval code. The code can be cut and pasted into your report. It would be good if your code retained your IDE's indentation and color coding.

Sushil Louis