Already Defined #Error

2,184 views
Skip to first unread message

khan

unread,
Nov 3, 2014, 10:49:06 AM11/3/14
to am...@googlegroups.com
Hello every one. I am getting the following error for in AMPL model. I apply mny techniques suggested on many forums but still no results.


Error:
*************************************************************
Load Avg: ( 1.5 , 0.87 , 0.56 )
File exists
You are using the solver gurobi_ampl.
Executing AMPL.
processing data.

amplin, line 102 (offset 2899):
	lfcm is already defined
context:  param  >>> lfcm  <<< := 10200 

amplin, line 139 (offset 3185):
	ldmo is already defined
context:  param  >>> ldmo  <<< :1 2 3 ...65 := 
Error at _cmdno 7 executing "solve" command
(file amplin, line 177, offset 13695):
error processing objective Cost:
	no value for lfcm[1]
processing commands.
Executing on neos-3.neos-server.org
 Error (2) in /opt/ampl/ampl -R amplin

Parameter Declarations:

param nv :=32;         
set M:=1..nv;     
param lfcm{M};	

#Creating 2D Matrix for ldmo
param rovs:=32;
param colms:=65;
param ldmo{1..rovs,1..colms}; 


Objective Function: minimize Cost: eta_f*sum{i in 1..nw} sum{j in 1..nv} lfcm[j]*f_cm + eta_d*sum{k in 1..nv} sum{l in 1..nu} ldmo[k,l]*dmo + sum{m in 1..nw} x_c*eta_olt + nw*(eta_ch+eta_e) + sum{n in 1..nv} s_m*eta_k + sum{o in 1..nv} sm*eta_s + sum{p in 1..nv} (s_m-sm)*eta_a + nu*eta_o + nw*eta_lc + sum{q in 1..nv} sm*eta_l + (nu + sum{rt in 1..nv} s_m)*eta_i;

data;

param lfcm := 10200 
9200
8700 
6600 
7400 
7250
7000 
7400 
6200 
6050 
6350 
8950 
6600 
6400 
4700 
5150 
3050 
3100 
3600 
1500 
850 
3900
2550 
1800 
400 
1250 
2550 
800 
2550 
4000 
1450
4150;

