Skip to content

Client‐Server Mode

arturluis edited this page Sep 23, 2020 · 4 revisions

In the default operating mode of HyperMapper (and many other frameworks alike) the black-box function is called by the optimizer, i.e., the optimizer initiates the optimization. This is what is described in the HyperMapper Quick Start Guide. However, in some real-world applications, a more natural interaction between the optimizer and the black-box function is the opposite, i.e., the black-box function calls the optimizer whenever needed. In HyperMapper we dub this operating mode Client-Server mode.

Client-Server mode is the mode that allows a black-box function (usually a software) to call HyperMapper on demand. The two parties communicate via a client (the third-party software) and server (HyperMapper) protocol defined by HyperMapper. The general idea of the protocol is that the client asks the server the configurations to run. So, there is the first design of experiments phase where samples are drawn and a second phase that is about the (Bayesian) optimization. When the client has enough samples the Pareto can be computed.

To enable the Client-Server mode add this line to the json file:

“hypermapper_mode”: {
       “mode”: “client-server”
   }

These examples use the Client-Server mode:

Client-server protocol

The client and server communicate following a csv-like protocol via the standard output. Before calling HyperMapper, the client must create a json configuration file and implement the communication interface between HyperMapper and the black-box function. E.g. see the Chakong-Haimes configuration file and communication interface.

The client then calls HyperMapper to start the optimization process. When called by the client, HyperMapper will reply by requesting a number of function evaluations. Using the Chakong-Haimes function as an example, HyperMapper will reply with:

Request 3
x1,x2
-10,12
1,6
-8,20

Note that HyperMapper starts the protocol by stating how many evaluations it is requesting, followed by the input parameters (x1 and x2 for the Chakong-Haimes) and a series of parameter values.

Upon receiving this message, the client must compute the function values at the requested points and reply with the input parameters and the function values:

x1,x2,f1_value,f2_value,Valid
-10,12,267,-211,False
1,6,28,-16,True
-8,20,463,-433,False

This protocol continues for the number of iterations specified by the client in the configuration file:

Request 1
x1,x2
3,7
x1,x2,f1_value,f2_value,Valid
3,7,39,-9,True
...

After all iterations are done, HyperMapper will save all explored points to a csv file and end its execution. The client can then compute the optima (or the Pareto for multi-objective problems).

Client examples

We provide several implementation examples of the client communication interface within HyperMapper:

Other modes

Clone this wiki locally