hxano's blog

By hxano, history, 13 months ago, In English

I have been stuck on this problem for a few days now. It seems to be an expansion of the Project selection problem (PSP).

For those unfamiliar with PSP, it goes something like this: There are $$$n$$$ projects to be completed, the project $$$i$$$ will add $$$a_i$$$ money to your total ($$$a_i$$$ can be negative), and there are $$$m$$$ dependencies, where the project $$$u$$$ requires the project $$$v$$$ to be completed before being completed itself. Your goal is to choose projects to complete so that the total sum of money is maximized. This can be easily solved using a minimum cut model as described in this blog.

We can restate the problem a bit more formally: Maximize the sum $$$S = \sum_{1 \le i \le n} a_i \cdot t_i$$$, so that $$$\forall 1 \le i \le n, t_i=0$$$ or $$$t_i=1$$$, and $$$\forall 1 \le j \le m$$$, if $$$t_{u_j}=1$$$ then $$$t_{v_j}=1$$$.

What my problem deals with, is the dependencies taking on different forms, such as "if $$$t_{u_j}=0$$$ then $$$t_{v_j}=1$$$", "if $$$t_{u_j}=1$$$ then $$$t_{v_j}=0$$$", and "if $$$t_{u_j}=0$$$ then $$$t_{v_j}=0$$$".

I'm also aware of this blog, which seems very reminiscent of the matter, but I was unable to derive a definite solution from it on my own.

I would love some help from Codeforces!

  • Vote: I like it
  • +9
  • Vote: I do not like it

»
13 months ago, hide # |
 
Vote: I like it +34 Vote: I do not like it

When all weights are equal to 1, this is called MAX-2SAT, which is NP hard. However, some fast approximate solvers might exist.

  • »
    »
    13 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Are some special cases solved? For example, versions where only dependencies of the type "$$$u=1$$$ => $$$v=0$$$" are allowed, or versions where there are no cycles?