Mathematical formulation of a operations research problem
    8 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    David Franco
      
 am 10 Sep. 2019
  
    
    
    
    
    Bearbeitet: David Franco
      
 am 2 Dez. 2021
            How can I implement this objective function and its constraints in Matlab (p-median problem)?

Thank you very much!
1 Kommentar
Akzeptierte Antwort
  Hasan Cosgun
      
 am 2 Dez. 2021
        
      Bearbeitet: Hasan Cosgun
      
 am 2 Dez. 2021
  
      nNodes = 52; % no of nodes (customers)
nP = 6; % No of Warehouses/Facilities
% dist: nNodes x nNodes distance matrix
% decision variables
x = optimvar('x',1,nNodes,'Type','integer','LowerBound',0,'UpperBound',1);
y = optimvar('y',nNodes,nNodes,'Type','integer','LowerBound',0,'UpperBound',1);
prob = optimproblem('ObjectiveSense','minimize');
prob.Objective = sum(sum(dist .* y)); 
onesum = sum(y,2) == 1;
vertxy = optimconstr(nNodes,nNodes);
for i=1:nNodes
    for j=1:nNodes
        vertxy(i,j) = y(i,j) <= x(j);
    end
end
depsum = sum(x) == nP;
prob.Constraints.onesum = onesum;
prob.Constraints.vertxy = vertxy;
prob.Constraints.depsum = depsum;
nSolution  = solve(prob);
Just a full start...
1 Kommentar
Weitere Antworten (1)
Siehe auch
Kategorien
				Mehr zu Wavelet Toolbox 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!