param ldmo :1 2 3 ...65 := 
650	900	600	1400	3000	3250	4600	3750	3600	5050	6850	6650	6500	7100	8850	8550	7750	4650	4500	4100	3450	3900	6200	8000	8550	7350	8500	9000	9650	10500	7600	9700	10200	8950	11600	9700	11800	11600	13000	5050	4550	5250	6500	7000	7200	6500	6500	6950	7100	7200	7650	5550	6350	7700	7650	8200	10500	10500	12400	11900	12250	13700	14700	14850	14700
2650	1100	1400	600	1000	1250	2600	2550	2600	3950	4850	4850	5000	5100	6850	6550	6750	3650	3500	3100	2450	2900	5200	7000	7550	6350	7500	8000	8650	9500	6600	8700	9200	7950	10600	8700	10800	10600	12000	4050	3550	4250	5500	6000	6200	5500	5500	5950	6100	6200	6650	4550	5350	6700	6650	7200	9500	9500	11400	10900	11250	12700	13700	13850	13700
2650	1500	1400	900	1000	1250	2600	2050	2100	3450	4850	4650	4500	5100	6850	6550	6250	3150	3000	2600	1950	2400	4700	6500	7050	5850	7000	7500	8150	9000	6100	8200	8700	7450	10100	8200	10300	10100	11500	4050	3450	3950	5000	5500	5700	5000	5000	5450	5600	5700	6150	4050	5250	6600	6150	6700	9000	9000	10900	10400	10750	12200	13200	13350	13200
5050	3600	3800	3000	1800	1850	1000	650	1000	1350	2450	2250	2400	2700	4450	4150	4150	3950	3700	2800	2850	2800	2600	4400	4950	3750	4900	5400	6050	6900	4000	6100	6600	5350	8000	6100	8200	8000	9400	6450	5850	6350	7000	6600	6500	5800	5000	5450	5200	4400	4050	3950	7650	9000	6950	7700	6900	6900	8800	8300	8650	10100	11100	11250	11100
7650	6100	6400	5600	4000	3750	2400	3250	3600	1950	2150	2850	3000	3100	3350	4250	4750	6550	6300	5400	5450	5400	5000	5000	5550	4350	5500	6000	6650	7500	5400	6700	7200	5950	8600	6700	8800	8600	10000	9050	8450	8950	9600	9200	9100	8400	7600	8050	7800	7000	6650	6550	10250	11600	9550	10300	8700	9300	9400	8900	9250	10700	11700	11850	11700
7500	6650	6250	6050	4850	4900	4050	3100	3450	1800	1500	800	650	550	2000	1700	1100	6400	6150	5250	5300	5250	4850	4750	4200	1400	2150	2350	3400	3850	5250	6050	5550	4900	4950	4150	5150	4950	6350	8900	8300	8800	9450	9050	8950	8250	7450	7900	7650	6850	6500	6400	10100	11450	9400	10150	8550	9150	8650	8050	7600	7350	8050	8200	8050
7550	7400	7000	6800	5600	5650	4800	3850	3800	2450	2250	1550	1400	1300	2250	1950	350	6150	5900	5000	5050	5000	4600	4500	3950	1150	1900	1700	3150	3100	5000	5800	5300	4650	4500	3900	4400	4200	5600	8650	8050	8550	9200	8800	8700	8000	7200	7650	7400	6600	6250	6150	9850	11200	9150	9900	8300	8900	8400	7800	7350	7100	7400	7650	7300
8650	8500	8100	7900	6700	6750	5900	4950	4900	3550	3350	2650	2500	2400	2150	1550	750	6550	6300	5400	5450	5400	5000	4900	4350	1550	2300	2100	3550	2800	5400	6200	5700	5050	4900	4300	4600	3100	4500	9050	8450	8950	9600	9200	9100	8400	7600	8050	7800	7000	6650	6550	10250	11600	9550	10300	8700	9300	8800	8200	7750	7500	7800	8050	6500
4150	4000	3600	3400	2200	2250	2100	1250	900	2550	4350	4150	4000	4600	6350	6050	4250	2050	1800	900	950	900	2200	4000	4550	3350	4500	5000	5650	6500	3600	5700	6200	4950	7600	5700	7800	7600	9000	4550	3950	4450	5100	4700	4600	3900	3100	3550	3300	3200	3650	2050	5750	7100	5050	5800	6500	6500	8400	7900	8250	9700	10700	10850	10700
4300	4150	3750	3550	2350	2400	3250	2400	2050	3700	5500	5300	5150	5750	7500	7200	5400	900	650	250	700	250	2050	3850	4400	4100	4350	4850	5500	6350	3450	5550	6050	4800	7450	5550	7650	7450	8850	3400	2800	3300	3950	3550	3450	2750	2350	2800	2950	3050	3500	1400	4600	5950	3900	4650	6350	6350	8250	7750	8100	9550	10550	10700	10550
4000	3850	3450	3250	2350	2600	3950	3100	2750	4400	6200	6000	5850	6450	8200	7900	6100	800	650	950	900	950	2350	4150	4700	4800	4650	5150	5800	6650	3750	5850	6350	5100	7750	5850	7950	7750	9150	2700	2100	2600	3250	3150	3350	2650	2650	3100	3250	3350	3800	1700	3900	5250	3800	4350	6650	6650	8550	8050	8400	9850	10850	11000	10850
1400	2150	1850	2650	4250	4500	5850	5000	4650	6300	8100	7900	7750	8350	10100	9800	8000	3400	3250	2850	2800	2850	4950	6750	7300	6700	7250	7750	8400	9250	6350	8450	8950	7700	10350	8450	10550	10350	11750	3800	3300	4000	5250	5750	5950	5250	5250	5700	5850	5950	6400	4300	5100	6450	6400	6950	9250	9250	11150	10650	11000	12450	13450	13600	13450
3750	3600	3200	3000	3600	3850	5200	4350	4000	5650	7450	7250	7100	7700	9450	9150	7350	1050	1300	2200	2150	2200	2600	4400	4950	6050	5300	5500	6050	6900	4000	6100	6600	5350	8000	6100	8200	8000	9400	1450	950	1650	2900	3400	3600	2900	2900	3350	3500	3600	4050	1950	2750	4100	4050	4600	6900	6900	8800	8300	8650	10100	11100	11250	11100
3950	3800	3400	3200	3600	3850	5200	4350	4000	5650	7450	7250	7100	7700	9450	9150	7350	1050	1300	2200	2150	2200	2600	4200	4750	6050	5300	5500	5850	6700	3800	5900	6400	5150	7800	5900	8000	7800	9200	1450	850	1450	2700	3200	3400	2700	2700	3150	3300	3400	3850	1750	2650	4000	3850	4400	6700	6700	8600	8100	8450	9900	10900	11050	10900
5650	5500	5100	4900	3700	3750	4100	3250	2900	4550	6350	6150	6000	6600	8350	8050	6250	850	1000	1400	2050	1600	1500	2500	3050	4950	4200	4400	4150	5000	2100	4200	4700	3450	6100	4200	6300	6100	7500	2550	1950	2450	3100	2700	2600	1900	1100	1550	1600	1700	2150	50	3750	5100	3050	3800	5000	5000	6900	6400	6750	8200	9200	9350	9200
8900	8750	8350	8150	6950	7000	6150	5200	5150	3800	3600	2900	2750	2650	4100	3800	2000	4300	4250	4650	5300	4850	2750	2650	2100	1400	250	250	1300	1750	3150	3950	3450	2800	2850	2050	3050	2850	4250	6800	6200	6700	7350	6950	6850	6150	5350	5800	5550	4750	4400	4300	8000	9350	7300	8050	6450	7050	6550	5950	5500	5250	5950	6100	5950
9000	8850	8450	8250	7050	7100	6250	5300	5250	3900	4200	4000	3850	4450	6200	5900	4100	4200	4350	4750	5400	4950	2650	850	300	2800	2050	2250	800	1650	1250	1850	1350	700	2750	850	2950	2750	4150	4700	4300	4600	5250	4850	4750	4050	3250	3700	3450	2650	2300	3300	5900	7250	5200	5950	4350	4950	4450	3850	3400	4850	5850	6000	5850
9650	9500	9100	8900	7700	7750	6900	5950	5900	4550	4350	3950	3800	4400	6150	5850	4050	4850	5000	5400	6050	5600	3300	1500	950	2750	2000	2200	750	1500	1900	1900	1400	750	2100	200	2300	2100	3500	4750	4950	4650	5300	4900	4800	4100	3300	3750	3500	2700	2350	3950	5950	7300	5250	6000	4400	5000	4500	3900	3450	4200	5200	5350	5200
6750	6600	6200	6000	4800	4850	5000	4150	3800	5450	7250	7050	6900	7500	9250	8950	7150	1950	2100	2500	3150	2700	2400	2500	3050	5850	5100	5300	3850	4600	2000	3100	3600	2350	5000	3100	5200	5000	6400	1650	2050	1550	2200	1800	1700	1000	200	650	500	600	1050	1050	2850	4200	2150	2900	3900	3900	5800	5300	5650	7100	8100	8250	8100
9050	8900	8500	8300	7100	7150	6300	5350	5300	3950	5750	5550	5400	6000	7750	7450	5650	4250	4400	4800	5450	5000	2700	1000	1550	4350	3600	3800	2350	3100	1300	800	1300	850	2700	1600	2900	2800	4100	3850	4350	3650	3700	3300	3200	2500	2400	2150	1900	1700	1250	3350	4350	5700	3650	4400	2800	3400	3500	3000	3350	4800	5800	5950	5800
9500	9350	8950	8750	7550	7600	6750	5800	5750	4900	6700	6500	6350	6950	8700	8400	6600	4700	4850	5250	5900	5450	3150	1950	2500	5300	4550	4750	3300	4050	1750	650	1150	1800	2250	2550	2450	3750	3650	4300	4800	4100	2850	2350	2250	2850	2850	2400	2250	2150	1700	3800	3400	4750	2700	3450	1850	2450	3050	2550	2900	4350	5350	5500	5350
6450	6300	5900	5700	6000	6250	7600	6750	6400	8050	9850	9650	9500	10100	11850	11550	9750	3450	3700	4600	4550	4600	5000	5100	5650	8450	7700	7900	6450	7200	4600	3800	4300	4950	5300	5700	5500	6900	6700	1250	1750	1050	400	800	900	1600	2400	1950	2200	3000	3350	3450	250	1600	1350	1900	4200	4200	6100	5600	5950	7400	8400	8550	8400
7800	7650	7250	7050	5850	5900	6750	5900	5550	7200	9000	8800	8650	9250	11000	10700	8900	3000	3150	3750	4200	3750	4150	4250	4800	7600	6850	7050	5600	6350	3750	2950	3450	4100	4250	4850	4550	6050	5350	2600	3100	2400	1150	650	450	1150	1550	1100	1350	2150	2500	2600	1300	2450	400	1150	2850	2850	4750	4250	4600	6050	7050	7200	7050
8550	8400	8000	7800	6600	6650	6200	5350	5000	6650	8450	8250	8100	8700	10450	10150	8350	3750	3900	4300	4950	4500	3600	3700	4250	7050	6300	6500	5050	5800	3200	2400	2900	3550	3700	4300	4000	5500	4700	3350	3850	3150	1900	1400	1200	1900	1900	1450	1300	1600	1950	2850	2050	3000	950	1700	2100	2100	4000	3500	3850	5300	6300	6450	6300
10150	10000	9600	9400	8200	8250	7400	6450	6400	5850	7650	7450	7300	7900	9650	9350	7550	5350	5500	5900	6550	6100	3800	2900	3450	6250	5500	5700	4250	5000	2400	1600	2100	2750	2900	3500	3200	4700	3900	4950	5450	4750	3500	3000	2800	3500	3500	3050	2900	2800	2350	4450	3650	3800	2350	2500	900	1500	2400	1900	2250	3700	4700	4850	4700
10800	10650	10250	10050	8850	8900	8050	7100	7050	5700	6000	5800	5650	6250	8000	7700	5900	6000	6150	6550	7200	6750	4450	2650	2100	4600	3850	4050	2600	3350	3050	950	450	1700	1250	1850	1550	3050	2350	5600	6100	5400	4150	3650	3450	4150	4150	3700	3550	3450	3000	5100	4300	5450	3400	4150	2550	3150	2650	2050	1600	3050	4050	4200	4050
12500	12350	11950	11750	10550	10600	9750	8800	8750	7400	7200	6500	6350	6250	6700	6400	4600	7700	7850	8250	8900	8450	6150	4350	3800	5000	3850	3350	2700	2050	4750	2650	2150	3400	750	2650	550	1750	950	7300	7800	7100	5850	5350	5150	5850	5850	5400	5250	5150	4700	6800	6000	6750	4700	5450	3850	4450	3950	3350	2900	2650	2950	3200	2350
11150	11000	10600	10400	9200	9250	8400	7450	7400	6050	6850	6650	6500	7100	8850	8550	6750	6350	6500	6900	7550	7100	4800	3000	2650	5450	4700	4900	3450	4200	3400	1300	1300	2050	2100	2700	2400	3900	3100	5950	6450	5750	4500	4000	3800	4500	4500	4050	3900	3800	3350	5450	4650	4600	3350	3300	1700	2300	1800	1200	1250	2700	3700	3850	3700
12900	12750	12350	12150	10950	11000	10150	9200	9150	7800	7600	6900	6750	6650	7600	7300	5500	8100	8250	8650	9300	8850	6550	4750	4200	5400	4250	3750	3100	2950	5150	3050	2550	3800	1150	3050	1150	2650	1850	7700	8200	7500	6250	5750	5550	6250	6250	5800	5650	5550	5100	7200	6400	5850	5100	4550	2950	3550	3050	2450	2000	1750	2050	2300	1950
14350	14200	13800	13600	12400	12450	11600	10650	10600	9250	9050	8350	8200	8100	7850	6950	6450	9550	9700	10100	10750	10300	8000	6200	5650	6850	5700	5200	4550	3700	6600	4500	4000	5250	2600	4500	2400	2600	1200	9150	9650	8950	7700	7200	7000	7700	7700	7250	7100	7000	6550	8650	7850	6600	6550	6000	3700	4300	3800	3200	2750	2500	2800	3050	1500
11100	10950	10550	10350	9150	9200	8350	7400	7350	6900	8700	8500	8350	8950	10700	10400	8600	6300	6450	6850	7500	7050	4750	3950	4500	7300	6550	6750	5300	6050	3450	2650	3150	3800	3950	4550	4250	5750	4950	5900	6400	5700	4450	3950	3750	4450	4450	4000	3850	3750	3300	5400	4600	3250	3300	2750	450	450	1450	950	1300	2750	3750	3900	3750
14500	14350	13950	13750	12550	12600	11750	10800	10750	9400	9200	8500	8350	8250	10000	9700	7900	9700	9850	10250	10900	10450	8150	6350	5800	7000	5850	6050	4700	5350	6750	4650	4150	5400	3250	4650	3550	5050	4250	9300	9800	9100	7850	7350	7150	7850	7850	7400	7250	7150	6700	8800	8000	6650	6700	6150	3850	3850	1950	2450	2100	650	350	500	1650 ;		  




