genetic algorithm - not running - reg
2 views (last 30 days)
Show older comments
I converted a GAMS model (mip) file into cplexmps format using PAVER web server. I read this file into MATLAB R2015b using mpsread command.
Then i got the following output.
problem = mpsread('cplex(1).mps')
problem =
f: [1925x1 double]
Aineq: [216x1925 double]
bineq: [216x1 double]
Aeq: [773x1925 double]
beq: [773x1 double]
lb: [1925x1 double]
ub: [1925x1 double]
intcon: [0x1 double]
solver: 'linprog'
options: [1x1 optim.options.Linprog]
Then i made slight modifications as follows to use the problem with genetic algorithm solver.
c =(problem.f)';
A=problem.Aineq;
b=problem.bineq;
Aeq=problem.Aeq;
beq=problem.beq;
lb=problem.lb;
ub=problem.ub;
A = full(A);
Aeq=full(Aeq);
fun = @(x) sum(c.*x);
A=[A;Aeq;-Aeq];
b=[b;beq;-beq];
options = gaoptimset('PlotFcn',@gaplotbestf)
when i wanted to run ga with the following commands, it is showing 'busy' symbol for an abnormal time. how can i get the output.
[x,fval]=ga(fun,1925,A,b,[],[],lb,ub,[],options)
2 Comments
KSSV
on 16 Nov 2017
May be the data is huge......for your computer spec. YOu first try with a down sampled/ less data.
Answers (1)
Walter Roberson
on 16 Nov 2017
ga() uses random searching that wanders around local minima hoping to find a good location, with no certainty at all that it will ever find the best conformation. The number of combinations to try rises exponentially.
linprog() uses linear programming techniques that know how to split the problem domain according to constraints and then run a minimizer on each subdomain that is certain to find the minima over that subdomain; it goes through all of the subdomains and picks the one that does the best. It can take a while to create all of the subdomains implied by the constraints, but because each sub-problem is linear, it is certain to be able to optimize it -- the optimum is always at one of the corners of each linear sub-domain.
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!