Joint Product and Fulfillment Optimization
3 views (last 30 days)
Show older comments
Hello I am trying to create a Joint Pricing and fulfillment Model on Matlab. Using the Demand curve as one of the decision Variable however I am getting an error. I know it has something to do with the demand curve but I can't figure out how to reformulate it .
Error using optim.internal.problemdef.Times.getTimesOperator
At least one argument must be numeric.
Error in .*
Error in *
Error in JPF (line 9)
p.Objective = g*(116-2*g) +18*x('IltoMi') + 38.25*x('IltoOR') + 41.75*x('CatoMi') + 20.71*x('CatoOr');
Please let me know if further information is required Thank
p = optimproblem;
vars = {'Price','IltoMi','IltoOR','CatoMi','CatoOr'};
x= optimvar('x',vars,'LowerBound',0);
optimvar('y',3,'Type','integer','LowerBound',0,'UpperBound',1);
p.ObjectiveSense = 'maximize';
p.Objective = g*(116-2*g) + g*(116-2*g) +18*x('IltoMi') + 38.25*x('IltoOR') + 41.75*x('CatoMi') + 20.71*x('CatoOr');
p.Constraints.c1 = x('IltoMi') + x('IltoOR') + x('CatoMi')+ x('CatoOr') == 116-2*x('Price');
p.Constraints.c2 = x('IltoOR') + x('IltoMi') <= 60;
p.Constraints.c3 = x('CatoMi')+ x('CatoOr') <= 56;
1 Comment
PATEL ZEEL BHARATKUMAR
on 13 Dec 2018
Sir , if you find the solution of this then please tell me because i am getting this error also in my program.
Thank you.
Answers (1)
Mark McBroom
on 7 Apr 2018
The error message is coming from the first two terms in the Objective. I believe the problem is that the Objective is not a linear expression. It is complaining about the first two terms involving "g". See this link .
3 Comments
Alan Weiss
on 10 Apr 2018
Sorry, at the moment we do not have an integer solver for quadratic objectives.
If your problem is convex, you might be able to use the approach shown in this example, but I don't really know whether it applies to your case.
Alan Weiss
MATLAB mathematical toolbox documentation
Sanyam Maheshwari
on 21 Jul 2020
I am also facing the issue with my optimization problem.
global SL V p r k m n C Z s
SL = [0.75 0.75 0.75 0.75];
V = 94100;
p = [0.07,0.18,0.2,0.3];
r = [55 55 55 55;
47 47 47 47;
45 45 45 45;
49 49 49 49];
k = [33 33 33 33;
28 28 28 28;
29 29 29 29;
30 30 30 30];
m = 4;
n= 4;
C = [78,69,70,73;
64,68,56,59;
34,39,42,41;
52,47,48,45];
Z =[250 250 250 250;
320 320 320 320;
440 440 440 440;
350 350 350 350];
s = [110,95,99,100];
global SL V r k m n C Z s
% Generating Variables
Q = optimvar('Q',m,n,'LowerBound',0,'UpperBound',Z);
b = optimvar('b',m,n,'Type','integer','LowerBound',0,'UpperBound',1);
rng
y = rand(4);
x = sym('x',[4,1]);
% limit of integration
l = y*Q;
q = sum(l(:));
% Constraints
% Budget Constraint
B = C*b*y*Q;
budget = sum(B(:)) <= V;
% normal constraint
normal = int(normpdf(x, 400, 100),q,Inf) <=SL;
% each product connects to exactly one supplier
con4 = sum(b,1) == ones(m,1)';
% Objective Function:-
% optimization problem
demandprob = optimproblem;
% Revenue
revenue = sum(s*b*x,1);
% Cost
cost = sum(sum(C*b*y*Q,1),2);
%Salvage
salvage = sum(b*r*(sum(sum(y*Q - x,1),2)),1);
% Revenue when demand is more
revenue2 = sum(s*b*y*Q,2);
% Salvage when demand is more
salvage2 = sum(b*k*(x - sum(sum(y*Q,1),2)),1);
% The objective function to maximize the below Expected Profit
demandprob.Objective = int(((revenue - cost + salvage).*normpdf(x, 400, 100)),0,q); + int(((revenue2 - cost - salvage2).*normpdf(x, 400, 100)),q,Inf);
% Include the constraints in the problem.
demandprob.Constraints.budget = budget;
demandprob.Constraints.normal = normal;
demandprob.Constraints.con4 = con4;
opts = optimoptions('intlinprog','Display','off','PlotFcn',@optimplotmilp);
% Call the solver to find the solution.
[sol,fval,exitflag,output] = solve(demandprob,'options',opts);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/334833/image.jpeg)
Also I want to maximize this optimization problem
What should I do further.
please help
See Also
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!