4

I know that if I can express a problem as a (weighted) matroid M = (E, S) or a greedoid then I can assure that there is an algorithm which will give me the optimal solution. For example for matroids it goes something like:

T = {}
sort(E) increasingly
for e in the sorted array
  if (T union {e}) is an independent set
    T = T union {e}

which gives the minimum solution in $O(n\log(n) + nf(n))$ running time where $f$ is the time that takes to evaluate if its an independent set.

So for example I have the following problem: Given an array $E$ give the maximum value attainable summing up to $k$ elements of it. We can write it as the following matroid:

$ M = (E, S = \{ F \,\lvert\, \#F \leq k \land F \in \mathcal{P}(E) \}) $

It's easy to see that $S$ is an independent set because it follows all the axioms of a matroid:

  1. $\emptyset \in S$.
  2. If $A \in S$ and $B \subseteq A$ then $B \in S$.
  3. If $A, B \in S$ and $\lvert A \rvert > \lvert B \rvert$ then there is an $x \in A - B$ such that $B \cup \{x\} \in S$.

In this particular case our set weight function is $w(F) = \sum_{x \in F} \max(E) - x$. (because our first algorithm is a minimisation)

My problem then comes with a similar problem where we have a car that is travelling through a straight line and it can travel $L$ distance before refuelling, it also has mapped several points where it knows it can refuel, $x_1 \leq x_2 \cdots \leq x_n$.

We want to get the minimum number of stops needed for refuelling that gets us to $x_n$. The greedy strategy here is to move the car as much as possible before stopping each time. But I can't find any formulation to make this a matroid or greedoid.

For example I tried taking sets where all the points follow each other in the original line and they diff between min and max is less than L but that breaks the third axiom.

tl;dr I want to cast the last 3 paragraphs as a matroid but I'm having issues finding the independent set.

aram
  • 126
  • 6

1 Answers1

2

This might not qualify as a full answer but here is a reason why a naïve approach does not work to model this as a matroid.

Let $E = \{e_1, \ldots, e_n\}$ be your set of gas stations. Your assumption ($*$) says that for all $i < n$, there is a $j > i$ such that the distance $d(e_i, e_j) \leq L$, where $L$ is your maximum reach after refilling.

Let us call an ordered set $R = \{e_{i_1}, \ldots, e_{i_\ell}\} \subseteq E$ a roadmap if $d(e_{i_j}, e_{i_{j+1}}) \leq L$ for all $1 \leq j < \ell$ and $i_\ell = n$.

It is clear that the set of roadmaps does not satisfy the independec axioms of matroids as it is in general not downward-closed. But how about the complements? This gives us an independence system: $$\mathcal{I} = \{I \subseteq E \mid E \setminus I \text{ is a roadmap}\}.$$ Intuitively, a set of gas stations is independent if it is safe to pass all of these gas stations and you only fill up at gas stations in the complement.
Then $(1)$. $\varnothing \in \mathcal{I}$ is true by ($*$) and $(2)$ $I \subseteq I' \in \mathcal{I} \implies I \in \mathcal{I}$ holds as you only have more gas stations available when going from roadmap $E \setminus I'$ to roadmap $E \setminus I$. However, $(3)$ for all $I, I' \in \mathcal{I}$ with $|I| < |I'|$ there exists $e \in I' \setminus I$ such that $I+e \in \mathcal{I}$ is in general not true.

Consider the following example: The road is on the interval $[0, 15]$, maximum travel distance is $L = 5$ and we have gas stations $E = \{3, 5, 8, 10, 13, 15\}$. There is an optimal roadmap $\{5, 10, 15\}$ corresponding to the independent set $I' = \{3, 8, 13\}$. Another roadmap is $\{3, 8, 13, 15\}$ with independet set $I = \{5, 10\}$. Now it is easy to verify that $I$ and $I'$ do not satisfy $(3)$.


As additional remark (because I do not know how the question whether your setting can be modeled as matroid arised): The greedy algorithm that you proposed clearly finds an optimal solution (a simple exchange argument should prove this). Does this mean there has to be a matroid hidden somewhere?
The answer to this is no. For this to be true, the greedy algorithm has to fit the matroid greedy algorithm (as described by you in the upper half of the question). This includes that the matroid greedy always has to find a base no matter what order you choose for the elements. The greedy algorithm for the gas station problem on the other hand has to look at the items in order of their appearance on the road (actually with a look-ahead).

ttnick
  • 2,034
  • 10
  • 19