Weighted Item Collecting in Directed Bipartite Structure with a Reversing Cost Penalty

In this paper, a weighted item collecting problem in directed bipartite structure containing a set of items with profits and a set of players with costs is discussed. The problem is viewed as a generalization of an integrated circuit design problem considered by Tang (2005), that is, collecting an item in the problem may correspond to avoiding an undesirable via in the integrated circuit design. In this paper, an objective function not only with the total profit of collected items, but also with a penalty term of the costs paid by the players is treated. A greedy heuristic algorithm is proposed, and numerical experiments are conducted to demonstrate the performance.


Introduction
A directed bipartite graph with a set I of m items and a set J of n players is given.Two positive weights p i and p i are associated with each item i ∈ I.These weights may be called profits of the item.A non-negative cost c j is associated with each player j ∈ J.An arc in the directed bipartite graph between an item i ∈ I and a player j ∈ J expresses the existence of connection between them, and the initial direction of the arc represents the signal color, either blue or red, which the item i receives from the player j in the beginning.All directions of arcs incident with a player j ∈ J can be reversed in one lump by paying the cost c j .For an item i ∈ I, when each of players having connection with the item cooperatively sends the same colored signal, e.g., a blue (resp., a red) signal, the n players can get the profit p i (resp., the profit p i ) as a team.The weighted item collecting problem to be discussed in this paper asks to find an arc reversing strategy of the n players which maximizes the objective function value of the total profit of collected items minus a penalty value with the total cost paid by the players.
The weighted item collecting problem is regarded as a generalization of the minimal switching graph problem (1) (MSG for short).Problem MSG has been introduced to model a constrained via minimization in the context of integrated circuit design automation (2) , while no cost is imposed on an arc reversing strategy in the mathematical modeling.An application of the genetic algorithm to problem MSG has been reported (1) , and a greedy heuristic algorithm has recently been presented (3) .The greedy heuristic algorithm empirically obtained the optimal solution of the problem instance with m = n = 48 provided as a benchmark of problem MSG (1) in a short execution time (with less than one millisecond on a common laptop personal computer).The greedy algorithm has been designed to handle heuristically a budget constraint of an arc reversing strategy also.
In this paper, a modification of the total profit objective is considered, i.e., as mentioned in the above, the objective function consists of the total profit term of collected items and a penalty term with the total cost of the players.Such an objective may tend to regard a smaller change from the initial directions of arcs (e.g., from the initial circuit design) as desirable in the final solution of an are reversing strategy.For optimizing the objective function with the cost penalty term, together with an additional preprocessing procedure, a greedy heuristic algorithm is redesigned in this paper.Numerical experiments are conducted to demonstrate the effectiveness of the preprocessing procedure and the performance of the proposed greedy heuristic algorithm.

