Here is my code
In this case. Suppose I enter a set of parameters. If exchanger2 is feasible, then I want to stop exchanger1 to execute solve.
Code: Select all
model exchanger1 /eq_r,eq_p,eq_nsmin1,eq_tlm1,eq_ft1,eq_ns1,eq_p121,eq_a1,eq_c1/; model exchanger2 /eq_r,eq_p,eq_nsmin2,eq_tlm2,eq_ft2,eq_ns2,eq_p122,eq_a2,eq_c2/; option optcr=0; if (r.l = 1, solve exchanger2 using minlp minimizing c2; else if (r.l <> 1, solve exchanger1 using minlp minimizing c1; ); );
How can I typing stop execute solve code? (As long as the error of dividing by 0 occurs, stop executing solve the exchanger1)
In addition, model exchanger1 is to execute solve when r.l is not equal to 1, and model exchanger 2 is r.l equal to 1 to execute.
Where r is a variable.