Talking about WQS dichotomous/convex optimization algorithm

Pre-knowledge: only two points

Provenance

Thesis: Analysis of a class of dichotomous methods

The first time it appeared in the work of Guoji in 2012, the promotion was in 2015, and it was another algorithm invented in the Chinese national team/training team (I have to say that the development of the Chinese information competition promotes the progress of world science.

thought

Basic

WQS dichotomy, also called convex optimization, has the following limitations:

  • The function F(x)=f(x)is a convex function (single increase/decrease in slope)
  • F(x)=f(x)+\lambda x , (\lambda \in \mathbb{R})The maximum value and maximum point of a function (obviously a convex function) can be found in a short time
  • Limit k, askf(k)

Let's draw a picture first:

First use the convex function analysis, because the downward convex is the same.

Due to the special nature of the subject:

F(x)=f(x)+\lambda x , (\lambda \in \mathbb{R})The maximum value and maximum value point of the function can be found in a short time

How can we use it to get f(x)it?

At \lambda>0time, we can change the upper convex hull in the figure above:

We found that when \lambda>0, the point most to the right value, when \lambda<0, the value of the point most to the left, |\lambda|the greater the greater the distance of movement, monotone

When we move the most value point to k, we can directly find f(k)+\lambda kthe value, and then subtract \ lambda kit to get the required answer.

So the algorithm flow came out: divide one into two \lambda, make F(x)=f(x)+\lambda xthe most value point equal to k, and then find the corresponding most value- \ lambda k.

Slightly expanded

The above situation is actually rare. In most cases f(x), it is not strictly convex. It is a monotonous slope that does not decrease/increase. In other words, the highest point in the dichotomy may constitute an interval:

In this case, if you only find a maximum point in the interval, you may never be able to make it equal to k.

Think about it, in fact, we only need to satisfy that k is in the range of the maximum value we find, so that the maximum value obtained is still equal to f(k)+\lambda k, and finally subtracted \ lambda k.

So the dichotomy becomes: divide one into two \lambda, so that F(x)=f(x)+\lambda xthe left end point of the maximum point interval is not greater than k and closest to k. Such an interval is guaranteed to contain k, and then find the corresponding maximum value- \ lambda k.

We only need to ensure that we can still find the minimum and minimum maximum points in a short time.

Some examples

Dark explosion 2654

FreeOJ 2478

Just mutter about the explanation of the sample problems first, and readers can see the solutions of others

Guess you like

Origin blog.csdn.net/weixin_43960287/article/details/114729617