Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please guide me to draw the objective, variables, constraints in dual form. Than

ID: 3911044 • Letter: P

Question

Please guide me to draw the objective, variables, constraints in dual form. Thank you very much in advance :)

1 Martian Colonist Transport A new colony ship just landed on Mars, and we need to figure out where to put everyone. Our initial strategy was to randomly assign colonists to neighborhoods, but after a disastrous first week where half the neighborhoods ran out of food, we realized we need to rethink things. To ensure sufficient food and water availability, we have determined the optimal number of colonists each neighborhood should have. Unfortunately, we also have a limited amount of fuel, so we need to limit how far we move colonists when transferring them between neighborhoods. The following table gives the r and y coordinates of each neighborhood. It costs M1.75/km to transport a colonist. Distances should be calculated "as the crow flies," so you can use the (r,y) coordinates to find the Euclidean distance between each pair of neighborhoods. The table also includes the current number of colonists in each neighborhood and the number of colonists that should be in each neighborhood. Neighborhood y| Current Required Coord. Coord. colonists colonists 15 10 Tesla 10 12 17 24 18 Asimov 28 15 20 12 0 20 14 34 31 Hubble 6 Hawking Copernicus 20 21 25 27 Write a linear program that will determine the movement of the colonists to establish the required number of colonists in all neighborhood in a minimum cost manner. Which pair of locations has the largest transfer of colonists? What is the total cost of re-homing the colonists?] Upload your code as

Explanation / Answer

#include<stdio.h>
#include<math.h>
int main(){
int Nx[]={0,6,35,24,18,9,11,0,5,1,25};//x co-ordinate
int Ny[]={0,10,12,28,3,2,0,20,14,34,31};//y co-ordinate
int C[]={14,0,17,3,8,15,20,12,2,20,21};//current colonists
int R[]={5,15,5,10,28,8,22,4,6,2,28};//required colonists
//G array to store the minimum cost between indexes
// 0 index is New Terra
//1 index is Tesla and so on.
//G[0][1] determine the minimum cost between Terra and Tesla.
//Totalcost store the total transfer cost,
float G[11][11],min,Totalcost;
//index stores the index with which required colonist are taken
//dif notes those who have the largest difference whose index will m1 and m2
//m1 will be the required index
//m2 will be current colonists index
int i,j,k,index=0,dif=10,m1=0,m2=0;
//calculating the distance between two indexes
for(i=0;i<11;i++){
for(j=i;j<11;j++){
G[i][j]=0;
G[i][j]=sqrt((Nx[j]-Nx[i])*(Nx[j]-Nx[i])+(Ny[j]-Ny[i])*(Ny[j]-Ny[i]));
G[j][i]=G[i][j];//distance between 0 nd 1 index and 1 and 0 index will be same so we initialize it with same.
}
}
//using minimum path finding warshalt algorithm
//now G[i][j] will store the minimum cost between i and j
for(i=0;i<11;i++){
for(j=0;j<11;j++){
for(k=0;k<11;k++){
if(G[i][k]+G[k][j]<G[i][j])
G[i][j]=G[i][k]+G[k][j];
}
}
}
//minimum cost from any index to other indexes
//i will determine the starting house and j will determine the place where we need to transfer.
//value of G array will determine the minimum cost between two index.
for(i=0;i<11;i++){
for(j=0;j<11;j++){
G[i][j]=G[i][j]*1.75;
printf("%f ",G[i][j]);

}
printf(" ");
}
printf(" ");
//fill the required colonist with minimum cost
for(i=0;i<11;i++){
for(j=0;j<11;j++){
min=G[i][j];
if(i!=j){//no need to check with same index
if(C[j]>=R[i]){//checking if the current colonist of j-th are enough to fill the required colonist of i-th index

if(min>G[i][j]){//checking if the cost is minimum
C[i]=C[i]-R[j];//after filling the required colonist we need to remove the same from current colonist

if(dif<R[j]){
dif=R[j];
m1=i;
m2=j;//storing the index with largest difference
}
R[j]=0;

min=G[i][j];
index=j; //storing the index with which minimum cost will be taken to transfer colonist
}
}
}
}
printf("%d %d %f ",i,index,min);
Totalcost=Totalcost+G[i][index];//calculating total cost between every minimum transfer
}
printf(" largest transfer of colonist is %d and %d ",m1,m2);
printf("Total cost of re-homing %f ",Totalcost);
return 0;
}