Robert Fourer

unread,
Nov 3, 2014, 12:41:31 PM11/3/14
to am...@googlegroups.com
Errors like "already defined" and "no value" are usually the result of interactions with other commands. Thus it's not possible to tell what problem you are having, from only the information given. Please try replying with your entire model and data files included as attachments.

Bob Fourer
am...@googlegroups.com

=======

Muhammad umar

unread,
Nov 3, 2014, 12:48:40 PM11/3/14
to am...@googlegroups.com
Thank you very much for the response. I am attaching my complete files here for you r considerations. I will be greatful.

M. Umar Khan

--
You received this message because you are subscribed to a topic in the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ampl/csGSyARm-FU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

costOpModel.dat
costOpModel.mod

khan

unread,
Nov 3, 2014, 12:50:39 PM11/3/14
to am...@googlegroups.com, 4...@ampl.com
Thank you very much for the response. I am attaching my complete files here for you r considerations. I will be greatful.

costOpModel.dat
costOpModel.mod

khan

unread,
Nov 4, 2014, 4:45:22 AM11/4/14
to am...@googlegroups.com, 4...@ampl.com
Can somebody guide me through this error please?

Robert Fourer

unread,
Nov 4, 2014, 8:27:49 AM11/4/14
to am...@googlegroups.com
First, you need to remove the lines "reset data;" and "update data;" from your .dat file. These are not data description statements, so placing them in your data file causes AMPL to return to model mode, after which all of your other data statements are misinterpreted.

