Hi,
I am a beginner in using AMPL along with CPLEXto make a MILP model where I am trying to minimise energy consumption. I am testing my model but have run into these errors. I would appreciate any tips or help.
Thank you!
I am a beginner in using AMPL along with CPLEXto make a MILP model where I am trying to minimise energy consumption. I am testing my model but have run into these errors. I would appreciate any tips or help.
Thank you!
Sorry, it’s very hard to work with your screenshot. Please upload Milp.mod: click on Reply, and then click the “uparrow” icon at the top of the editor window to select the file to upload.
I read your model file into AMPL and saw this error:
../Milp.mod, line 114 (offset 5073):
syntax error
context: param >>> CPUs{ <<< s in S}; # Processing request of IOT node s
I couldn’t see anything wrong with the param statement shown in the error message, so I examined your file with a hex editor (HxD) that shows every character code in the file. It revealed that there was a nonprinting character at the end of the previous statement:
You can fix this by deleting the line containing the previous statement (param
EPId;
) and then re-typing the statement.
After that error was fixed, I saw this one:
s is not defined
context: var Lsd_mn {(s >>> in <<< S), d in D, m in N, n in Nm[m]} >= 0; # Traffic demand between IOT source node s and processing device d traversing link where m,n
That is caused by putting parentheses ( ) around the indexing expression; it should be
var Lsd_mn {s in S, d in D, m in N, n in Nm[m]} >= 0; # Traffic demand between IOT source node s and processing device d traversing link where m,n
But then you will have to do something about the second indexing expression in this statement(d
in
D
) because there is no set D
defined in your model.
Hi Robert,
Thank you so much, I really appreciate it! I made the corrections you showed but I have ran into some more errors. The second error for Omsd occurs after I comment Psd out which must mean there is consistency in how I have been incorrectly declaring my variables. If possible could you let me know what the issue with my declarations are?
Many thanks,
Shajida
Milp.mod (11.3 KB)
It’s the same problem — more nonprinting characters in your model file. To fix each error like “var
>>>
Psd
<<<
” you will need to go back to the previous statement (skipping comments) and edit out the nonprinting character. It always comes after the ; character at the end of the previous statement, so you can fix the error by deleting
; #
at the end of the previous statement, and then retyping these characters.