Before starting this tutorial we suggest you to read
You should have a
The source code of this tutorial is available for
We consider a simple optimization problem with 4 parameters of different types. One parameter is categorical and thus can take values from a set of possible alternatives, here,
We formulate our problem as follows
where i) our categorical parameter
Candidate solutions will be evaluated in a function called "evaluate" which implements
In order to communicate with Indie Solver, you should initialize a worker and tell it to connect to a particular IP address and port while providing your secret authentication token. All this information is available on your
The following JSON request describing the problem to be created will be sent to Indie Solver:
Your worker can ask solutions iteratively one after another by calling "ask_new_solutions". The reply of this call will include solutions to be evaluated. For the case when some errors were detected by the server, one should check for the status of the reply in order to avoid unnecessary and potentially expensive calls to the objective function. Once some solutions are evaluated, one can communicate them to the server by calling "tell_metrics".
The loop given above will request and evaluate solutions 100 times. If you are currently on our free subscription plan, then only 80 function evaluations will be performed because of the limit to perform at most 20x the number of parameters function evaluations per problem. If you are a researcher, contact us to get a free extension of the limit to 1000x which corresponds to 4000 function evaluations on this problem.
The entire code of this tutorial example is given below:
All evaluated solutions can be viewed in your
You can verify the correctness of your problem description.
The evolution of the objective function value over the number of function evaluations is given below. You can modify what will be shown on different axes.
Importantly, you can apply different transformations (e.g., log10() transformation for the y-axis) to better visualize your data. In order to view a solution of interest, double-click on it and it will appear in the text-box below.
Similarly, the evolution of parameter values can be visualized as shown below.
We select "Show metrics and parameters" for the following parallel coordinates figure. You can change colors and move individual coordinates to re-order them.
We select a range of interest for "obj1" to make the corresponding solutions appear in the table below the figure.
All evaluated solutions are stored in the table below.
The results suggest that the algorithm approaches the optimum successfully. In order to compare the solver to random search, we run both algorithms with 100 random initializations (only relevant for Indie Solver) and present the median results below.
Random search can be competitive for low-dimensional problems, for problems without any global structure and when only very small computational budgets are available. Even on our toy problem of only 4 variables, random search can be outperformed very quickly.
In this introduction tutorial we demonstrated how to solve a simple optimization problem and view its solutions in the dashboard.
You may need to make a few adjustments of the problem description to match your actual problem at hand. Have a look at our other