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: GLP_OperatorGAhalf.m
    path of file: ./repos/PlatEMO/PlatEMO/Algorithms/Multi-objective optimization/NUCEA
    
    the code of the file until where you have to start completion: function [Offspring,outIndexList,chosengroups] = GLP_OperatorGAhalf(Problem,Parent1,Parent2,numberOfGroups)
% Parent1 and Parent2 are the matrix of decision variables, not solutions

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% research purposes. All publicat
    
function [outIndexArray,numberOfGroupsArray] = CreateGroups(numberOfGroups, xPrime, numberOfVariables)
% Creat groups by ordered grouping

    outIndexArray = [];
    numberOfGroupsArray = [];
    noOfSolutions = size(xPrime,1);
    for sol = 1:noOfSolutions        
        varsPerGroup = floor(numberOfVariables/numberOfGroups);
        vars = xPrime(sol,:);
        [~,I] = sort(vars);
        outIndexList = ones(1,numberOfVariables);
        for i = 1:numberOfGroups-1
            outIndexList(I(((i-1)*varsPerGroup)+1:i*varsPerGroup)) = i;
        end