I'm new to AMPL, and I would like to create a param
C that map from a set A to set B:
file.mod:
set A;
set B;
param C{i in A} =
if i == "AA"
then
BA
else if i == "AB"
then
BB
else if i == "AC"
then
BC
else
BA;
data file.dat;
file.dat:
data;
set A := AA, AB, AC;
set B := BA, BB, BC;
When I try to compile this code, I get BA is not defined
. If I replace the set element by string (BA
becomes "BA"
), then the error `Cannot convert character string to a number.``showed up.
Is there a way to achieve what I want to do?