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: presolveSOS.m
    path of file: ./repos/YALMIP/modules/global
    
    the code of the file until where you have to start completion: function p = presolveSOS(p)
if ~isempty(p.sosgroups)
    for i = 1:length(p.sosgroups)
        for j = 1:length(p.sosgroups{i})
            % Probe what happens if we activate this binary
            k = p.sosgroups{i}(j);
            other = setdiff(p.sosgroups{i},k);
            if p.ub(k) && ~any(p.lb(p.sosgroups{i}))
                % Still free to be activated
                p_ = p;
                p_.ub(other) = 0;

    
function p = presolveSOS(p)
if ~isempty(p.sosgroups)
    for i = 1:length(p.sosgroups)
        for j = 1:length(p.sosgroups{i})
            % Probe what happens if we activate this binary
            k = p.sosgroups{i}(j);
            other = setdiff(p.sosgroups{i},k);
            if p.ub(k) && ~any(p.lb(p.sosgroups{i}))
                % Still free to be activated
                p_ = p;
                p_.ub(other) = 0;
                p_.lb(k) = 1;
                p_ = smashFixed(p_);
                if ~isempty(fixedInfeasibleEquality(p_))      
                    p.ub(k) = 0;
                end