Second, you are not following the AMPL format for .dat files, so after those two lines are removed, you will get many data errors. For example you need to write

param lfcm :=
1 10200
2 9200
3 8700

and so forth. Similarly both the rows and columns of the table for ldmo need to be explicitly labeled; you can't label the columns with "1 2 3 ... 65" and you have to add labels for the rows. I suggest consulting the AMPL book (http://ampl.com/resources/the-ampl-book/) to see many examples of how to write the data file properly.

Muhammad umar

unread,
Nov 4, 2014, 9:40:36 AM11/4/14
to am...@googlegroups.com
Thank you very much for constant support. I did the same as you told please see below  If I did correctly. 

param ldmo : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65:= 
1 650 900 600 1400 3000 3250 4600 3750 3600 5050 6850 6650 6500 7100 8850 8550 7750 4650 4500 4100 3450 3900 6200 8000 8550 7350 8500 9000 9650 10500 7600 9700 10200 8950 11600 9700 11800 11600 13000 5050 4550 5250 6500 7000 7200 6500 6500 6950 7100 7200 7650 5550 6350 7700 7650 8200 10500 10500 12400 11900 12250 13700 14700 14850 14700
2 2650 1100 1400 600 1000 1250 2600 2550
3....
4....
and so on.

param lfcm := 1 10200 2 9200 3 8700 4 6600 5 7400 6 7250 7 7000 8 7400 9 6200 10 6050 11 6350 and so on..

