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
A crude extract of fungal culture using EtOH was subjected to column and TLC and partially purified compound was obtained. UV vis spectrum of the compound/s has max absorbance at 218nm. The...
11 August 2024 9,801 2 View
I am not able to get good literature and the physics behind how first these grains and grain boundaries arises out of no where when we make a pellet to study its dielectric properties and then how...
07 August 2024 5,177 3 View
Hey All! I am wondering what might be wrong with my band structure. I did the calculations using VASP and plotted the results using Origin. Although I have tried changing various input...
25 July 2024 2,920 11 View
Gene sequencing related trouble shooting
25 July 2024 4,149 2 View
I am looking for a lipid waste disposal method, keeping in mind the environmental, health and safety aspect of lipid waste. Could someone please provide guidelines or the lowest acceptable...
25 July 2024 637 5 View
I am writing a paper as a part of my course. I am new in London and was wondering that what publications should look upto?
21 July 2024 3,538 1 View
After World War, we have seen the formation of the United Nations. The sovereign body for peacekeeping but with regards to the Russia-Ukraine war it is visible that the UN seems to be ineffective...
18 July 2024 4,674 4 View
It has been a quite long time since the Russia and Ukraine war has been going on and if we see the context of Geopolitics and International Relations we don't see a mediation between the two...
18 July 2024 6,737 4 View
One of the papers I read by Toby, where (title of the paper was "R factors in Rietveld analysis: How good is good enough?"), he tells us that to get good chi square value, you must have low Rwp,...
17 July 2024 9,668 4 View
Please help me in plotting the photon-magnon coupling plot as shown below
14 July 2024 1,632 1 View
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