Problem Description
Most of the input data of the weighted item collecting problem are basically the same as those in our previous work (3) , and they are reviewed in this section.On the other hand, in order to formulate the modified objective function with a penalty term of the total cost of the players, some additional notations are newly introduced.
Again, let items, and let J = {j | j = 1, 2, . . ., n} denote a finite set of players.Two positive weights p i and p i are associated with each item i ∈ I, and a non-negative cost c j is associated with each player j ∈ J.
For each player j ∈ J, let B j ⊆ I (resp., R j ⊆ I) denote the set of items to each of which the player initially sends a blue (resp., a red) signal, where B j ∩R j = ∅ must be satisfied.Without loss of generality, it is assumed that each player j ∈ J meets B j ∪ R j ̸ = ∅, which implies that each player sends at least one item a colored signal (of either blue or red).It is also assumed that for each item i ∈ I, there exists some player j ∈ J with i ∈ B j ∪R j , i.e., at least one player sends a colored signal to each item.
A player j ∈ J is said to be reversed when the player is made change the arc directions (i.e., the signal colors) from the initial ones to the opposite ones.That is, a reversed player j ∈ J sends a red (resp., a blue) signal to each item in the set B j (resp., in the set R j ).As a solution of the problem, we define a reversing vector x = (x 1 , x 2 , . . ., x n ), where for each j = 1, 2, . . ., n, When the n players take a reversing vector x as their arc reversing strategy, they pay the reversing cost as a team.Let α ≥ 0 denote a penalty coefficient, and let b a non-negative bound for the reversing cost.Then the cost penalty term to be treated in this paper is defined by The zero reversing vector x = 0 with x j = 0 for all players j ∈ J meets c(0) = 0, and hence we have g(0) = 0 (e.g., when the initial circuit design is adopted as the final one, no cost is incurred). Let ) denote a reversing graph with a solution x as the directed bipartite structure, where A B (x) and A R (x) are disjoint arc sets such that A B (x) ⊆ I × J and A R (x) ⊆ J × I.More precisely, an arc (i, j) ∈ A B (x) (resp., (j, i) ∈ A R (x)) indicates that to the item i ∈ I, the player j ∈ J sends a blue (resp., a red) signal.We provide an illustration of an initial bipartite graph G(0) and of another reversing graph G(x) with x = (1, 0, 0, 1, 0, 0) in Fig. 1, where m = 7 and n = 6.In (b) of Fig. 1, we are going to see the objective function value to be (p 1 + p 4 + p 5 + p 6 + p 7 ) − α × max{c 1 + c 4 − b, 0}.For this, we continue to describe the problem a few more in the remainder of this section.
For each item i ∈ I, the player set J is partitioned into the following three disjoint subsets with a reversing vector x: and J \ (J B (x, i) ∪ J R (x, i)).We call each player in the set J B (x, i) (resp., in the set J R (x, i)) a blue-signaling (resp., red-signaling) player of item i in the solution x.Let denote the subsets of items.The definitions imply that signals of an item i ∈ I B (x) (resp., i ∈ I R (x)) receiving from the player side are all blue (resp., all red) in the solution x.
Again in (a) of Fig. 1, we see that a completely blue-signaled (resp., a completely red-signaled) item in the solution x.
The total profit obtained by a solution x is defined to be and the modified objective function is defined to be Let x = x * denote a feasible solution which attains the objective function value such that it satisfies F (x * ) ≥ F (x) for any feasible solution x.Note that for an instance of the problem, any 0-1 vector x is feasible.We refer to the x * as an optimal solution, and let F * = F (x * ) denote the optimal value.We also define a feasible solution x = x for the maximum total profit such that it satisfies f (x) ≥ f (x) for any feasible solution x.We call the problem WIC (Weighted Item Collecting) for short, which asks to find an optimal solution x = x * .An instance of problem WIC with the unit profits (i.e., p i = p i = 1 for each item i ∈ I) and zero penalty coefficient α = 0 (see Eq. ( 3)) is viewed as an instance of problem MSG (1) , and an instance of problem WIC with a sufficiently large α and a positive bound b < ∑ j∈J c j is regarded as an instance of the item collecting problem with a budget constraint (3) .

Semi-solutions and Their Minimal Costs
For a reversing vector x = (x 1 , x 2 , . . ., x n ), the counterpart vector (or simply, counterpart) of the x is defined by x = (x 1 , x 2 , . . ., x n ) (3) , where for each player j = 1, 2, . . ., n, it holds For an instance of problem WIC, a reversing vector x and the counterpart x satisfy 6) and ( 7)).
Conversely, if a certain item i ∈ I can be a completely bluesignaled item (resp., a completely red-signaled item) in a solution x = (x 1 , x 2 , . . ., x n ), the x is said to contain the blue basic semi-solution A reversing vector x = (x 1 , x 2 , . . ., x n ) is also said to contain a semi-solution s = [s 1 , s 2 , . . ., s n ] if x j = s j holds for any player j ∈ J with s j ∈ {0, 1}, and it is expressed by x ⊒ s.From a given semi-solution s, we obtain a minimal x ⊒ s of reversing vector by the following trivial O(n) time procedure (3) : Step 1.For each player j = 1, 2, . . ., n, let Step 2. Terminate the computation.
The minimal cost of a semi-solution s = [s 1 , s 2 , . . ., s n ] is defined by For a given semi-solution s, let x be the minimal reversing vector.Then it holds c min (s) = c(x).

