3

At work, we are trying to optimize the number of goods produced to fulfil an uncertain demand. We know the probability distribution of the demand by analyzing the demand that occured before.

In mathematical terms, this problem is a multi-staged stochastic integer program. We are now looking into OptaPlanner to solve it. However, it seems that OptaPlanner does not offer the ability to model and solve this kind of problem. One possibility would be to transform the program into a deterministic problem, that may be solvable, but this would take much time to convert and solve.

So our question is: Can OptaPlanner model this kind of problems and solve them efficiently?

Konstantin
  • 55
  • 5
  • 1
    To understand use cases and potential pain points better (to fix them), I 've started [a developer discussion here](https://groups.google.com/forum/#!topic/optaplanner-dev/AM2G7nCT1HU). – Geoffrey De Smet Mar 24 '16 at 08:46
  • 1
    That's awesome! We will definitely take part in this discussion, when we produced some results. – Konstantin Mar 24 '16 at 09:16

2 Answers2

2

These kind of use cases aren't out-of-the-box examples and well studied, but it is possible with some custom code:

  • OptaPlanner can optimize on top of any score calculation function. The only real requirement is that it returns a Score, which is essentially a Comparable.
  • You can define a custom Score (see docs), but in the example below, I 'll use a standard HardSoftScore and that will do. A HardSoftScore is basically 2 int variables.

For example, presume the probability of rain is: 50% on Monday, 10% on Tuesday, 20% on Wednesday. Now presume we have vehicle routing problem and need to deliver 100 packages during that week, with 2 trucks: truck A that can carry 20 packages and is unaffected by rain and truck B that can carry 40 packages but is affected by rain: rain inflicts a maintenance cost on it and too much rain in 1 week breaks it.

Now we can write a score calculation function to take those things into account in our score rules:

  • when the "sum" of the probability accumulated rain on B is too high, reduce the hard score with how much too much (so the solution is not feasible)
  • the probability of rain when B is used inflicts a soft cost (=> reduces the soft score)
  • the use of A or B inflicts a soft cost per distance driven

That being said, OptaPlanner does not provide any methods for probability arithmetic, such a doing a sum of probabilities (which is non-trivial). However, you can plug in any Java framework that provides that, call those functions for the drools DRL. Furthermore, drools-chance was suppose to provide that, but that project is currently inactive (but sooner or later we 'll reboot it).

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
1

Here's an example of stochastic optimization with OptaPlanner: Investment Portfolio Optimization.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120