goodInitialPoint

PURPOSE ^

generates 4*length(model.lb) random points

SYNOPSIS ^

function [out] = goodInitialPoint(model, n)

DESCRIPTION ^

 generates 4*length(model.lb) random points
 takes linear combinations of them so that all points are in the interior.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [out] = goodInitialPoint(model, n)
0002 % generates 4*length(model.lb) random points
0003 % takes linear combinations of them so that all points are in the interior.
0004 if nargin < 2
0005     n = 1;
0006 end
0007 xs = zeros(length(model.lb), 4*length(model.lb));
0008 
0009 for i = 1:length(model.lb)
0010     model.c = zeros(size(model.lb));
0011     model.c(i) = 1;
0012     t1 = optimizeCbModel(model);
0013     xs(:,2*i-1) = t1.x;
0014     model.c = -model.c;
0015     t1 = optimizeCbModel(model);
0016     xs(:,2*i) = t1.x;
0017     if mod(i, 100) == 0
0018         i
0019     end
0020 end
0021 for i = 1:length(model.lb)
0022     model.c = randn(size(model.lb));
0023     model.c(i) = 1;
0024     t1 = optimizeCbModel(model);
0025     xs(:,2*length(model.lb)+2*i-1) = t1.x;
0026     model.c = -model.c;
0027     t1 = optimizeCbModel(model);
0028     xs(:,2*length(model.lb) + 2*i) = t1.x;
0029     if mod(i, 100) == 0
0030         i+length(model.lb)
0031     end
0032 end
0033 
0034 out = zeros(length(model.lb), n);
0035 for i = 1:n
0036     t2 = rand(4*length(model.lb),1);
0037     t2 = t2/sum(t2);
0038     out(:,i) = xs*t2;
0039 end

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003