Consistency and a Compound Procedure
In the following section, we are going to design a modified greedy heuristic algorithm for problem WIC, in which the concept of consistency between some distinct basic semisolutions is utilized (3) .We say that two distinct semi-solutions s = [s 1 , s 2 , . . ., s n ] and are inconsistent if there exists some player j ∈ J who meets all the following three conditions: Otherwise, they are consistent.The definition implies that for any item i ∈ I, the blue and red basic semi-solutions s (i) and s (i) are always inconsistent.For example, in the problem instance provided in Fig. 1, two semi-solutions s (5) and s (6) are consistent.For two distinct semi-solutions, their consistency can obviously be checked in O(n) time by Eq. (15).As in our previous work (3) , we give the O(n) time checking the following function name : Function CONSISTENCY(s, s ′ ) Input: Two distinct semi-solutions s and s ′ .Output: If the two semi-solutions s and s ′ are consistent, then return true; otherwise, return false.
For two distinct semi-solutions s and s ′ , there is a reversing vector x such that it meets x ⊒ s and x ⊒ s ′ both if and only if the two distinct semi-solutions are consistent (3) .Suppose that the s and s ′ are consistent.Then, we obtain a semi-solution ŝ from the two semi-solutions s and s ′ such that for each player j = 1, 2, . . ., n, it holds since no player j ∈ J meets Eq. ( 15).For the semi-solution ŝ, we call procedure MINIMAL SOLUTION(ŝ; x).Then, from Eq. ( 16), the resulting x of reversing vector clearly satisfies x j = s j for any j ∈ J with s j ∈ {0, 1} and x j = s ′ j for any j ∈ J with s ′ j ∈ {0, 1}.Hence, we have x ⊒ s and x ⊒ s ′ .
That is, when two distinct semi-solutions s and s ′ are consistent, we can make a compound semi-solution ŝ of them by Eq. ( 16), which delivers a reversing vector x such that x ⊒ s and x ⊒ s ′ .In this paper, we also represent by notation ⊕ the compound operator for two distinct semi-solutions.Note that it holds s ⊕ s ′ = s ′ ⊕ s.We provide the following O(n) time procedure, which is going to be incorporated into the proposed heuristic algorithm: Procedure TRY COMPOUNDING(s, s ′ ; ŝ) Input: Two distinct semi-solutions s = [s 1 , s 2 , . . ., s n ] and Step 1.Call function CONSISTENCY(s, s ′ ).If the function returns true, then go to Step 3.
With respect to the above procedure, we may express the semi-solution s = [s 1 , s 2 , . . ., s n ] with s j = * for all players j ∈ J by s = s * .(We should remark that the s * is not related to the optimal solution x * .)Procedure TRY COMPOUNDING does not treat the costs of the players in itself, and a certain procedure is needed to regard the penalty term of the total cost paid by the players.In the following section, we are going to propose a greedy heuristic algorithm in order to address the modified objective function F (x) = f (x) − g(x), involving the two procedures provided in this section.

The Proposed Heuristic
Let σ = σ 1 , σ 2 , . . ., σ m and τ = τ 1 , τ 2 , . . ., τ m denote permutations on the item set I such that they satisfy and further, if and also if pτ k = pτ k+1 holds for some k ∈ {1, 2, . . ., m − 1}, then it meets Permutations σ and τ can be obtained by a polynomial time sorting algorithm with the stability (4) .If we apply a sorting algorithm without the stability, the permutations σ and τ satisfy only Eqs. ( 17) and ( 18), and the costs of the players are not regarded in the preprocessing.In the following numerical section, we are going to examine the effectiveness of the preprocessing with regarding Eqs. ( 19) and (20) in the proposed greedy heuristic algorithm.
We describe the proposed heuristic algorithm as follows: )) > 0 ) then / * i.e., an improvement on the value F (x) * / s := ŝ; end if end if /* If the current s has contained a basic semi-solution s (i) , then the counterpart s (i) is automatically detected to be inconsistent with the s.*/ end while / * Part 5: Transforming the semi-solution s to a feasible solution * / Call procedure MINIMAL SOLUTION(s; x); if (F (x) > F ′ ) then x ′ := x; F ′ := F (x ′ ); end if Construct the counterpart x of the x by Eq. (10); The time complexity of algorithm M GREEDY is clearly polynomial.In order to examine the effect of the preprocessing in the following numerical section, we distinguish algorithm M GREEDY with the preprocessing utilizing a stable sorting of the profits in the minimal cost consideration (see again Eqs. ( 17)-( 20)) from the algorithm with preprocessing using a non-stable sorting, and we call them M GREEDY-A and M GREEDY-B, respectively.

