you're making this way too difficult when it is actually very simple.

P'(x) is the velocity shown in the graph.

the ant moves upward when P'(x) > 0 (when the graph is above the x-axis)

the time intervals where P'(x) > 0 would be ...

0 to 3 = 3

3.5 to 6 = 2.5

8 to 13 = 5

15 to 18.5 = 3.5

total = 14 minutes