代码实现
MATLAB
main.m
clc, clear
rng('shuffle')
format short e
options.nDim = 2;
options.nDemander = 80;
options.nSupplier = ceil(options.nDemander/4);
options.maxFrnd = ceil(options.nDemander/4);
options.constrPer = 10;
options.KsigmaD = 0.7;
options.KsigmaS = 0.2;
options.KnumS = 0.4;
options.domain = [zeros(options.nDim, 1)-65.536, zeros(options.nDim, 1)+65.536];
options.nFeval = 50000;
options.objFun = 'Foxholes';
[x, val, valHist, m] = remark(options);
x, val
remark.m
function [x, val, valHist, m] = remark(options)
m = market(options.objFun,...options.domain,...options.nDemander,...options.maxFrnd,...options.nDim,...options.nSupplier,...options.constrPer,...options.KsigmaD,...options.KsigmaS,...options.KnumS...);
nIter = floor(options.nFeval/options.nDemander);
valHist = zeros(nIte