Numerical Experiments
The program for numerical experiments in this section is written in C language, and is run on a laptop personal computer with Windows 10 Pro (64bit), Intel Core i7 6500U CPU (2.50 GHz) and 8GB memory.Instances of problem WIC to be tested are generated as follows: • The numbers of items: m ∈ {20, 50, 80}.
• The number of players: n = m.• Profits of each item i ∈ I: Uniformly random integers p i = p i ∈ {1, 2, . . ., 10}, or fixed p i = p i = 10 for all items i ∈ I.
• Values in the cost penalty term: α = 1 and b = 0.
• The number of signaling players of each item i ∈ • The total number of arcs between the sets I and J (i.e., |A B (0)∪A R (0)|): min{ ∑ i∈I d i , mn} arcs are generated so that they satisfy B j ∪ R j ̸ = 0.The direction of each arc is chosen between the two alternatives with the same probability.
In all numerical results shown in the following tables, each of the data indicates the mean value in a set of one hundred test instances.
Table 1 shows the values of the objective function F (x), the total profit f (x) and the total cost c(x) obtained by the proposed heuristic algorithm M GREEDY-A for the test in-stances with m = n = 20 and with randomly generated profits and costs.In the setting of the test instances, the cost penalty term meets g(x) = c(x), and hence it holds F (x) = f (x) − g(x) = f (x) − c(x).The table provides the results of an optimal solution x * and a feasible solution x which maximizes the total profit, while ignoring the total cost.The solutions x * and x are obtained by Gray code enumerations (5) .In the table, these are denoted as the results of OPT (F ) and OPT (f ), respectively.The values by the zero reversing vector x = 0 are shown as the results of ZERO REV.The proposed M GREEDY-A obtains the better objective function value of F (x) than that by algorithm M GREEDY-B.Similar results on the test instances with m = n = 50 and with m = n = 80 are observed in Table 2.
Again in Table 1, algorithm M GREEDY-A obtains the average value 83.4 of F (x), while the optima solution x * takes the average value 85.4 of F (x).That is, there is a small difference between the two objective function values.Further, it is observed that the x * and x are different solutions each other such that F (x * ) ≥ F (x) and f (x * ) ≤ f (x).
The time complexity of algorithm M GREEDY-A has been seen to be polynomial, and it is observed in Table 3 that it actually runs fast on the laptop personal computer.The execution time is less than 0.5 [msec] for a test instance even with m = n = 80.The difference on the execution times between algorithms M GREEDY-A and M GREEDY-B depends on the preprocessing either with or without the stable sorting of the profits in the minimal cost consideration (see again Eqs. ( 19) and (20)).
Table 4 indicates the values of the objective function F (x), the total profit f (x) and the total cost c(x) obtained by the proposed heuristic algorithm M GREEDY-A for the test instances with fixed profits and costs.Notice that it holds p i = p i = 2c j .Also in the table, algorithm M GREEDY-A obtains the better objective function value of F (x) than that by algorithm M GREEDY-B.On the other hand, for an instance of problem WIC with either zero penalty coefficient α = 0 or a larger bound b, i.e., with either no or less effect of the cost penalty term, the consideration of Eqs. ( 19) and (20) in algorithm M GREEDY-A may deliver a worse performance than that of algorithm M GREEDY-B.Choosing the better of the two heuristic solutions by algorithms M GREEDY-A and M GREEDY-B is currently an easy way to reduce such a disadvantage.For future research, it would be interesting to enhance the greedy manner so that it addresses a wider range of the reversing cost penalty.

Conclusions
In this paper, we considered the weighted item collecting problem (WIC for short) in directed bipartite structure containing a set of items with profits and a set of players with costs.Problem WIC is viewed as a generalization of the minimal switching graph problem which has been introduced to model a constrained via minimization in the context of integrated circuit design automation (1,2) .That is, collecting an item in problem WIC may correspond to avoiding an undesirable via in the integrated circuit design.We here include a web site address in the list of references, which gives an explanation of the via in integrated circuit design (6) .In this paper, we treated the objective function consisting of the total profit and a penalty term of the costs paid by the players, and we designed a greedy heuristic algorithm, together with the pre- processing utilizing a stable sorting of the profits in the minimal cost consideration.We also conducted numerical experiments to demonstrate the performance of the proposed greedy heuristic algorithm, and observed that the preprocessing improves the value of the reversing cost penalty for some types of test instances.
For future research, as mentioned in the numerical section, it would be interesting to enhance the greedy manner so that it addresses a wider range of the reversing cost penalty.Also it would be significant to examine whether problem WIC with a certain objective function, e.g., the total profit only, admits an approximation algorithm with some theoretical performance guarantee (7) .In particular, it would be attractive to investigate a relationship with the maximum clique problem (5) , since the consistency among some basic semi-solutions may be illustrated by a clique.Further, it would be interesting to view the problem as a variant of 0-1 knapsack problem in graph structure (3,8,9) , since a family of them involves many practical applications (9,10) .

Table 1
Performance of the proposed greedy heuristic on instances with m = n = 20

Table 2
Performance of the proposed greedy heuristic on instances with m = n = 50 and m = n = 80

Table 3
Execution time of the proposed greedy heuristic on instances ×10 −2 [msec]

Table 4
Performance of the proposed greedy heuristic on instances with fixed profits and costs