How do I get MatLab to solve the following mixed integer non-linear optimization problem?
Mostrar comentarios más antiguos
Hello,
Using the opimization toolbox, I'm attempting to solve the following mixed integer non-linear optimization problem. It's a relatively simple set up. The problem involves batch sizes of part i, an amount of changeovers in month j and the problem is designed to always meet demand, while trying to do the amount of changeovers possible in a given month, and minimizes inventory left over in any month. See the code below
I get the following error message when I run the code:
"Error using optim.problemdef.OptimizationProblem/solve
Nonlinear problem with integer variables not supported."
I understand that all these variables could be matrices, but I'm also just learning MatLab syntax so I'm solving the problem this way for a proof of concept first.
Thanks all!
%i = parts = 2, j = months = 3
batchprob = optimproblem('ObjectiveSense','min');
%Demand
D11 = 500;
D12 = 200;
D13 = 600;
D21 = 400;
D22 = 300;
D23 = 100;
%Initial Inventory
I1o = 100;
I2o = 200;
%Holding Cost - Allows inventory to be of similar magnitude to changeovers (For minimizing objective function)
h1 = 0.001;
h2 = 0.001;
%Changeovers possible
Co1 = 2;
Co2 = 3;
Co3 = 2;
%Minimum batch sizes
Bm1 = 300;
Bm2 = 200;
%Calculating demand after subtracting initial inventory
D11 = D11 - I1o;
D21 = D21 - I2o;
%Decision Variables:
%Number of Changeovers
z11 = optimvar('z11','Type','integer','LowerBound',0);
z12 = optimvar('z12','Type','integer','LowerBound',0);
z13 = optimvar('z13','Type','integer','LowerBound',0);
z21 = optimvar('z21','Type','integer','LowerBound',0);
z22 = optimvar('z22','Type','integer','LowerBound',0);
z23 = optimvar('z23','Type','integer','LowerBound',0);
%Batch Sizes
B11 = optimvar('B11','LowerBound',0);
B12 = optimvar('B12','LowerBound',0);
B13 = optimvar('B13','LowerBound',0);
B21 = optimvar('B21','LowerBound',0);
B22 = optimvar('B22','LowerBound',0);
B23 = optimvar('B23','LowerBound',0);
%Inventories LeftOver
I11 = z11*B11 - D11;
I12 = z12*B12 - D12;
I13 = z13*B13 - D13;
I21 = z21*B21 - D21;
I22 = z22*B22 - D22;
I23 = z23*B23 - D23;
batchprob.Constraints.consbatch1 = B11 >= Bm1;
batchprob.Constraints.consbatch2 = B12 >= Bm1;
batchprob.Constraints.consbatch3 = B13 >= Bm1;
batchprob.Constraints.consbatch4 = B21 >= Bm2;
batchprob.Constraints.consbatch5 = B22 >= Bm2;
batchprob.Constraints.consbatch6 = B23 >= Bm2;
batchprob.Constraints.consdemand1 = z11*B11 >= D11;
batchprob.Constraints.consdemand2 = z12*B12 >= D12;
batchprob.Constraints.consdemand3 = z13*B13 >= D13;
batchprob.Constraints.consdemand4 = z21*B21 >= D21;
batchprob.Constraints.consdemand5 = z22*B22 >= D22;
batchprob.Constraints.consdemand6 = z23*B23 >= D23;
batchprob.Constraints.consCO1 = z11 + z21 >= Co1;
batchprob.Constraints.consCO1 = z12 + z22 >= Co2;
batchprob.Constraints.consCO1 = z13 + z23 >= Co3;
%Objective Function
batchprob.Objective = z11 + z12 + z13 + z21 + z22 + z23 + h1*I11 + h1*I12 + h1*I13 + h2*I21 + h2*I22 + h2*I23;
sol = solve(batchprob);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Get Started with Optimization Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!