I am looking for the coding for vogel approximation method in matlab
Dear Bhupesh Dutt Sharma,
VAM in Matlab could be as follows:
function [ Solution, OverallCost ] = VAM(CostsMtx, resources_col, demands_row)
C_start = CostsMtx;
C = C_start;
m = size(C,1);
n = size(C,2);
a = resources_col;
b = demands_row;
X = zeros(m,n);
stop = 0;
while stop == 0
for i = 1:m
for j = 1:n
if a(i,1) == 0
C(i,j) = max(C(:,j));
end
if b(1,j) == 0
C(i,j) = max(C(i,:));
C_sort_col = sort(C,1);
C_sort_row = sort(C,2);
Diff_customer = abs(C_sort_col(1,:) - C_sort_col(2,:));
Diff_supplier = abs(C_sort_row(:,1) - C_sort_row(:,2));
Diff_supplier(i,1) = 0;
Diff_customer(1,j) = 0;
Max_Diff_customer = max(Diff_customer);
Max_Diff_supplier = max(Diff_supplier);
Customer_nr = find(Diff_customer==max(Max_Diff_customer,Max_Diff_supplier));
Supplier_nr = find(Diff_supplier==max(Max_Diff_customer,Max_Diff_supplier));
if isempty(Customer_nr) == 0
Supplier_nr_ = find(C(:,Customer_nr(1)) == min(C(:,Customer_nr(1))));
X(Supplier_nr_(1),Customer_nr(1)) = min(a(Supplier_nr_(1),1),b(1,Customer_nr(1)));
a(Supplier_nr_(1),1) = a(Supplier_nr_(1),1) - X(Supplier_nr_(1),Customer_nr(1));
b(1,Customer_nr(1)) = b(1,Customer_nr(1)) - X(Supplier_nr_(1),Customer_nr(1));
Supplier_nr = [];
if isempty(Supplier_nr) == 0
Customer_nr_ = find(C(Supplier_nr(1),:) == min(C(Supplier_nr(1),:)));
X(Supplier_nr(1),Customer_nr_(1)) = min(a(Supplier_nr(1),1),b(1,Customer_nr_(1)));
a(Supplier_nr(1),1) = a(Supplier_nr(1),1) - X(Supplier_nr(1),Customer_nr_(1));
b(1,Customer_nr_(1)) = b(1,Customer_nr_(1)) - X(Supplier_nr(1),Customer_nr_(1));
%Stop condition:
a1 = a > 0;
b1 = b > 0;
if sum(a1) == 1
stop = 1;
if b(j) > 0;
X(a1 == 1,j) = b(j);
if sum(b1) == 1
if a(i) > 0;
X(i,b1 == 1) = a(i);
Solution = X;
OverallCost = sum(sum(C_start .* X));
Please, let me know if there are any problems with the code.
Regards,
Remigiusz Iwańkowicz
Hi Remigiusz,
excellent, works like a charm!
Kine regards
Mario Galić
Hello!!!
could you please provide code for Russell's Approximation Method.
thanks
Sorry, I haven't coded this method yet.
The stability of the Solar System is a complex subject that blends the classical framework of Newtonian mechanics with the modern insights provided by General Relativity (GR). Understanding this...
07 August 2024 2,569 1 View
My name is Apurva Saoji. I am a Ph.D scholar in Computer engineering in India. I am looking for international expert in reviewing my PhD thesis, "Competitive Optimization Techniques to Minimize...
07 August 2024 4,600 2 View
Dear all, I am working on particle deposition in human's & rat's respiratory airways using CFD and I am looking for the 3D CAD file for my simulations (STEP or IGES format). If somone has such...
29 July 2024 1,092 2 View
Hello; I am conducting a CFD study on two-phase flow in a separator, utilizing refrigerant as the working fluid. For this study, I have implemented pressure inlet and pressure outlet boundary...
25 July 2024 2,309 5 View
The aim of the research here is to prevent the propagation of the crack in the fabricated elastic medium with useful applications.
25 July 2024 9,976 3 View
Hi everyone, I am working on a curved domain in which a ship is situated in the middle (geometry is given below). In my understanding the general fluid flow is parallel to the x axis from inlet to...
25 July 2024 9,058 4 View
I am an undergraduate mechanical engineering student seeking suggestions on topics related to either thermodynamics, fluid mechanics, heat transfer or renewable energy for my final year project....
24 July 2024 4,058 5 View
I am looking to purchase a photography kit for onsite metallurgical investigations, such as capturing photos of worn areas, hot tears, cold tears etc. Could anyone suggest me a good...
22 July 2024 3,490 2 View
Dear Researchers, My question is associated with the "MDCI" method in Orca. Please let me clarify my question using a simple example: Suppose we are going to perform CBS extrapolation using "!...
21 July 2024 1,632 0 View
im studing gaussian 16 with reading paper about I-131 Metaiodobenzylguanidine in the paper "In a similar vein, nuclear magnetic resonance shielding values were investigated using the widely...
16 July 2024 6,040 4 View