Hello,
As a new beginner I am not very experienced in AIMMS.So I thought one can help me from here.
I have 20 facilities to be located to 20 locations. Every facility(i) should be allocated to 1 place and each location(j or l) should be fulled. I also need some to be adjacent to each other. I have written the variable for assignment(i,j) and 2 necessary constraints as shown:
Set Facilities {
Index: i, h;
Definition: {
data
{ 'Facility 1' , 'Facility 2' , 'Facility 3' , 'Facility 4' , 'Facility 5' , 'Facility 6' , 'Facility 7' , 'Facility 8' ,
'Facility 9' , 'Facility 10', 'Facility 11', 'Facility 12', 'Facility 13', 'Facility 14', 'Facility 15', 'Facility 16',
'Facility 17', 'Facility 18', 'Facility 19', 'Facility 20' }
}
}
Set Locations {
Index: j, l;
Definition: {
data
{ 'Location 1', 'Location 2', 'Location 3', 'Location 4', 'Location 5', 'Location 6', 'Location 7', 'Location 8', 'Location 9',
Location10 , Location11 , Location12 , Location13 , Location14 , Location15 , Location16 , Location17 , Location18 ,
Location19 , Location20 }
}
Variable Assignment {
IndexDomain: (i,j);
Range: binary;
}
Constraint Loc_Constraint {
IndexDomain: i;
Definition: sum(j, Assignment(i,j))=1;
}
Constraint Fac_Constraint {
IndexDomain: j;
Definition: sum(i, Assignment(i,j))=1;
But for adjacency; I have written the constraint below for facility2 and facility3 which should be adjacent:
Constraint Distance_F2_F3 {
IndexDomain: (j,l);
Definition: {
if [Assignment('facility 2',j)=1 and Assignment('facility 3',l)=1] then
125<= [Assignment('facility 2',j)*Assignment('facility 3',l)*Distance_Locs(j,l)] and
[Assignment('facility 2',j)*Assignment('facility 3',l)*Distance_Locs(j,l)]<=200
endif;
}
Because locations have 125m horizontal distance and 200m vertical distance between each other. And I want them to be next to each other. I have also determined location distances as:
Parameter Distance_Locs {
IndexDomain: (j,l);
Definition: {
data
{ ( 'Location 1', 'Location 2' ) : 125, ( 'Location 1', 'Location 3' ) : 250, ( 'Location 1', 'Location 4' ) : 375,
( 'Location 1', 'Location 5' ) : 200, ( 'Location 1', 'Location 6' ) : 325, ( 'Location 1', 'Location 7' ) : 450,
( 'Location 1', 'Location 8' ) : 575, ( 'Location 1', 'Location 9' ) : 400, ( 'Location 1', Location10 ) : 525
.
.
.goes down like this.
But when ı run the model ı got this warning:
Constraint programming constraints cannot be used in combination with real valued variables, only with integer valued variables, element valued variables, and activities. The real valued objective variable is an exception. The mathematical program "Min_Problem_Weight" has both constraint programming constraints and real valued variables, for instance constraint "Distance_F2_F3" and variable "Fac_Weight".
"Fac_Weight" is my final variable which is optimized by mathematical model.
So can you help me? How can I gather 2 facilities which must be adjacent? Or do you have any idea for this constraint?
Thank you in advance...
Bahadır ECE