Performance 多重线性优化
我对在MATLAB中求解几百个线性系统感兴趣。目前,这是由linprog的for循环完成的 使用的向量具有相同的维数,是一个矩阵的直线Performance 多重线性优化,performance,matlab,mathematical-optimization,linear-programming,Performance,Matlab,Mathematical Optimization,Linear Programming,我对在MATLAB中求解几百个线性系统感兴趣。目前,这是由linprog的for循环完成的 使用的向量具有相同的维数,是一个矩阵的直线 for combination_id = 1:1000 [tempOperatingPointsVectors,tempTargetValue, exitflag] = ... linprog( lo_c(combination_id,:), ... [], [], ... lo_G(:,:,combinat
for combination_id = 1:1000
[tempOperatingPointsVectors,tempTargetValue, exitflag] = ...
linprog( lo_c(combination_id,:), ...
[], [], ...
lo_G(:,:,combination_id), lo_d(:,combination_id), ...
lo_u(:,combination_id), lo_v(:,combination_id), ...
x0_in, options);
end
有没有一种方法可以将linprog用于整个向量,而不是拾取每一行?
我还尝试了parfor循环,但由于每个循环中的操作都非常小,因此速度没有提高。为什么不能设置一个大的线性程序,然后一次解决所有问题 由于我没有您的数据,我无法测试以下代码,但基本思想应该是可行的
xVar = 1:size(lo_c,2);
uBound = lo_u(:, 1);
vBound = lo_v(:, 1);
dMat = lo_d(:, 1);
gMat = lo_G(:,:, 1);
objMat = lo_c(1,:);
x0_inMat = x0_in;
for combination_id = 2:1000
xVar = [xVar, xVar(end)+1:xVar(end)+size(lo_c,2)];
uBound = [uBound; lo_u(:, combination_id);
vBound = [vBound; lo_v(:, combination_id);
dMat = [dMat; lo_d(:, combination_id);
gMat = [gMat; lo_G(:,:, combination_id)];
objMat = [objMat; lo_c(combination_id,:)];
x0_inMat = [xo_inMat; x0_in];
end
[tempOperatingPointsVectors,tempTargetValue, exitflag] = ...
linprog( objMat, ...
[], [], ...
gMat, dMat, ...
uBound, vBound, ...
x0_in, options);
应该这样做。一个想法是重新实现一个算法,例如单纯形,并在适当的地方添加矩阵运算。有人知道在哪里可以找到具有上下边界的Matlab单纯形代码吗?