Originally posted by: Treee
Hello,
i am trying to find the optimal solution of my minimizing problem.
I have a distance matrix which gives the distances to the "places"(in a storage yard) in the matrix. My goal is to put for example 4 containers to the storage yard at minimum distance costs. The positions should be shown in the matrix "placed" and set to 1.
my .dat so far ;
AmountOfContainers = 4;
Rows = 4;
Columns = 5;
Distance = [
[ 1, 7, 13, 19, 25 ],
[ 3, 9, 15, 21, 27 ],
[ 5, 11, 17, 23, 29 ],
[ 7, 13, 19, 29, 35 ]];
and my .mod:
int AmountOfContainers=...;
range Container = 1..AmountOfContainers;
int Rows = ...;
range Row = 1..Rows;
int Columns = ...;
range Column = 1..Columns;
int Distance [Row][Column] = ...;
dvar boolean placed[Row][Column];
minimize
sum(r in Row, c in Column)
Distance[r][c]*placedt[r][c]
;
subject to {
}
execute DISPLAY_RESULTS {
};
how i have to change my program to place the 4 containers at the lowest distance costs and display the summed distance costs?
the "placed" matrix should be like :
Placed= [
[ 1, 1, 0, 0, 0 ],
[ 1, 1, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
[ 0,0, 0, 0, 0 ]];
thanks and kind regards
#DecisionOptimization#OPLusingCPLEXOptimizer