proc optmodel;
121 set DIMS=1..2;
122 set CUSTOMERS;
123 set FACILITIES;
124 num a {CUSTOMERS,DIMS};
125 num demand {CUSTOMERS};
126
127 num f {FACILITIES,DIMS};
128 num SiteCapacity {FACILITIES};
129 str FacilitySiteName {FACILITIES};
130
131
132 num p=2;
132! /*Set how many Facilities you want to be OPENED*/
133
134 read data ISURGCUS.COGcustomers into CUSTOMERS=
135 [_N_] {d in DIMS} <a[_N_,d]=col('a'||d)> demand;
NOTE: There were 1480 observations read from the data set ISURGCUS.COGCUSTOMERS.
136
137
138 read data ISURGCUS.cogExistingFacilities into FACILITIES=
139 [_N_] {d in DIMS} <f[_N_,d]=col('f'||d)>FacilitySiteName;
NOTE: There were 412 observations read from the data set ISURGCUS.COGEXISTINGFACILITIES.
140
141 str SiteState{CUSTOMERS};
142 read data ISURGCUS.COGcustomers into CUSTOMERS=
143 [_N_] {d in DIMS} <a[_N_,d]=col('a'||d)> SiteState ;
NOTE: There were 1480 observations read from the data set ISURGCUS.COGCUSTOMERS.
144
145 /*str SiteRegion{CUSTOMERS};
146 read data STDOPT.COGMODELINGDATA intP CUSTOMERS=
147 [_N_] {d in DIMS} <a[_N_,d]=col('a'||d)> SiteRegion ;
148
149 str SiteComment1{CUSTOMERS};
150 read data STDOPT.COGMODELINGDATA into CUSTOMERS=
151 [_N_] {d in DIMS} <a[_N_,d]=col('a'||d)> SiteComment1;*/
152
153
154 /* distance from customer i to facility j */
155 num dist {i in CUSTOMERS, j in FACILITIES}
156 = GEODIST(a[i,1],a[i,2],f[j,1],f[j,2],'M');
157
158 num threshold_radius=
159 min {j1 in FACILITIES, j2 in FACILITIES: j1 < j2} max {i in CUSTOMERS} min(dist[i,j1], dist[i,j2]);
160
161 set CUSTOMERS_FACILITIES = {i in CUSTOMERS, j in FACILITIES: dist[i,j] <= 911.79165962};
162 var Assign {CUSTOMERS_FACILITIES} binary;
163 var Build {FACILITIES} binary;
164
165
166 /* each customer assigned to exactly one site */
167 con assign_def {i in CUSTOMERS}:
168 sum {<(i),j> in CUSTOMERS_FACILITIES} Assign[i,j] = 1;
169
170 /* if customer i assigned to site j, then facility must be built at j */
171 con link {<i,j> in CUSTOMERS_FACILITIES}:
172 Assign[i,j] <= Build[j];
173
174 /* each site can handle at most &SiteCapacity demand */
175 /*con capacity {j in FACILITIES}:
176 sum {<i,(j)> in CUSTOMERS_FACILITIES} demand[i] * Assign[i,j] <=
177 SiteCapacity[j] * Build[j];*/
178
179 con Have_This_Many_FAC_OPEN: Sum{j in FACILITIES} Build[j] <=p;
180 min Cost = sum {<i,j> in CUSTOMERS_FACILITIES} dist[i,j] * Assign[i,j]*demand[i];
181
182 solve with milp / primalin;
NOTE: Problem generation will use 4 threads.
NOTE: The problem has 300092 variables (0 free, 0 fixed).
NOTE: The problem has 300092 binary and 0 integer variables.
NOTE: The problem has 301161 linear constraints (299681 LE, 1480 EQ, 0 GE, 0 range).
NOTE: The problem has 899452 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The row activity (0) of constraint assign_def[1] violates its lower bound (1).
NOTE: The input solution is infeasible or incomplete. Repair heuristics are applied.
NOTE: The initial MILP heuristics are applied.
NOTE: The MILP presolver value AUTOMATIC is applied.
NOTE: The MILP presolver removed 4 variables and 0 constraints.
NOTE: The MILP presolver removed 4 constraint coefficients.
NOTE: The MILP presolver modified 0 constraint coefficients.
NOTE: The presolved problem has 300088 variables, 301161 constraints, and 899448 constraint coefficients.
NOTE: The MILP solver is called.
NOTE: The parallel Branch and Cut algorithm is used.
NOTE: The Branch and Cut algorithm is using up to 4 threads.
ERROR: Out of memory.
NOTE: No integer solutions found.
183
... View more