Just for amusement, here's a MiniZinc constraint programming model for the problem. It yields (unsurprisingly) the same unique solution that Erwin's MINLP model produces.
% Bachet de Meziriac problem include "globals.mzn"; % sizes of the pieces array[1..4] of var 1..40: x; % pieces used in subtotals array[1..40, 1..4] of var -1..1: y; % order constraints constraint increasing(x); % overall sum constraint sum(x) = 40; % partial sums constraint forall (i in 1..40) (sum([ x[j]*y[i,j] | j in 1..4 ]) = i); % search solve::int_search(x, largest, indomain_max, complete) satisfy;
I have added a photo of an old fashioned balance scale. Indeed with a left and right pan to put weights in. I imagine they used something like that.
ReplyDeleteNice!
Delete