I believe I coded them in the same way you suggest here. So by far the same error still stays.
In order to not bother you too much, I juts use t parts of my codes as follows as an example.
---------------------
# OBJECTIVE
# ---------------------
minimize total_distance:
sum {s in SetofNc, j in Block, m in Sectorofvessel,
k in Berth:originofsectorvessel[m] == origin[s] and k <= berthamount-amountofberthoccupied[origin[s]]+1}
abs (locationberth[k] + locationofsectorvessel[m] - (locationblock[j] + 0.5 * blockwidth) )* Store[s,j,m,k]
+ sum {i in Vessel, k in Berth} abs (locationberth[k] + 10-locationblockRc) * Startberthvessel[i,k] * demandRc[i];
# ---------------------
# CONSTRAINTS
# ---------------------
subject to singlestartservicetimestep {i in Vessel}:
sum {t in Timestep: t <= timeamount-servicehour[i]+1 and t >= arrivaltime[i]} Startservicetimestep[i,t] = 1;
sum {j in Block, m in Sectorofvessel, k in Berth:originofsectorvessel[m] == origin[s]
and k <= berthamount-amountofberthoccupied[origin[s]]+1} Store[s,j,m,k] = 1;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
All the parameters and variables has been defined already and Im using AMPL IDE. In its Console, I did these steps.
1 I input "model file.mod;"
I got 1 warning"12.mod, line 3 (offset 38):Vessel is already defined context: set >>> Vessel; <<<".
This line 3 is the first code in mod file. Does this mean just this line 3 has been defined?
2 I ignored this warning and input"data file.dat;"
I got 9 simliar feedback to say "12.dat, line 2 (offset 25): data for Vessel already read context: set >>> Vessel <<< := 0 1 2 3; ".
in my dat flie,I have more than 9 data to read. Does this mean just these 9 has been read?
3 I ignored all these 10 warning, I input"solve;"
then I got "No constraints or objectives."
--------------------------------------------------------------------------------------------------------------------------------------------