Dear all,
I am implementing a kind of branch and cut in GAMS and I have the following problem. I have a simple problem with just two nonnegative constaints in my model:
set p auxiliary superset /1*200/ ;
set i another set /1*100/
variables w(j,m) ;
parameters fs1(j,i), fs2(j,p) ;
equations contraint1(i), constraint2(p) ;
constraint1(i).. sum((j,m), w(j,m) * fs1(j,i)) =g= 0 ;
constraintA2(p).. sum((j,m), w(j,m) * fs2(j,p)) =g= 0 ;
Now, I would like to solve the problem. I inizialize
fs2(j,p) = fs1(j,"1");
and solve the model with the two constraints. Here there is the first problem: changing the inizialization, e.g. fs2(j,p) = fs1(j,"2"); the solution changes, but I don't know why since I am just coping a constraint of constraint1(i), namely constraint1("1") in the second constraints. The model doesn't change. Moreover, I would like to implement a branch and cut approach, introducing a dynamic set dynset(p) and redefining the second constraints as
set dynamic(p) ;
dynset(p) = no ;
constraintA2(dynset).. sum((j,m), w(j,m) * fs1(j,dynset)) =g= 0 ;
I again initialize fs2(j,p) = fs1(j,"1"), I solve the model. Then, I have a loop over p: in each iteration I construct the cut defining the value of the parameter
fs2(j,dynset) $(dynset.val = p.val) = ...
and set dynset(p) = yes and solve the problem again. But it seems that there is something wrong in the updating phase. I really appreciate all you help.
Thanks in advance, Best regards,
Luca
Problem in changing the parameter.
Re: Problem in changing the parameter.
Hi Luca
It looks obvious that you have different solutions as you choose different values for the parameters.
The question on the dynamic set is hard to answer without the code to run the model and the exact error.
Cheers
Renger
It looks obvious that you have different solutions as you choose different values for the parameters.
The question on the dynamic set is hard to answer without the code to run the model and the exact error.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: Problem in changing the parameter.
Thanks very much for your answer. It is true that I have different value for the parameters, but the second equations are just the copypaste of one of the equation in the first set. I have all the equation I need in the first group of constraints, while in the second one I have always a constraint that I already have in the previous set. If I set fs2(j,p) = fs1(j,"1"); I copy the first constraint, if I set fs2(j,p) = fs1(j,"2"); I copy the second one and so on. I still do not get why gams gives different solutions.
Re: Problem in changing the parameter.
Luca,
If you want an answer to your question, you have only to post a running (and hopefully minimal) example that reproduces the issue. I feel sure this will get you a helpful response. There is also a good chance that putting this together will lead you to the solution of your own problem.
Steve
If you want an answer to your question, you have only to post a running (and hopefully minimal) example that reproduces the issue. I feel sure this will get you a helpful response. There is also a good chance that putting this together will lead you to the solution of your own problem.
Steve
Re: Problem in changing the parameter.
Here there is the code. I have a master problem, PROBLEM1, whose constraints are dynamically added by solving PROBLEM2. The syntax is correct, but the code has a strange behaviour (I am not sure I use the dynamic set in the right way). Thanks very much for all your suggestions.
 Attachments

 CODE_1.gms
 minimal exemple code to run
 (5.74 KiB) Downloaded 44 times
Last edited by Luca 1 year ago, edited 1 time in total.
Re: Problem in changing the parameter.
Hi Luca
If you are sure that the equations are the same, make a check by writing a report parameter that looks at the differences between solutions (just write out the matrix fssol for every solve and compare them.
Thy dynamic set works fine (one element of the set is added in every run).
Cheers
Renger
If you are sure that the equations are the same, make a check by writing a report parameter that looks at the differences between solutions (just write out the matrix fssol for every solve and compare them.
Thy dynamic set works fine (one element of the set is added in every run).
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: Problem in changing the parameter.
Thanks for the answer. I have already check the difference between fsSOL matrix and apparently all is ok.
But, when I solve the problems (which apparently are the same), I obtain different solutions.
 Luca
But, when I solve the problems (which apparently are the same), I obtain different solutions.
 Luca