Forum Discussion
FICO
2 years agoCommunity Manager
How to make a variable be of "continuous type" but only allow (positive) integer values as its solution
Hi, I'm a student and currently stuck on a difficult problem. I've tried for many hours to solve this seemingly simple problem and can't find a solution. It would be cool if you could help without looking at my code because this task is being graded and I don't want you to help with my code itself, so that I don't get an unfair advantage.
My problem is that I have several arrays of decision variables in my code that need to be integers but at the same time I need to know their reduced costs. For that, all these variables need to be of the continuous type but if I don't clarify at least one of them to be an integer, then I receive real values for my solutions, though I also receive their reduced costs.
Is there any way to restrict my (arrays of) decision variables to integer values while receiving their fixed costs?
Thanks a lot for your help in advance,
Paul
4 Replies
- FICOCommunity Manager
Hi Paul,
integer variables cannot have a reduced cost, by their nature. In a way the reduced cost measures the change of objective per unit change of the variable, in other words a derivative. That you cannot have for a discrete variable.
The simplest case is when your problem is guaranteed to have integer optimal solutions (TU matrix). In that case you can just drop the integrality and obtain the reduced costs. In general, you can always try to drop the integrality and hope the solutions turn out to be integer. If so, your problem is solved.
Another thing that people commonly do is to solve the integer problem to optimality, then fix the integer variables to their optimal values and then resolve the problem. This way you can at least get reduced costs for the other variables, but still not for the integer ones.
If you want to get a measure similar to a reduced cost for an integer variable you need to perform sensitivity analysis: change the variable by one in each direction and observe how the optimal objective value is changing.
Without knowing your problem my assumption is that your task involves some sensitivity analysis, for which you learned to use the reduced cost in the continuous case, but your problem is integer. In this case you'll have to do the sensitivity analysis manually.
In summary, try to focus on why you think you need the reduced costs and what other ways are there to get the same information without reduced costs.
I hope this helps,
Imre Polik
FICO
- FICOCommunity Manager
Dear Mr. Polik,
Thanks for your answer, it really helps me a lot!
In other excercises, my algorithms always guaranteed integer solutions when they were needed. I will review my current algorithm once again and see if I can change it to only allow integer values by using better constraints. If that doesn't work, I'll do sensitivity analysis as you mentioned. I'm just getting into xpress and I'm happy about your fast and precise response!
Kind Regards,
Paul
- FICOCommunity Manager
An add-on to the previous: the Xpress optimizer provides a function 'XPRSfixmipentities' to perform the fixing of all discrete variables in a problem. Here is a Mosel example that shows how to use this functionality: https://examples.xpress.fico.com/example.pl?id=chess_3
- FICOCommunity Manager
Dear Ms. Heipcke,
Thanks for that additional information!
I will be working on my assignment again later today and this will be helpful, especially having such a detailed example with comments is really nice.
Sincerely,
Paul
Related Content
Related Content
How to resolve traceback: "xpress.InterfaceError: Incorrect control name; check name and license type"?
We are trying to access xpress in Python via Pyomo. We have no issues installing xpress and solving a simple model with the xpress interface. However, when we attempt to access xpress via pyomo we re...2 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread1View0likes1CommentCan't find the reason for "E-113: Wrong type for conversion" error
Hi all, Im new to Mosel so this may be an easy one. See example Mosel model below and find associated data file attached. When I run the code it seems Mosel is trying to convert one of the data type...6 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum2 unread comments2 unread0Views0likes2Commentscom.blazesoft.engines.rules.NdCompilerException: The type for the initial value is invalid. Expected 'array_of_ElementParent' but got a 'array_of_"ElementChild".
Hi everyone, I'm trying to generate an ADB of a strategy, but i'm having the issue above, Does anyone experience something similar? I have an elementA that is parent of elementB, generally I work de...