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: MMEAWI.m
    path of file: ./repos/PlatEMO/PlatEMO/Algorithms/Multi-objective optimization/MMEA-WI
    
    the code of the file until where you have to start completion: classdef MMEAWI < ALGORITHM
% <multi> <real/integer> <multimodal>
% Weighted indicator-based evolutionary algorithm for multimodal multi-objective optimization

%------------------------------- Reference --------------------------------
% W. Li, T. Zhang, R. Wang, and H. Ishibuchi, Weighted indicator-based
% evolutionary algorithm for multimodal multiobjective optimization, IEEE
% Transactions on Evolutionary Computation, 2021, 25(6): 1064-1078.
%------------------
    
function is written by Wenhua Li

    methods
        function main(Algorithm, Problem)
            %% Parameter setting
            kappa = 0.05;
            t_gen=ceil(Problem.maxFE*0.4);

            %% Generate random population
            Population = Problem.Initialization();
            [Population,pfit] = EnvironmentalSelection(Population,Problem.N,kappa,1);
            [Arcd,afit] = UpdateArc(Population,Population,Problem.N);

            %% Optimization
            while Algorithm.NotTerminated(Arcd)
                if Problem.FE>=t_gen && rand>0.5 % Stage 2
                    [~,p1]=min(afit);
                    joint=[Arcd Population];
                    dist=pdist2(Arcd(p1).decs,joint.decs);
                    [~,so]=sort(dist,'ascend