Can intlinprog optimize a custom function?
古いコメントを表示
Good Morning.
I'm trying to optimize a function that has one return value and 25 parameters (which must be integers and positives).
Inside this function there is a call to a Simulink simulation.
I tried to do the optimization using genetic algorithm (code below), but this one did not converge, it was "stuck" to only one result.
% Defining non-negativity constraints
A = eye(25)*-1;
b = zeros(25,1);
% Calling G.A. with non-negativity constraints and defining that all 25 variables must be integers
x = ga(@OtimizaKanban,25,A,b,[],[],[],[],[],[1:25])
The function to be optimized is as follows:
function [Faval] = OtimizaKanban(X)
time = 365.0;
% Matéria-Prima
qtdMateriaPrima = [X(1,1), X(1,2), X(1,3), X(1,4)];
tempoProdMateriaPrima = [0.1, 0.08, 0.1, 0.08];
tempoEntMateriaPrima = [1, 0.5, 1, 0.5];
% Kanbans
nroKabansRetPeca = [X(1,5), X(1,6), X(1,7), X(1,8), X(1,9), X(1,10), X(1,11), X(1,12), X(1,13), X(1,14)];
nroKabansProcPeca = [X(1,15), X(1,16), X(1,17), X(1,18), X(1,19), X(1,20), X(1,21), X(1,22), X(1,23), X(1,24)];
nroKabansProcMontagem = X(1,25);
% Capacidade de Produção
tempoProdPeca = [2, 1.5, 2, 1.5, 1.5, 2, 1.5, 2, 1.5, 1.5];
tempoTransPeca = [1, 0.5, 1, 0.5, 0.5, 1, 0.5, 1, 0.5, 0.5];
tempoMontagemProd = 0.6;
demandaDiariaMesAno = [1, 2, 5, 10, 10, 5, 3, 2, 2, 2, 1, 1];
options = simset('SrcWorkspace','current');
sim('Kanban_Complex',[],options);
Faval = n_sol_descartadas(end)
Would there be some way to do this using intlinprog??
採用された回答
その他の回答 (1 件)
João Ricardo Braga de Paiva
2017 年 7 月 18 日
0 投票
1 件のコメント
Alan Weiss
2017 年 7 月 18 日
We don't have any good MINLP solvers for problems of that size. It is hard to find a good algorithm to optimize a simulation with 25 integer parameters.
You can try patternsearch, but I don't know that it will do well. Start it at a positive integer point, set the ScaleMesh option to false, the InitialMeshSize option to a power of 2 such as 2 or 4 or so (depends on what you think will be a reasonable value), and MeshTolerance to be something just under 1, such as 0.75. Use the default PollMethod. In this way, patternsearch will search just positive integer points. However, it is not guaranteed to reach a global minimum, so you might have to restart it from a different positive integer point. And you might want to set the (justly discouraged, but for this case maybe appropriate) Cache option to 'on'. And maybe set the PollOrderAlgorithm option to 'Random' or 'Success', but I don't really know. If you choose to set the UseCompletePoll option to true, then the poll order doesn't matter.
Sorry that we don't have anything better for you at the moment.
Alan Weiss
MATLAB mathematical toolbox documentation
カテゴリ
ヘルプ センター および File Exchange で Get Started with Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!