Not quite sure what kind of answer you’re looking for but maybe it’s something along the following lines.
First, a lot of words to specify the problem I think the diagram is describing: There are 5 kinds of objects, each identified by a colour and a shape. For this specific problem, one of these is redundant, so let’s just use shape. The diagram suggests that each kind has a “weight” property and the problem is to find out what the weights of each kind are. Furthermore the “units” of weight are unspecified (scales only indicate relative weights), so let’s assume that (at least) one of them weighs 1 so the others are some multiple of 1 to permit the scales to balance.
@brebs pretty much defined the clpfd approach to a solution. Step 1 define the variables you want to solve for and the initial domains:
Weights = [CirW,HexW,SqW,TriW,DiaW], Weights ins 1..100,
Step 2: define the 4 constraints as defined by the 4 scales in the diagram:
CirW #= HexW, 2*SqW #= SqW+TriW, SqW #= CirW+HexW, 2*SqW #= DiaW,
Finally, in case the problem isn’t sufficiently constrained at this point, or the constraint propagation isn’t strong enough (e.g., non-linear constraints), perform some kind of labelling/solve step - basically a search. In this case the only thing left to do is to force one of the weights to be 1, so how about
member(1,Weights).
Put them together to produce a solution. In fact it produces two identical solutions (why?).
More properties and constraints? Just add them at the appropriate step. That’s the CLP approach (test then generate), but you should write a standard Prolog version for comparison.
HTH.
P.S. You can try the clpfd solution yourself. Here’s a working query using clpBNR:
?- Weights=[CirW,HexW,SqW,TriW,DiaW], Weights::integer(1,_),
{CirW == HexW,2*SqW == SqW+TriW,SqW == CirW+HexW,2*SqW == DiaW},
member(1,Weights).
Weights = [1, 1, 2, 2, 4],
CirW = HexW, HexW = 1,
SqW = TriW, TriW = 2,
DiaW = 4 ;
Weights = [1, 1, 2, 2, 4],
CirW = HexW, HexW = 1,
SqW = TriW, TriW = 2,
DiaW = 4 ;
false.