Re: Change of a variable which is actually fixed

16 views
Skip to first unread message

Peter Notebaert

unread,
Jun 5, 2023, 2:27:48 PM6/5/23
to Mario Ng, lp_solve
You will have to be more concrete because with your explanation we can't do much.

What do you mean by "Then I just assign a concrete value to a variable"
How do you assign a value to a variable in the solver?

"The strange thing is, that sometimes some variables which should be fixed change in the solution"
Do you mean fixed by setting a min=max = 1?
Have you generated the lp model in this case and is it actually saying a = 1 in the bounds section?

Peter

On Mon, 5 Jun 2023 at 20:05, Mario Ng <marion...@gmail.com> wrote:
Dear all,

I use lp_solve for a problem in energy use optimization. Therefore, I automatically generate a model consisting of many restrictions. During the generation of the model in an lp-file the model is correct and a solution is generated. So good so far.

A strange problem occures in cases where I automatically fix variable values based on heuristics which I apply during model generation. Then I just assign a concrete value to a variable, let say like

a = 1;

Also, this variable a is mentioned in the bin-section (definition of the binary variables) at the end, like

bin a; // some other binary variables follow actually

Even though it is not changed, but it saves some generation effort while just keeping it in the bin-section. The variable a is not mentioned anywhere else. There are several such fixed variables following all the same schema of the assigment and the mentioning in the bin section.

A solution is generated and no error occurs. The strange thing is, that sometimes some variables which should be fixed change in the solution, for example instead of a=1 it changes to a = 0 as a result after optimization.

And now I am wondering why this happens and how I could avoid this. Did I use the modelling in a wrong way?

Thank you very much for your help in advance!

Mario

--
You received this message because you are subscribed to the Google Groups "lp_solve" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lp_solve+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lp_solve/c84840c8-2925-4d08-a1f3-5826f60ed9bcn%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages