1

This is .mod (model file)

tuple TDayPair{
  string day1;
  string day2;
}

{TDayPair} DAYS={<"Mon","Tue">,<"Thurs","Fri">};
int a[DAYS]= ...;
execute {
  writeln(a[<"Mon","Tue">]); //<--it gives syntax error here
}

This is .dat (data file)

a = #[
  <"Mon","Tue">:1,
  <"Thurs","Fri">:2,
]#;

It gives syntax error at the model file at writeln(a[<"Mon","Tue">]); what's the issue here?

1 Answer 1

2

If you write

tuple TDayPair{
  string day1;
  string day2;
}

{TDayPair} DAYS={<"Mon","Tue">,<"Thurs","Fri">};
int a[DAYS]= ...;
execute {
  writeln(a[DAYS.find("Mon","Tue")]); //<--it gives syntax error here
}

You will get

1

OPL Modeling language is not the same as the OPL Javascript language that helps with preprocessing, postprocessing and flow control.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.