Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Optimization of Location Allocation

Subject: Optimization of Location Allocation

From: Muhammad

Date: 4 Dec, 2009 18:41:37

Message: 1 of 2

Hello everybody,

I've been trying to optimize the problem below. I couldn't figure out how to implement cost function to Matlab. Could anybody assist me doing this? Thanks

function TotalCost = costfunction(x)

% Customer locations j = 1..N, c(:,j)
c = [1 1; 2 2; 2 3; 3 3; 4 5; 5 6]';

% Total trips for customers, d(j)
d = [6 3 3 4 2 2];

f = zeros(5,6);
t = zeros(5,6);

% Constraint

for i=1:5
    for j=1:6

TotalCost = sum(f(:));

This is that I could somehow write in Matlab/.

Subject: Optimization of Location Allocation

From: Sadik

Date: 6 Dec, 2009 09:23:03

Message: 2 of 2

Hi Muhammad,

Please send me the formula of the cost function at


Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us