I want to write compound terms that represent linear relations between different variables in a population of the form Y = a + b*X (e.g. fuelConsumption = 2 + 3 * distance, for a population consisting of cars). I have problems with stating that the relation is about a population (group) while at the same stating that values for each variable are linked within objects (i.e. that car A’s fuel consumption is 2 + 3 * car A’s distance, and not car B’s distance).
This could represent that the relation is for a population but misses to explicitly state that values of each variable are linked within objects:
causes(
cause(distance),
effect(fuelConsumption),
a(2),
b(3)
).
Conversely, this captures that values of each variable are linked within objects but misses that the compound is a relation (a line). Each instantiation of this compound represents two points, but what i wanted was each instantiation to be a line.
car(aCar).
car(anotherCar).
causes(
cause(Car, distance, D),
effect(Car, fuelConsumption, F)
):- car(Car), F #= 2 + 3 * D.
This seems closer to a solution but i am still not really satisfied for two reasons: 1. The statement about the linear relation should hold for any population and not just the objects that i happen to specify in the population term; 2. The function that relates distance to fuelConsumption is not made explicit (e.g. what about if there is an exponential relation, etc?).
population([car1, car2, car3, car4]).
causes(
cause(P, distance),
effect(P, fuelConsumption),
a(2),
b(3)
):-population(P).
Any help would be greatly appreciated. My goal is to declare relations are precisely and transparently as possible (i.e. should be human-readable).
Thanks!
/JC
Some links to related questions:
representing-a-system-of-equations-about-classes-of-objects,
how-to-encode-causal-relations-in-prolog-as-a-linear-function