Black box optimization 2

Use a HillClimber or other algorithm 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 , greater than or equal to 0

main.cpp contains a sample call and return from eval. The size of the integer vector is 150 .

Your assignment is to write a hillclimber that finds the function maximum. 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.


C++ to be compiled with g++

A sample main.cpp and links to

  • For the CSE machines

    Here's a link to the script I used to generate the .o files.

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

    Do not spend too much time writing your hill-climber. You may spend a lot more time tweaking it if you like. It is ok, if you are unable to find the maximum or only find the maximum once in 30 tries with different random seeds. I am primarily interested in the design of your hill climber or other search algorithm and your justification for your algorithm.

    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. 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. Answer the following questions:
      1. (10 points) Given a one hill problem over 150 bits, what is the time complexity of your algorithm to find the optimum in terms of the number of evaluations?
      2. (10 points) Given an unknown problem over 150 bits, what is the time complexity of your algorithm to find the optimum in terms of the number of evaluations?
      3. (10 points) What is the space complexity?
      4. Is the algorithm complete?
      5. Is the algorithm guaranteed to find the optimum?
      6. If the algorithm finds the optimum, will it find it in minimum time?
    2. (35 points each) A plot of your algorithm running on each problem. In this plot, the x-axis is number of evaluations and the y-axis is objective function value.
    3. A script of your algorithm. I will also need your hillclimber code. The code can be cut and pasted into your report. It would be good if you retained your IDE's indentation and color coding. Or the code can be placed on your website and you can send me a link.

    Sushil Louis