You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: jtree_limid_inf_engine.m
    path of file: ./repos/bnt/BNT/inference/static/@jtree_limid_inf_engine
    
    the code of the file until where you have to start completion: function engine = jtree_limid_inf_engine(bnet)
% JTREE_LIMID_INF_ENGINE Make a junction tree engine for use by solve_limid
% engine = jtree_limid_inf_engine(bnet)
%

    
function engine = jtree_limid_inf_engine(bnet)
% JTREE_LIMID_INF_ENGINE Make a junction tree engine for use by solve_limid
% engine = jtree_limid_inf_engine(bnet)
%
% This engine is designed to compute marginals on decision nodes


MG = moralize(bnet.dag);
% We do not remove the utility nodes, because that complicates the book-keeping.
% Leaving them in will not introduce any un-necessary triangulation arcs, because they are always leaves.
% Also, since utility nodes have size 1, they do not increase the size of the potentials.

ns = bnet.node_sizes;
elim_order = best_first_elim_order(MG, ns);
[MTG, engine.cliques]  = triangulate(MG, elim_order);
[engine.jtree, root, B, w] = cliques_to_jtree(engine.cliques, ns);

% A node can be a member of many cliques, but is assigned to exactly one, to avoid
% double-counting its CPD. We assign node i to clique c if c is the "lightest" clique that
% contains i's family, so it can accomodate its CPD.
N = length(bnet.dag);
engine.clq_ass_to_node = zeros(1, N);
for i=1:N
  clqs_containing_family = find(all(B(:,family(bnet.dag, i)), 2)); % all selected columns must be 1
  c = clqs_containing_family(argmin(w(clqs_containing_family)));  
  engine.clq_ass_to_node(i) = c; 
end