I did not get any error. I also removed the update; and reset; commands. The result I got is below. I don't know why its giving the error at end after showing the optimal value. Can you interpret it?

Result:
*************************************************************
Load Avg: ( 0.17 , 0.1 , 0.03 )
File exists
You are using the solver gurobi_ampl.
Executing AMPL.
processing data.
presolve, variable dmo:
	impossible deduced bounds: lower = 1, upper = 0
processing commands.
Executing on neos-5.neos-server.org

Presolve eliminates 13 constraints and 5 variables.
Adjusted problem:
1 variable, all binary
1 constraint, all linear; 0 nonzeros
	1 equality constraint
1 linear objective; 1 nonzero.

Setting $presolve_fixeps >= 2.12e-09 could change presolve results.

 Error (1) in /opt/ampl/ampl -R amplin

M. Umar Khan

Muhammad umar

unread,
Nov 4, 2014, 9:53:40 AM11/4/14
to am...@googlegroups.com
especially what does this line says:
'resolve, variable dmo:
impossible deduced bounds: lower = 1, upper = 0'

Robert Fourer

unread,
Nov 4, 2014, 11:06:59 PM11/4/14
to am...@googlegroups.com
This run is not reporting an optimal solution. The message

presolve, variable dmo:
impossible deduced bounds: lower = 1, upper = 0

comes from AMPL's presolve phase, which tries to tighten the bounds on the variables. In this case, presolve found that your constraints imply both that variable dmo has a lower bound of 1, and that variable dmo has an upper bound of 0! That means that there is no feasible solution to your constraints. I suggest submitting a command file to NEOS with the commands "expand;" and then "solve;" -- this will give you a listing of all the constraints actually generated, which you can study to determine why no feasible solution is possible (or why the model is not generating the constraints you intended).

Bob Fourer
am...@googlegroups.com

=======

Muhammad umar

unread,
Nov 5, 2014, 8:25:59 AM11/5/14
to am...@googlegroups.com
I am improving from your guidance. Really!! Very useful knowledge I am getting from you. I am always thaknful to you.

variable dmo is a binay variable I have defined in my model. Can you look at the constraints which involves variable dmo to see if I have defined them correclty?

Inline images 1

sum{b in 1..nv} dmo=1;

dmo<=sm;


Inline images 2 

sum{c in 1..nu} dmo <= r*s_m;


Inline images 3

sum{i in 1..nw} sum{j in 1..nv}lfcm[j]*fcm + sum{k in 1..nv} sum{l in 1..nu} ldmo[k,l]*dmo <= lmax;

 

However, I have used the command expand as you have suggested to see what happens. And the output is:


nu is already defined


nv is already defined


nw is already defined


np is already defined


r is already defined


lmax is already defined


C is already defined


M is already defined


O is already defined


eta_d is already defined


Bailing out after 10 warnings.

ampl: data 'C:\Dropbox\cost_op_model\costOpModel.dat';


C:\Dropbox\cost_op_model\costOpModel.dat, line 7 (offset 23):

data for lfcm already read


C:\Dropbox\cost_op_model\costOpModel.dat, line 44 (offset 433):

data for ldmo already read


ampl: option solver CPLEX;

ampl: solve;

CPLEX 12.6.0.1: mipdisplay 2

Infeasibility row 'c1':  0  = 1.


Root node processing (before b&c):

  Real time             =    0.00 sec. (0.00 ticks)

Parallel b&c, 2 threads:

  Real time             =    0.00 sec. (0.00 ticks)

  Sync time (average)   =    0.00 sec.

  Wait time (average)   =    0.00 sec.

                          ------------

