def test_obj_function(self):
        f1 = relation_from_str('f1', 'v1 * 0.5', [v1])
        cv1 = VariableComputationNode(v1, ['f1'])
        cf1 = FactorComputationNode(f1)
        cg = ComputationsFactorGraph([cv1], [cf1])

        agents_names = ['a1', 'a2']
        alphas = _build_alphaijk_binvars(cg, agents_names)

        obj = _objective_function(cg, communication_load, alphas, agents_names)

        # In that case, the objective function must depend on two variables:
        self.assertEqual(len(obj.sorted_keys()), 2)
    def test_build_alphaijk_one_var_one_fac(self):
        f1 = relation_from_str('f1', 'v1 * 0.5', [v1])
        cv1 = VariableComputationNode(v1, ['f1'])
        cf1 = FactorComputationNode(f1)
        cg = ComputationsFactorGraph([cv1], [cf1])

        agents_names = ['a1', 'a2']

        alphas = _build_alphaijk_binvars(cg, agents_names)

        self.assertEqual(len(alphas), 2)
        self.assertIn((('v1', 'f1'), 'a1'), alphas)
        self.assertIn((('v1', 'f1'), 'a2'), alphas)
        print(alphas)