"" is already defined

Hi,

I am doing my final degree work and I have been given this solution to solve with AMPL and compare with my model developed in C#.

However, I can’t manage to run it as it is in the book “Voß-Woodruff2006_Book_IntroductionToComputationalOpt” (p. 85).

I am grateful for any comments.

Thank you.

Modelo_Tabu.mod (2.4 KB)
SCPc.dat (2.7 KB)
SCPc.run (152 Bytes)

Hi @Juangl23,

One error we get when we run that script is:

Error at _cmdno 2 executing "solve" command
(file SCPc.run, line 4, offset 62):
error processing objective objective:
	no value for C[2]

In SCPc.dat you have:

set PP := AJ8172  2 # Items with Lead Times
		  LQ8811  3
		  RN0098  4
		  NN1100  1
		  WN7342  12;

but the numbers seem to be for the parameter LT declared after.

By declaring the data for set PP as follows it works:

set PP := AJ8172 # Items with Lead Times
		  LQ8811
		  RN0098
		  NN1100
		  WN7342;

After setting to solver in SCPc.run (e.g., “option solver highs;”) before `solve;" we got the following output:

HiGHS 1.5.1: optimal solution; objective 9938.47165
262 simplex iterations
1 branching nodes

 SCPc with 5 SKUs and 8 time buckets.
x [*,*] (tr)
:       AJ8172      LQ8811          RN0098         NN1100     WN7342    :=
1jan04   100       0              9.80708e-14    -1.31292e-13    0
2jan04     0      -1.31292e-13   77.5           300              0
3jan04     0     300              0               1.97533e-13    0
4jan04     0       1.97533e-13   75               0              0
5jan04     0       0              0               0              0
6jan04    77.5     0              0               0              0
7jan04     0       0              0               0              0
8jan04     0       0              0               0              0
;

iplus [*,*] (tr)
:       AJ8172 LQ8811     RN0098    NN1100 WN7342    :=
1jan04    70      90     0             0     900
2jan04    40      90     0             0     900
3jan04   130      80     0             0     600
4jan04   110      80     0             0     600
5jan04    80      80     9.9476e-14    0     600
6jan04    60     215     0             0     600
7jan04    30     215     0             0     600
8jan04    67.5   225    75             0     675
;

iminus [*,*] (tr)
:      AJ8172   LQ8811 RN0098 NN1100   WN7342     :=
1jan04    0     0         0      0      0
2jan04    0     0         0      0      0
3jan04    0     0         0      0      0
4jan04    0     0         0      0      0
5jan04    0     0         0      0      0
6jan04    0     0         0      0      0
7jan04    0     0         0      0      0
8jan04    0     9.9997    0      0     75.0003
;

First of all, thank you for your response.

Regarding the resolution, I have removed what was left over in the .dat file and, sorry, but it is a given model and I don’t understand what you are explaining in “After setting to solver in SCPc.run (e.g., “option solver highs;”) before `solve;”". Please, could you develop it?

I have tried to use what I have seen in HiGHS Options — AMPL Resources but when I send the .run file to AMPL I still get the problem of the variables in the title. Why is this? Could it be that I’m not debugging properly?

Thanks in advance.

Hi @Juangl23,

With the following files:
Modelo_Tabu.mod (2.4 KB)
SCPc.dat (2.7 KB)
SCPc.run (176 Bytes)
you can then run ampl SCPc.run and it will produce the following output:

HiGHS 1.5.1: optimal solution; objective 9938.47165
262 simplex iterations
1 branching nodes

 SCPc with 5 SKUs and 8 time buckets.
x [*,*] (tr)
:       AJ8172      LQ8811          RN0098         NN1100     WN7342    :=
1jan04   100       0              9.80708e-14    -1.31292e-13    0
2jan04     0      -1.31292e-13   77.5           300              0
3jan04     0     300              0               1.97533e-13    0
4jan04     0       1.97533e-13   75               0              0
5jan04     0       0              0               0              0
6jan04    77.5     0              0               0              0
7jan04     0       0              0               0              0
8jan04     0       0              0               0              0
;

iplus [*,*] (tr)
:       AJ8172 LQ8811     RN0098    NN1100 WN7342    :=
1jan04    70      90     0             0     900
2jan04    40      90     0             0     900
3jan04   130      80     0             0     600
4jan04   110      80     0             0     600
5jan04    80      80     9.9476e-14    0     600
6jan04    60     215     0             0     600
7jan04    30     215     0             0     600
8jan04    67.5   225    75             0     675
;

iminus [*,*] (tr)
:      AJ8172   LQ8811 RN0098 NN1100   WN7342     :=
1jan04    0     0         0      0      0
2jan04    0     0         0      0      0
3jan04    0     0         0      0      0
4jan04    0     0         0      0      0
5jan04    0     0         0      0      0
6jan04    0     0         0      0      0
7jan04    0     0         0      0      0
8jan04    0     9.9997    0      0     75.0003
;

I made just two changes:

  1. In SCPc.dat:
set PP := AJ8172 # Items with Lead Times
		  LQ8811
		  RN0098
		  NN1100
		  WN7342;
  1. In SCPc.run:
model Modelo_Tabu.mod;
data SCPc.dat;
option solver highs; # specify the solver to use
solve;