How can I solve this Min Opt with 9 decision variables, which are again in the form of matrices
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I am very new to Matlab and I have the following question, but first the code:
x1 = sym('x1',[NA,NB]); % [ 0 , inf ]
x2 = sym('x2',[NA,NB]); % [ 0 , inf ]
x3 = sym('x3',[NA,NB]); % [ 0 , inf ]
x4 = sym('x4',[NA,NB]); % [ -inf , inf ]
%---
for i = 1:NA
for ii = 1:NB
C1(i,ii) = beqC1(i,ii) == x8(i,ii) + x7(i,ii) + x9(i,ii) + x2(i,ii);
C2(i,ii) = beqC2(i,ii) == x8(i,ii) + x3(i,ii) + x6(i,ii);
end
end
%---
[Aeq,beq] = equationsToMatrix([C1, C2], [x1, x2, x3, x4]);
f = sum(x5(:));
[x,costopt,exitflag,output] = intlinprog(f,[],[],[],Aeq,beq,[],[],[]);
Since I am a total beginner using Matlab, my question will be quite easy: How can I make this optimization problem work, so that it is in line with the following mathematical problem?
Since I already searched in the forum and on the web for solutions, without finding THE RIGHT guideline I would be more than happy to have expert help to code this problem. :)
Thank you!
1 Kommentar
Alan Weiss
am 6 Nov. 2017
And your question is what?
Alan Weiss
MATLAB mathematical toolbox documentation
Akzeptierte Antwort
Alan Weiss
am 6 Nov. 2017
I think that you are doing very well for a novice. You can continue in two different ways, at least.
1. As you have been doing, but realize that you need to convert your problem from symbolic variables to standard MATLAB doubles.
Aeqf = double(Aeq);
beqf = double(beq);
ff = zeros(size(Aeq,2),1);
f = sum(x5(:)) % just to see the relevant variables
ff(51:54) = 1;
intcon = 1:length(f);
lb = zeros(length(ff),1);
lb(3*12+1:4*12+4) = -Inf;
[x,costopt,exitflag,output] = intlinprog(ff,intcon,[],[],Aeqf,beqf,lb);
This didn't quite work for me when I tried it; perhaps something is still missing from the bounds, because the error message that came back was "Intlinprog stopped because the root LP problem is unbounded."
2. If you have R2017b, try the new Problem-Based Optimization approach. Instead of using symbolic variables, use optimization variables to formulate and solve your problem.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surrogate Optimization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!