Total (root+branch&cut) =    0.00 sec. (0.00 ticks)

CPLEX 12.6.0.1: integer infeasible.

0 MIP simplex iterations

0 branch-and-bound nodes

No basis.


Best Regards 
M. Umar Khan

Muhammad umar

unread,
Nov 5, 2014, 8:27:31 AM11/5/14
to am...@googlegroups.com
WIth expand command you told:

ampl: expand;
minimize Cost:
1213.2*f_cm + 282614*dmo + 800*sm + 1216*s_m + 94*x_c + 1289;

subject to Feeder_Fiber_Conectivity:
f_cm - s_m = 0;

subject to Dist_Fiber_Conectivity:
32*dmo = 1;

subject to distFB:
dmo - sm <= 0;

subject to FCM:
-fcm + f_cm >= 0;

subject to Fcm:
-fcm + 0.0153846*f_cm <= 0;

subject to SplitRatio:
65*dmo - 16*s_m <= 0;

subject to PON_span:
151650*fcm + 11304600*dmo <= 0.02;

subject to S_mSm:
-sm + s_m >= 0;

subject to Smsm:
-sm + 0.0153846*s_m <= 0;

subject to No_PONs_perLCard:
-8*f_cm + x_c >= 0;

subject to NoPONsLCard:
-32*f_cm + x_c <= 1;

subject to ds_m:
s_m >= 0;

subject to f__cm:
f_cm >= 0;

subject to x__c:
x_c >= 0;

Best Regards 
M. Umar Khan

rim...@gmail.com

unread,
Sep 29, 2015, 9:02:32 AM9/29/15
to AMPL Modeling Language, 4...@ampl.com
Hi,

Can you please have a look at this part of my model and advise why I keep getting "impossible deduced bounds" Error?!

var Xi {v in 1..V} binary;

minimize P1A: sum {s in 1..S, v in 1..V} C1 * A[s,v] * Xi[v];

subject to Eq1:
sum {v in 1..V} Xi[v] = 1;

subject to Eq2 {v in 1..V}:
sum {s in 1..S} A[s,v] * H * Xi[v] <= sum {t in 1..T} Hb * R * (1 - Psi[t]);

subject to Eq3 {v in 2..V}:
sum {s in 1..S} A[s,v-1] * H * Xi[v-1] >= sum {t in 1..T} Hb * R * (1 - Psi[t]);

ampl: reset;
ampl: model P1A.mod;
ampl: data P1A.dat;
ampl: option solver cplex;
ampl: solve;
presolve, variable Xi[19]:
impossible deduced bounds: lower = 2, upper = 1;
difference = 1
presolve, variable Xi[18]:
impossible deduced bounds: lower = 2, upper = 1;
difference = 1
presolve, variable Xi[17]:
impossible deduced bounds: lower = 2, upper = 1;
difference = 1
presolve, variable Xi[16]:
impossible deduced bounds: lower = 2, upper = 1;
difference = 1
presolve, variable Xi[15]:
impossible deduced bounds: lower = 2, upper = 1;
difference = 1
15 presolve messages suppressed.

Many thanks for your time in advance!

Robert Fourer

unread,
Sep 29, 2015, 9:41:28 AM9/29/15
to am...@googlegroups.com
Since Xi is a binary variable, it has an upper bound of 1. The "impossible deduced bounds" message is telling you that your constraints are implying a lower bound of 2! You will need to figure out why this is. Since the Eq3 constraints are the ones that are forcing the Xi variables to be >= something, as a start you could look at the output of

expand Eq3;

which shows explicitly all of the Eq3 constraints that are being generated.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of rim...@gmail.com
Sent: Monday, September 28, 2015 7:06 PM
To: AMPL Modeling Language
Cc: 4...@ampl.com

rim...@gmail.com

unread,
Sep 29, 2015, 7:48:34 PM9/29/15
to AMPL Modeling Language, 4...@ampl.com
Thanks Bob!
But even after I fixed that bounds issue through the following reselotion, I still getting Infeasible solution.
If you notice, the solver should retrive a Xi[v] at v=15 which satisfy both Eq2 and Eq3 and indeed it Must have atleast One v=1 to satisfy Eq1. However, it returns an infeasible solution.
Can you please give me some advice.
I really appreciate it.

var Xi {v in 1..V} binary;

minimize P1A: sum {s in 1..S, v in 1..V} C1 * A[s,v] * Xi[v];

subject to Eq1:
sum {v in 1..V} Xi[v] = 1;

subject to Eq2 :
sum {s in 1..S} sum {v in 1..V} A[s,v] * H * Xi[v] <= sum {t in 1..T} Hb * R * (1 - Psi[t]);

