Collecting Carrots: A Greedy Algorithm Fails in Geometric Optimization

Collecting Carrots: A Greedy Algorithm Fails in Geometric Optimization
Loading the math board and drawing, please wait…
2021-01-10 02:48
This example demonstrates, via a “collecting carrots” geometric placement and selection process, how a greedy algorithm can fail to achieve the global optimum when it commits to locally best choices. It highlights optimization problem modeling, the decision-making gap between local and global optimality, and geometric characterizations related to slope/difference-type relationships, using structured configurations such as circles and isosceles triangle setups. Construction-wise, it is built using GeoGebra commands extracted from the construct summary: Flatten (to linearize nested lists), Zip (to pair elements across lists), Element (to access objects by index), and Segment (to form connecting segments). The scene also relies on objects such as circleCenters and circleBorders (circle definitions), carrotsCollected (the collected/score outcome), circleValues (values associated to circles), and condition/group markers like isA1…isE6 and isOnLevel1…isOnLevel5 to represent level-based criteria and candidate membership. Suitable for advanced secondary school through early undergraduate study, especially for lessons connecting algorithmic reasoning with geometric construction and optimization counterexamples.

GeoGebra Commands & Parameters

  1. Flatten(Sequence[Sequence[(i, j), i, 1 + ((j - 1) * 0.5), 6 - ((j - 1) * 0.5), 1], j, 5, 1, -1]) → circleCenters
  2. Zip(Circle[A, 0.35], A, circleCenters) → circleBorders
  3. Element(circleBorders, 1) → circleA1
  4. Element(circleBorders, 2) → circleA2
  5. Element(circleBorders, 3) → circleB1
  6. Element(circleBorders, 4) → circleB2
  7. Element(circleBorders, 5) → circleB3
  8. Element(circleBorders, 6) → circleC1
  9. Element(circleBorders, 7) → circleC2
  10. Element(circleBorders, 8) → circleC3
  11. Element(circleBorders, 9) → circleC4
  12. Element(circleBorders, 10) → circleD1
  13. Element(circleBorders, 11) → circleD2
  14. Element(circleBorders, 12) → circleD3
  15. Element(circleBorders, 13) → circleD4
  16. Element(circleBorders, 14) → circleD5
  17. Element(circleBorders, 15) → circleE1
  18. Element(circleBorders, 16) → circleE2
  19. Element(circleBorders, 17) → circleE3
  20. Element(circleBorders, 18) → circleE4
  21. Element(circleBorders, 19) → circleE5
  22. Element(circleBorders, 20) → circleE6
  23. Segment(root, A1) → f
  24. Segment(root, A2) → g
  25. Segment(A1, B1) → h
  26. Segment(A1, B2) → i
  27. Segment(A2, B2) → j
  28. Segment(A2, B3) → k
  29. Segment(B1, C1) → l
  30. Segment(B1, C2) → m
  31. Segment(B2, C2) → n
  32. Segment(B2, C3) → p
  33. Segment(B3, C3) → q
  34. Segment(B3, C4) → r
  35. Segment(C1, D1) → s
  36. Segment(C1, D2) → t
  37. Segment(C2, D2) → a
  38. Segment(C2, D3) → b
  39. Segment(C3, D3) → c
  40. Segment(C3, D4) → d
  41. Segment(C4, D4) → e
  42. Segment(C4, D5) → f_1
  43. Segment(D1, E1) → g_1
  44. Segment(D1, E2) → h_1
  45. Segment(D2, E2) → i_1
  46. Segment(D2, E3) → j_1
  47. Segment(D3, E3) → k_1
  48. Segment(D3, E4) → l_1
  49. Segment(D4, E4) → m_1
  50. Segment(D4, E5) → n_1
  51. Segment(D5, E5) → p_1
  52. Segment(D5, E6) → q_1
  53. Zip(Text[A, B - (0.15, 0.15)], A, circleValues, B, circleCenters) → circleLabels

AI Drawing Prompt Reference

Draw a geometric figure consisting of six equilateral triangles and five circles. Each circle has a radius of 0.35 and is centered at specific points. Triangles and circles are connected by line segments to form a complex path. Start by drawing the circle centers, then draw the circles, followed by the vertices of the triangles, and finally connect the circles and triangle vertices with line segments to form the path.
The prompt above was compiled from the original drawing commands and is for reference only.