Error Executing AMPL

60 views
Skip to first unread message

Diana

unread,
Nov 7, 2009, 7:39:11 PM11/7/09
to AMPL Modeling Language, adiel...@hotmail.com
Hello, when I try to solve the modelo, I get a error message:

file -
line 46
offset 1667
cumpl_labor is not defined
file -
line 292
offset 7619
expected :=
file -
line 303
offset 8007
cap_horas is already defined
Error executing "solve" command:
error processing constraint capa_horas[5047]:
no value for tiempo_ej[5047,409]

Please, Why is this?

My code is the following:

#SETS
set TRAC;
set LAB;

#PARAMETERS

param cfijo{i in TRAC, j in LAB} >= 0;
param cost_var{i in TRAC, j in LAB} >= 0;
param cap_horas{i in TRAC} >= 0;
param cap_uso{i in TRAC} >= 1;
param cumpl_lab{j in LAB} = 1;
param tiempo_ej{i in TRAC,j in LAB} >= 0;

# VARIABLE
var w{i in TRAC, j in LAB} binary;
minimize costo_total: # ($/week)

#OBJECTIVE
sum{i in TRAC, j in LAB} (cfijo[i,j]*w[i,j])
+ sum{ i in TRAC, j in LAB} (cost_var[i,j]*w[i,j]);

# CONSTRAINTS

subject to capa_horas {i in TRAC}:
sum{j in LAB} (w[i,j]*tiempo_ej[i,j]) <= cap_horas[i];

subject to capa_uso {i in TRAC}:
sum{j in LAB} (w[i,j]) >= cap_uso[i];

subject to cumplm_lab {j in LAB}:
sum{i in TRAC} (w[i,j]) = cumpl_labor[j];

#DATA

# SETS

set TRAC:= 5047 5048 5049 5050 5051 5052 5053 5200

5203 5206 5221 5223 5224 5225 5226 5227

5228 6010 6011 7056 7058 7059 7061 7062

7078 8000 8007;



set LAB:= 409 411 412 419 420 421 440 442 444 445

446 491 531 131 842 140 208 130 120 142;


# PARAMETERS


param cfijo default 9999999: 409 411 412 419 420 :=

5047 . . . . .
5048 . . . . .
5049 . 737022 . . .
5050 . 737022 . . .
5051 . 737022 . . .
5052 . 737022 . . .
5053 . . . . .
5200 737022 . 737022 737022 737022
5203 737022 . 737022 737022 737022
5206 737022 . 737022 737022 737022
5221 737022 . 737022 737022 737022
5223 737022 . 737022 737022 737022
5224 737022 . 737022 737022 737022
5225 . 737022 . . .
5226 737022 . . . .
5227 737022 . 737022 737022 737022
5228 737022 . 737022 737022 737022
6010 . . . . .
6011 . . . . .
7056 737022 . 737022 737022 737022
7058 737022 . 737022 737022 737022
7059 737022 . 737022 737022 737022
7061 . . 737022 737022 737022
7062 737022 . 737022 737022 737022
7078 . . . . .
8000 . . . . .
8007 . . . . .

: 421 440 442 444 445 :=
5047 737022 737022 737022 . .
5048 737022 737022 737022 . .
5049 . 737022 737022 . .
5050 . 737022 737022 . .
5051 . 737022 737022 . .
5052 . 737022 737022 . .
5053 . . . . .
5200 . . . 737022 737022
5203 . . 737022 737022 737022
5206 . . 737022 737022 737022
5221 . . . 737022 737022
5223 . . 737022 737022 737022
5224 . . 737022 737022 737022
5225 . . 737022 . .
5226 . . 737022 . .
5227 . 737022 737022 737022 737022
5228 . . . 737022 737022
6010 . . . . .
6011 . . . . .
7056 737022 737022 737022 737022 737022
7058 737022 737022 737022 737022 737022
7059 737022 737022 737022 737022 737022
7061 737022 737022 737022 737022 737022
7062 737022 737022 737022 737022 737022
7078 737022 . . 737022 737022
8000 737022 . . . .
8007 737022 . . . .

: 446 491 531 131 842 :=

5047 . . . . 737022
5048 . . . . .
5049 . . . . 737022
5050 . . . . .
5051 . . . 737022 .
5052 . 737022 . . .
5053 . 737022 . 737022 .
5200 . . . . .
5203 737022 . . . .
5206 737022 . . . .
5221 . . . . .
5223 737022 . . . .
5224 737022 . . . .
5225 737022 . . . .
5226 737022 737022 . . .
5227 737022 . . . .
5228 . . . . .
6010 . . . 737022 .
6011 . . . 737022 .
7056 . . 737022 737022 737022
7058 . . 737022 737022 737022
7059 . . 737022 737022 737022
7061 . . . 737022 737022
7062 . . . 737022 737022
7078 . . . 737022 737022
8000 . . . . .
8007 . . . 737022 737022

:140 208 130 120 142 :=