subject to Eq3 :
sum {s in 1..S} sum {v in 2..V} A[s,v-1] * H * Xi[v-1] >= sum {t in 1..T} Hb * R * (1 - Psi[t]);

CPLEX 12.6.1.0: integer infeasible.
0 MIP simplex iterations
0 branch-and-bound nodes
No basis.
ampl: expand Eq2;
subject to Eq2:
8496*Xi[1] + 8128*Xi[2] + 7752*Xi[3] + 7376*Xi[4] + 7000*Xi[5] + 
6624*Xi[6] + 6240*Xi[7] + 5856*Xi[8] + 5472*Xi[9] + 5096*Xi[10] + 
4728*Xi[11] + 4352*Xi[12] + 3992*Xi[13] + 3616*Xi[14] + 3240*Xi[15] + 
2880*Xi[16] + 2552*Xi[17] + 2232*Xi[18] + 1920*Xi[19] + 1744*Xi[20] <= 
3600;

ampl: display Xi;
Xi [*] :=
 1  0
 2  0
 3  0
 4  0
 5  0
 6  0
 7  0
 8  0
 9  0
10  0
11  0
12  0
13  0
14  0
15  0
16  0
17  0
18  0
19  0
20  0
;

ampl: expand Eq3;
subject to Eq3:
8496*Xi[1] + 8128*Xi[2] + 7752*Xi[3] + 7376*Xi[4] + 7000*Xi[5] + 
6624*Xi[6] + 6240*Xi[7] + 5856*Xi[8] + 5472*Xi[9] + 5096*Xi[10] + 
4728*Xi[11] + 4352*Xi[12] + 3992*Xi[13] + 3616*Xi[14] + 3240*Xi[15] + 
2880*Xi[16] + 2552*Xi[17] + 2232*Xi[18] + 1920*Xi[19] >= 3600;

ampl: expand P1A;
minimize P1A:
65844*Xi[1] + 62992*Xi[2] + 60078*Xi[3] + 57164*Xi[4] + 54250*Xi[5] + 
51336*Xi[6] + 48360*Xi[7] + 45384*Xi[8] + 42408*Xi[9] + 39494*Xi[10] + 
36642*Xi[11] + 33728*Xi[12] + 30938*Xi[13] + 28024*Xi[14] + 
25110*Xi[15] + 22320*Xi[16] + 19778*Xi[17] + 17298*Xi[18] + 
14880*Xi[19] + 13516*Xi[20];

ampl: expand Eq2;
subject to Eq2:
8496*Xi[1] + 8128*Xi[2] + 7752*Xi[3] + 7376*Xi[4] + 7000*Xi[5] + 
6624*Xi[6] + 6240*Xi[7] + 5856*Xi[8] + 5472*Xi[9] + 5096*Xi[10] + 
4728*Xi[11] + 4352*Xi[12] + 3992*Xi[13] + 3616*Xi[14] + 3240*Xi[15] + 
2880*Xi[16] + 2552*Xi[17] + 2232*Xi[18] + 1920*Xi[19] + 1744*Xi[20] <= 
3600;
Why it does not return any value for Xi[v] at all?!!!

Robert Fourer

unread,
Sep 30, 2015, 3:12:28 PM9/30/15
to am...@googlegroups.com
If you look more closely at

subject to Eq2:
8496*Xi[1] + 8128*Xi[2] + 7752*Xi[3] + 7376*Xi[4] + 7000*Xi[5] +
6624*Xi[6] + 6240*Xi[7] + 5856*Xi[8] + 5472*Xi[9] + 5096*Xi[10] +
4728*Xi[11] + 4352*Xi[12] + 3992*Xi[13] + 3616*Xi[14] + 3240*Xi[15] +
2880*Xi[16] + 2552*Xi[17] + 2232*Xi[18] + 1920*Xi[19] + 1744*Xi[20] <=
3600;

subject to Eq3:
8496*Xi[1] + 8128*Xi[2] + 7752*Xi[3] + 7376*Xi[4] + 7000*Xi[5] +
6624*Xi[6] + 6240*Xi[7] + 5856*Xi[8] + 5472*Xi[9] + 5096*Xi[10] +
4728*Xi[11] + 4352*Xi[12] + 3992*Xi[13] + 3616*Xi[14] + 3240*Xi[15] +
2880*Xi[16] + 2552*Xi[17] + 2232*Xi[18] + 1920*Xi[19] >= 3600;

you will see that there is no zero-one assignment to the Xi variables that satisfies both of these constraints -- even if you allow more than one of the variables to be equal to 1. Since there is no feasible solution, CPLEX does not return a solution and all the variables remain at their default values of 0.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of rim...@gmail.com
Sent: Tuesday, September 29, 2015 5:23 PM
To: AMPL Modeling Language
Cc: 4...@ampl.com
Subject: Re: [AMPL 10631] Already Defined #Error

