{'fraction_non_alphanumeric': 0.02761904761904762, 'fraction_numerical': 0.018095238095238095, 'mean_word_length': 4.650537634408602, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Fast Algorithm for Knapsack Problem with Conflict Graph

In this paper, we propose a fast algorithm based on a new algorithm to calculate the upper bound for the knapsack problem with conflict graph (KPCG). The KPCG is an extension of the 0-1 knapsack problem. A pre-defined conflict graph defines the incompatibility properties between pairs of items. The goal is to determine which items should be packed into the knapsack to maximize the total profit on the premise of satisfying the capacity constraint and the incompatibility constraints. The experimental results show that for the graph with density greater than or equal to 0.1, the branch-and-bound algorithm based on the new algorithm is 1.6458 and 1.6352 times faster than the state-of-the-art algorithm on random and correlated instances, respectively, and can achieve speedups of up to 4.6477 for some low density instances. Moreover, the branch-and-bound algorithm based on the new algorithm can optimally solve more instances than the state-of-the-art algorithm in a given time limit.