Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Finding the optimal solution for a specific supermarket is a generalization of the <a href="http://en.wikipedia.org/wiki/Set_cover_problem" rel="nofollow">set cover problem</a>, which is NP-complete. The reduction goes as follows: Given an instance of the set cover problem, just define a cost function assigning 1 to each combination, apply an algorithm that solves your problem, and you obtain an optimal solution of the set cover instance. (Finding the minimal price hence corresponds to finding the minimum number of covering sets.) Thus, your Problem is <a href="http://en.wikipedia.org/wiki/NP-hard" rel="nofollow">NP-hard</a>, and you cannot expect to finde a solution that runs in polynomial time.</p> <p>You really should implement the brute-force method you mentioned. I too recommand you to do this as a first step. If the performance is not sufficient, you can try a using a MIP-formulation and a solver like CPLEX, or you have to devolop a heuristic approach.</p> <p>For a single supermarket, it is rather trivial to find a <a href="http://en.wikipedia.org/wiki/Integer_linear_programming#Integer_unknowns" rel="nofollow">mixed integer program (MIP)</a>. Let <code>x_i</code> be the integer number how often product combination <code>i</code> is contained in a solution, <code>c_i</code> its cost and <code>w_ij</code> the number how often product <code>j</code> is contained in product combination <code>i</code>. Then, you are minimizing </p> <pre><code> sum_i x_i * c_i </code></pre> <p>subject to conditions like</p> <pre><code> sum_i x_i * w_ij >= r_j, </code></pre> <p>where <code>r_j</code> is the number how often product <code>j</code> is required.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload