0

There are 3 models that I run iteratively by using proper outputs. However, at one point, I get “mixing mistach environment” error. The code is basically as below:

//model1
..
main{
    generate & solve model1
    call model2
    model1.output_x=model2.input_x
    generate & solve model2
    call model3
    model2.output_y=model3.input_y
    generate & solve model3
}

While generating of model 3, mismatch environment error occurs. However, model 2 and model 3 are similar.

At model 3, here’s the constraint that I think causes this problem:

totalcost (dvar of model 3)-epsilon(variable of model 3)<=n1_cost (output of model2);
Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Be really careful. The statements

model1.output_x=model2.input_x
model2.output_y=model3.input_y

seem backwards. Don't you mean:

model2.input_x = model1.output_x
model3.input_y = model2.output_y

Having said that, the proper design pattern is to copy the output of one model into data input for the subsequent model. If you make sure that you have good model/data separation, then the problem should go away.

Irv
  • 540
  • 4
  • 13