Hi Luciano,
Please try the following codes, where k and l are variables. For your example, k=2 and l=2:
clear; clc;
syms h1 h2 h3 j12 j13 j23 integer
eq1 = + j12 + j23 + j13 - h1 - h2 - h3 == 3;
eq2 = - j12 - j23 + j13 - h1 + h2 - h3 == 3;
eq3 = - j12 + j23 - j13 + h1 - h2 - h3 == 3;
eq4 = + j12 + j23 + j13 + h1 + h2 + h3 == 3;
eq5 = - j12 + j23 - j13 - h1 + h2 + h3 <= 0;
eq6 = - j12 - j23 + j13 + h1 - h2 + h3 <= 0;
eq7 = + j12 - j23 - j13 - h1 - h2 + h3 <= 0;
eq8 = + j12 - j23 - j13 + h1 + h2 - h3 <= 0;
eqs = [eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8];
vars = [h1, h2, h3, j12, j13, j23];
S = solve(eqs, vars,'Real',true,'ReturnConditions',true)
Best,
Dongyue