chocoteam / samples

Choco-solver in practice
BSD 4-Clause "Original" or "Old" License
11 stars 6 forks source link

Wanted: Black box example #5

Open thhart opened 7 years ago

thhart commented 7 years ago

Hi, I am looking for a way to hook in a black box problem. I have a given set of variables which are used in my box. The box is evaluating the variables and spits out a simple real value which have to be maximized. Which interface must the box implement? Can you give a simple example please?

cprudhom commented 7 years ago

Hi,

I don't know what is a box for you, at least you have to define to declare a model, some variables and constraints over variables, define an objective function if needed and ask the solver for a/the optimal solution.

There is no specific interface to implement. Many users do not extend AbstractProblem even if it offers a simple way to set up, build and solve a problem. But keep in mind that is a implementation choice driven by 1) having homogeneous classes and 2) offering the possibility to run them automatically.

thhart commented 7 years ago

Hi Charles, I am speaking of a black box like this: "The goal of optimization is to find an as good as possible value f(x) within a predefined time, often defined by the number of available queries to the black box. Problems of this type regularly appear in practice, e.g., when optimizing parameters of a model that is either in fact hidden in a black box (e.g., a third party software library) or just too complex to be modeled explicitly." (https://bbcomp.ini.rub.de)

So in fact I can not model my problem into a set of constraints. But I can give out a value to be maximized dependent of the variables. The challenge for a solver is now to chose good variable value tuples to narrow to probably global maxima. The problem is usually not as bad gradiented as it sounds.

PS: I don't want to use the solver in a challenge as cited above, I really want to use it for real world problem though. ;-)

cprudhom commented 7 years ago

Hi Thomas,

I never heard about such competition. So to rephrase the objective: you are given a set of variables, their domains and a black box you can query. For a given tuple, the box evaluates a hidden function and returns its value. The goal is to find a tuple that optimize the function in a limited number of query.

Your idea is to first estimate the function with some queries (as little as possible) and then, before an ultimate query, to compute the optimale solution. Am I right ?

thhart commented 7 years ago

Yes, your summary is right.

Your idea is to first estimate the function with some queries (as little as possible) and then, before an ultimate query, to compute the optimale solution.

Some queries is really relative and heavily depends on black box response time of course. I am speaking here of milliseconds to a small number of seconds to evaluate a tuple set just to give an impression. Evaluation might be parallelized of course via appropriate frameworks (Spark) or simple threading.

The challenge for a solver is now to narrow each variable within its domain to find optimums in reasonable time dependent on the output of the black box. From the output it might be able to detect gradients to "dive" into optimums.

cprudhom commented 7 years ago

I have two remarks: