Can an AI learn to suffer?
At a very high level, regarding evolutionary game theory and genetic algorithms, it is absolutely possible that AI could develop a state that is analogous with suffering, although, as you astutely point out, it would involve conditions that a computer cares about.  (For instance, it might develop a feeling analogous to &quot;being aggrieved&quot; over non-optimality in the algorithmic sense, or &quot;frustration&quot; at equations don't add up, or &quot;dissatisfaction&quot; over goals that have not been achieved.)
The robot tormented by small children at the mall can certainly be said to be &quot;suffering&quot; in that the children block the performance of the robot's function, but the robot is not conscious and suffering might be said to require awareness.  However, even without consciousness, this very simple robot can learn new behaviors through which it mitigates or avoids the &quot;suffering&quot; brought on by not being able to fulfill its function.
You definitely want to look into the concept of suffering in a philosophical context and Epicurus would be a very useful place to start.
Epicurus is directly relevant in an algorithmic sense because he uses the term &quot;ataraxia&quot; meaning calm, and is derived from the verb &quot;tarasso&quot; which means to agitate or disturb.
Ataraxia can be mathematically expressed as an equilibrium.  Tarasso can be mathematically expressed as disequilibrium.
This relates directly to Game Theory in that disequilibrium can be said to be the primary requirement of games, and to AI in that Game Theory can be said to be the root of all AI.
Ataraxia is also understood in the sense of &quot;freedom from fear&quot;, which is temporal in that fear is a function of uncertainty as it relates to the future in a predictive sense, and involves current condition vs. possible, less optimal future conditions.
Thus fear, which is a form of suffering, is rooted in computational intractability, even where the &quot;computer&quot; is is a human brain.
Early philosophers such as Democritus are especially useful because they were exploring critical, fundamental concepts, many of which can now be expressed with modern mathematics.
To wit: you can't arrive at suffering until you first define &quot;the Good&quot; and &quot;the Bad&quot;, which is a binary relationship in which neither term can be said to have meaning without the opposite.  (Mathematically, it can be expressed in its simplest form as a finite, one-dimensional graph.)  This understanding is quite ancient.

It is worth noting that the continuing value of the early philosophers is partly a factor of wisdom not being dependent on the volume of knowledge, demonstrated by Socrates in the idea that wisdom may be as simple as knowing you don't know something.
The ancient sages didn't have the benefit of powerful measurement tools, advanced mathematics, or scientific method, but they were very smart, and even more importantly, wise.