Thanks Bob!
But even after I fixed that bounds issue through the following reselotion, I still getting Infeasible solution. If you notice, the solver should retrive a Xi[v] at v=15 which satisfy both Eq2 and Eq3 and indeed it Must have atleast One v=1 to satisfy Eq1. However, it returns an infeasible solution.

var Xi {v in 1..V} binary;

minimize P1A: sum {s in 1..S, v in 1..V} C1 * A[s,v] * Xi[v];

subject to Eq1:
sum {v in 1..V} Xi[v] = 1;

subject to Eq2 :
sum {s in 1..S} sum {v in 1..V} A[s,v] * H * Xi[v] <= sum {t in 1..T} Hb * R * (1 - Psi[t]);

subject to Eq3 :
sum {s in 1..S} sum {v in 2..V} A[s,v-1] * H * Xi[v-1] >= sum {t in 1..T} Hb * R * (1 - Psi[t]);

CPLEX 12.6.1.0: integer infeasible.
0 MIP simplex iterations
0 branch-and-bound nodes
No basis.

Yildiz Kartal

unread,
Nov 3, 2016, 7:37:20 AM11/3/16
to AMPL Modeling Language
Hi I get Avail_nt[1,23] already defined error for all combinations of this parameter. It is a binary matrix and stated related to a constraint in the model. My files are attached. It is nurse assignement problem to hourly time slots.
I would be more than happy if anybody helps asap.

Thanks in advance.

Yildiz

3 Kasım 2014 Pazartesi 16:49:06 UTC+1 tarihinde khan yazdı:
Part 2 (i).mod.mod
Part 2 (i) revision.dat.dat
Part 2 (i).run.run

Robert Fourer

unread,
Nov 4, 2016, 10:08:11 PM11/4/16
to am...@googlegroups.com
If you look at your table for Avail_nt in the data file, you will see that there are two columns headed "23". Thus the table is giving AMPL two values for Avail_nt[1,23], and this results in an "already defined" error.

Bob Fourer
am...@googlegroups.com

=======

joannap...@gmail.com

unread,
May 2, 2017, 8:05:08 PM5/2/17
to AMPL Modeling Language

Hello, I have met a problem with the .mod file. it tells me that the origin_cities is already defined.. I don't know how to fix it everytime I run it in AMPl
neon.mod
neon.dat

Robert Fourer

unread,
May 3, 2017, 8:43:05 PM5/3/17
to am...@googlegroups.com
The first error I see is

amplin, line 102 (offset 2899):
lfcm is already defined
context: param >>> lfcm <<< := 10200

but I do not see "lfcm" in the model or data file that you attached. I do see model and data definitions of lfcm copied into your message, but since they are not part of a complete example, it is hard to know what might be wrong with them. It is best to attach the complete model and data files that you sent to NEOS.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of joannap...@gmail.com
Sent: Tuesday, May 2, 2017 10:34 AM
To: AMPL Modeling Language
Subject: [AMPL 13980] Re: Already Defined #Error

Hello, I have met a problem with the .mod file. it tells me that the origin_cities is already defined.. I don't know how to fix it everytime I run it in AMPl
On Monday, 3 November 2014 17:49:06 UTC+2, khan wrote:
Hello every one. I am getting the following error for in AMPL model. I apply mny techniques suggested on many forums but still no results.

Error:
*************************************************************
Load Avg: ( 1.5 , 0.87 , 0.56 )
File exists
You are using the solver gurobi_ampl.
Executing AMPL.
processing data.

amplin, line 102 (offset 2899):
lfcm is already defined
context: param >>> lfcm <<< := 10200

...

Parameter Declarations:

param nv :=32;
set M:=1..nv;
param lfcm{M};

#Creating 2D Matrix for ldmo
param rovs:=32;
param colms:=65;
param ldmo{1..rovs,1..colms};

Objective Function: minimize Cost: eta_f*sum{i in 1..nw} sum{j in 1..nv} lfcm[j]*f_cm + eta_d*sum{k in 1..nv} sum{l in 1..nu} ldmo[k,l]*dmo + sum{m in 1..nw} x_c*eta_olt + nw*(eta_ch+eta_e) + sum{n in 1..nv} s_m*eta_k + sum{o in 1..nv} sm*eta_s + sum{p in 1..nv} (s_m-sm)*eta_a + nu*eta_o + nw*eta_lc + sum{q in 1..nv} sm*eta_l + (nu + sum{rt in 1..nv} s_m)*eta_i;

data;

param lfcm := 10200
9200
8700
6600
7400
7250
...


Joanna Prifti

unread,
May 4, 2017, 10:46:46 AM5/4/17
to am...@googlegroups.com
Thank you very much for the time!! I appreciate it a lot!! 
--
You received this message because you are subscribed to a topic in the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ampl/csGSyARm-FU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Best Regards!
Reply all
Reply to author
Forward
0 new messages