5047 737022 737022 737022 . .
5048 . 737022 737022 737022 .
5049 737022 . . 737022 .
5050 . 737022 . . .
5051 . . . . .
5052 . . . . .
5053 . . . . 737022
5200 . . . . .
5203 . . . . .
5206 . . . . .
5221 . . . . .
5223 . . . . .
5224 . . . . .
5225 . . . . .
5226 . . . . .
5227 . . . . .
5228 . . . . .
6010 . . . 737022 .
6011 . . . 737022 .
7056 737022 . 737022 . 737022
7058 737022 . 737022 . 737022
7059 737022 . 737022 . 737022
7061 737022 . 737022 . 737022
7062 737022 . 737022 . 737022
7078 737022 . . 737022 .
8000 . . . 737022 737022
8007 . . 737022 737022 737022 ;



param cost_var default 9999999: 409 411 412 419 420 :=

5047 . . . . .
5048 . . . . .
5049 . 8782294 . . .
5050 . 12291821 . . .
5051 . 6679969 . . .
5052 . 7425955 . . .
5053 . . . . .
5200 15119759 . 23059627 0 6587407
5203 16288183 . 24841627 0 7096469
5206 19427234 . 29629094 0 8464096
5221 13218890 . 20160550 0 5759232
5223 13724626 . 20931865 0 5979572
5224 10585576 . 16144398 0 4611944
5225 . 12851311 . . .
5226 11928391 . . . .
5227 18747106 . 28591809 0 8167776
5228 16933433 . 25825718 0 7377591
6010 . . . . .
6011 . . . . .
7056 8928855 . 13617680 0 3890141
7058 7498842 . 11436724 0 3267111
7059 8457996 . 12899561 0 3684996
7061 . . 14043233 0 4011708
7062 9888009 . 15080517 0 4308027
7078 . . . . .
8000 . . . . .
8007 . . . . .

: 421 440 442 444 445 :=

5047 0 13447230 0 . .
5048 0 13828171 0 . .
5049 . 19732762 0 . .
5050 . 27618248 0 . .
5051 . 15009090 0 . .
5052 . 16685232 0 . .
5053 . . . . .
5200 . . . 0 0
5203 . . 0 0 0
5206 . . 0 0 0
5221 . . . 0 0
5223 . . 0 0 0
5224 . . 0 0 0
5225 . . 0 . .
5226 . . 0 . .
5227 . 40951195 0 0 0
5228 . . . 0 0
6010 . . . . .
6011 . . . . .
7056 0 19504197 0 0 0
7058 0 16380479 0 0 0
7059 0 18475656 0 0 0
7061 0 20113703 0 0 0
7062 0 21599374 0 0 0
7078 0 . . 0 0
8000 0 . . . .
8007 0 . . . .

: 446 491 531 131 842 :=

5047 . . . . 0
5048 . . . . .
5049 . . . . 0
5050 . . . . .
5051 . . . 0 .
5052 . 43407965 . . .
5053 . 79283953 . 0 .
5200 . . . . .
5203 7020981 . . . .
5206 8374060 . . . .
5221 . . . . .
5223 5915965 . . . .
5224 4562886 . . . .
5225 5697969 . . . .
5226 5141703 67787780 . . .
5227 8080893 . . . .
5228 . . . . .
6010 . . . 0 .
6011 . . . 0 .
7056 . . 0 0 0
7058 . . 0 0 0
7059 . . 0 0 0
7061 . . . 0 0
7062 . . . 0 0
7078 . . . 0 0
8000 . . . . .
8007 . . . 0 0

: 140 208 130 120 142 :=

5047 0 0 0 . .
5048 . 0 0 0 .
5049 0 . . 0 .
5050 . 0 . . .
5051 . . . . .
5052 . . . . .
5053 . . . . 0
5200 . . . . .
5203 . . . . .
5206 . . . . .
5221 . . . . .
5223 . . . . .
5224 . . . . .
5225 . . . . .
5226 . . . . .
5227 . . . . .
5228 . . . . .
6010 . . . 0 .
6011 . . . 0 .
7056 0 . 0 . 0
7058 0 . 0 . 0
7059 0 . 0 . 0
7061 0 . 0 . 0
7062 0 . 0 . 0
7078 0 . . 0 .
8000 . . . 0 0
8007 . . 0 0 0 ;




param tiempo_ej: 409 411 412 419 420 :=

