tag:blogger.com,1999:blog-8781383461061929571.post6400196042807432387..comments2024-03-14T09:08:19.035-04:00Comments on OR in an OB World: Max and Min Functions in a MIPPaul A. Rubinhttp://www.blogger.com/profile/05801891157261357482noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-8781383461061929571.post-46709969292611487262022-01-20T10:57:16.396-05:002022-01-20T10:57:16.396-05:00You're welcome. Good luck with your studies!You're welcome. Good luck with your studies!Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-7218174446698039032022-01-20T10:44:07.170-05:002022-01-20T10:44:07.170-05:00Dr. Rubin, thank you for your very clear explanati...Dr. Rubin, thank you for your very clear explanation. Best wishes from a 1st year Ph.D. student.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-709814496061202172021-11-23T09:33:24.647-05:002021-11-23T09:33:24.647-05:00Actually, the objective function is a sum of reven...Actually, the objective function is a sum of revenues in time, each of them depending on the amount of injected power to the network (Pow_pos) among other variables. Also, Pow_pos has to complaint with other constraints such as power balance in a network (generated power and load must be the same). So, I think the binary variables are unavoidable, unless we use the strategy of putting 'Pow_pos>=0' and 'Pow_pos>=Pow' and then minimizing 'Pow_pos', so it is either null (if Pow is negative) or Pow (if Pow is positive). <br />Thank you anyway Dr. Rubin.DRhttps://www.blogger.com/profile/00543965461142460550noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-76571882306603835512021-11-22T13:37:26.022-05:002021-11-22T13:37:26.022-05:00This comes down to how "Pow_pos" affects...This comes down to how "Pow_pos" affects the objective function. Writing Pow = Pow_pos - Pow_neg (with all variables >= 0) is the correct start. If smaller values of Pow_pos are always better for the objective function, that's all you need. If the objective function "prefers" larger values of Pow_pos, though, then I do not think there is any way to avoid introducing a binary variable to prevent Pow_pos and Pow_neg from both being nonzero. I think (but I'm not sure) that some solvers will let you add the complementarity constraint Pow_pos * Pow_neg = 0 instead, but internally the solver will most likely either branch on the product (Pow_pos = 0 in one child, Pow_neg = 0 in the other) or add a binary variable anyway, so I don't think you gain anything over putting the binary variable in yourself.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-58388689727153366602021-11-22T07:46:09.841-05:002021-11-22T07:46:09.841-05:00Dear Dr. Rubin.
I have a decision variable 'Po...Dear Dr. Rubin.<br />I have a decision variable 'Pow' and another one 'Incentive'. The latter is inside the objective function and takes into account 'Pow' only if it is positive. What we've done is to divide 'Pow' into two variables 'Pow_pos' and 'Pow_neg'. We've done this by using binary variables which constrain one of both to be null, but we would like very much to keep the linearity of the problem. We thought of using a function such as 'Pow_pos=max(0,Pow)' and 'Pow_neg=min(0,Pow)', but we didn't find a way to express max and min as linear functions. Do you have anything in mind that could help us?<br />One way to do it is to put 'Pow_pos>=0' and 'Pow_pos>=Pow' and then minimizing 'Pow_pos'. Vice versa for 'Pow_neg'. Of course this constrains us to increase the complexity of the objective function. We were looking for a more fancy way.<br />Thank you very much.DRhttps://www.blogger.com/profile/00543965461142460550noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-426576892342553622018-12-14T16:54:49.175-05:002018-12-14T16:54:49.175-05:00Sorry, I don't have a reference at hand. It...Sorry, I don't have a reference at hand. It's not to hard to prove mathematically, and I suspect it has been used as a homework assignment on more than one occasion. You may be able to find a version of it in the book "Model Building in Mathematical Programming" by H. P. Williams, but I'm not positive it's covered there.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-6170662551090385562018-12-14T12:51:08.837-05:002018-12-14T12:51:08.837-05:00Dear Dr. Rubin
Would you please provide a referenc...Dear Dr. Rubin<br />Would you please provide a reference for your claim? Especially I am looking to read more about the first statement.<br />Thank youAnonymoushttps://www.blogger.com/profile/17645734031975767709noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-54619619877028229132017-02-02T17:07:43.039-05:002017-02-02T17:07:43.039-05:00Yes, you can "chain" max operations as y...Yes, you can "chain" max operations as you described, adding one binary variable for each $z_j$. You can equivalently start with one binary variable for each original variable ($w_a$ corresponding to $a$, $w_b$ corresponding to $b$, ...) with the constraint $w_a + w_b + ... = 1$ (exactly one variable is picked to be maximal), and similar upper bound constraints as before (where the original $w$ would now be $w_y$ and $1-w$ would be $w_x$). The lower bounds $L_a$ etc. would be as before, while the upper bounds would change so that, for example, $U_y$ in the first upper limit constraint would be replaced by the largest upper bound of any variable other than $x$, while $U_x$ would be replaced by the largest upper bound of any variable other than $y$. Either approach should work.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-4674733848024277432017-02-02T12:40:53.506-05:002017-02-02T12:40:53.506-05:00Very useful !
It seems to work for several variab...Very useful !<br /><br />It seems to work for several variables :<br /><br />z0=max(a,b)<br />z1=max(z0,c)<br />z2=max(z1,d)<br />....<br /><br />a,b,c have same bounds<br /><br />Isn't it ?<br /><br />RegardsAnonymoushttps://www.blogger.com/profile/17569878090717475070noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-40543365793239870952017-02-02T12:39:36.717-05:002017-02-02T12:39:36.717-05:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/17569878090717475070noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-41181339968049345002016-02-20T19:49:51.115-05:002016-02-20T19:49:51.115-05:00Assuming that Cost_battery > 0, the solver will...Assuming that Cost_battery > 0, the solver will want to give it the smallest value possible (given the rest of the solution). That means you can declare PoverBudget to be a nonnegative variable and then constrain it to be >= the summation you gave. If the sum is negative, the solver will set it to zero, the smallest feasible solution (given the sign restriction).Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-29163905352652402202016-02-18T12:12:30.945-05:002016-02-18T12:12:30.945-05:00Can you shed me a light on this subject regarding ...Can you shed me a light on this subject regarding my problem? I need to find PoverBudget, which is PoverBudget = (summation_t=1:24) Pbattery - Pbudget . I want the PoverBudget to be zero, if the resulting value is negative or else keep the value if its positive. I am confused how to formulate it, as a constraint or as an objective function. Actually, I need to minimize (Cost_battery * PoverBudget) in the objective function, and I cannot find ways to model that in CPLEX.<br />Any help will be greatly appreciated.Ibalhttps://www.blogger.com/profile/10782555044281627291noreply@blogger.com