5047 0 0 0 0 0
5048 0 0 0 0 0
5049 0 129.01 0 0 0
5050 0 129.01 0 0 0
5051 0 129.01 0 0 0
5052 0 129.01 0 0 0
5053 0 0 0 0 0
5200 278.67 0 101.1925 0 75.1595
5203 278.67 0 101.1925 0 75.1595
5206 278.67 0 101.1925 0 75.1595
5221 278.67 0 101.1925 0 75.1595
5223 278.67 0 101.1925 0 75.1595
5224 278.67 0 101.1925 0 75.1595
5225 0 129.01 0 0 0
5226 278.67 0 0 0 0
5227 278.67 0 101.1925 0 75.1595
5228 278.67 0 101.1925 0 75.1595
6010 0 0 0 0 0
6011 0 0 0 0 0
7056 278.67 0 101.1925 0 75.1595
7058 278.67 0 101.1925 0 75.1595
7059 278.67 0 101.1925 0 75.1595
7061 0 0 101.1925 0 75.1595
7062 278.67 0 101.1925 0 75.1595
7078 0 0 0 0 0
8000 0 0 0 0 0
8007 0 0 0 0 0

: 421 440 442 444 445 :=

5047 0 144.935 0 0 0
5048 0 144.935 0 0 0
5049 0 144.935 0 0 0
5050 0 144.935 0 0 0
5051 0 144.935 0 0 0
5052 0 144.935 0 0 0
5053 0 0 0 0 0
5200 0 0 0 0 0
5203 0 0 0 0 0
5206 0 0 0 0 0
5221 0 0 0 0 0
5223 0 0 0 0 0
5224 0 0 0 0 0
5225 0 0 0 0 0
5226 0 0 0 0 0
5227 0 144.935 0 0 0
5228 0 0 0 0 0
6010 0 0 0 0 0
6011 0 0 0 0 0
7056 0 144.935 0 0 0
7058 0 144.935 0 0 0
7059 0 144.935 0 0 0
7061 0 144.935 0 0 0
7062 0 144.935 0 0 0
7078 0 0 0 0 0
8000 0 0 0 0 0
8007 0 0 0 0 0

: 446 491 531 131 842 :=

5047 0 0 0 0 0
5048 0 0 0 0 0
5049 0 0 0 0 0
5050 0 0 0 0 0
5051 0 0 0 0 0
5052 0 527.884 0 0 0
5053 0 527.884 0 0 0
5200 0 0 0 0 0
5203 28.6 0 0 0 0
5206 28.6 0 0 0 0
5221 0 0 0 0 0
5223 28.6 0 0 0 0
5224 28.6 0 0 0 0
5225 28.6 0 0 0 0
5226 28.6 527.884 0 0 0
5227 28.6 0 0 0 0
5228 0 0 0 0 0
6010 0 0 0 0 0
6011 0 0 0 0 0
7056 0 0 0 0 0
7058 0 0 0 0 0
7059 0 0 0 0 0
7061 0 0 0 0 0
7062 0 0 0 0 0
7078 0 0 0 0 0
8000 0 0 0 0 0
8007 0 0 0 0 0

: 140 208 130 120 142 :=

5047 0 0 0 0 0
5048 0 0 0 0 0
5049 0 0 0 0 0
5050 0 0 0 0 0
5051 0 0 0 0 0
5052 0 0 0 0 0
5053 0 0 0 0 0
5200 0 0 0 0 0
5203 0 0 0 0 0
5206 0 0 0 0 0
5221 0 0 0 0 0
5223 0 0 0 0 0
5224 0 0 0 0 0
5225 0 0 0 0 0
5226 0 0 0 0 0
5227 0 0 0 0 0
5228 0 0 0 0 0
6010 0 0 0 0 0
6011 0 0 0 0 0
7056 0 0 0 0 0
7058 0 0 0 0 0
7059 0 0 0 0 0
7061 0 0 0 0 0
7062 0 0 0 0 0
7078 0 0 0 0 0
8000 0 0 0 0 0
8007 0 0 0 0 0 ;


param cap_horas:=

5047 100
5048 100
5049 100
5050 100
5051 100
5052 100
5053 100
5200 100
5203 100
5206 100
5221 100
5223 100
5224 100
5225 100
5226 100
5227 100
5228 100
6010 100
6011 100
7056 100
7058 100
7059 100
7061 100
7062 100
7078 100
8000 100
8007 100;






Paul

unread,
Nov 8, 2009, 11:05:44 AM11/8/09
to AMPL Modeling Language
On Nov 7, 7:39 pm, Diana <dixig...@hotmail.com> wrote:
> Hello, when I try to solve the modelo, I get a error message:
>
> file -
> line 46
> offset 1667
> cumpl_labor is not defined

You define a parameter named cumpl_lab but refer to a parameter named
cumpl_labor. Since there are no references to cumpl_lab other than in
its declaration, I suspect you meant them to be the same thing.

You also need to insert a statement
data;
before the start of the data declarations (around where you have the
comment #DATA). Otherwise AMPL thinks the data statements are actually
trying to redefine your sets and parameters.

> file -
> line 292
> offset 7619
> expected :=
> file -
> line 303
> offset 8007
> cap_horas is already defined
> Error executing "solve" command:
> error processing constraint capa_horas[5047]:
>         no value for tiempo_ej[5047,409]

I don't get this far, because you did not provide data for the
parameter cap_uso.

/Paul

Reply all
Reply to author
Forward
0 new messages