tag:blogger.com,1999:blog-8781383461061929571.post2683693692402694435..comments2024-03-14T09:08:19.035-04:00Comments on OR in an OB World: Piecewise-linear Functions in Math ProgramsPaul A. Rubinhttp://www.blogger.com/profile/05801891157261357482noreply@blogger.comBlogger42125tag:blogger.com,1999:blog-8781383461061929571.post-53492652761646438912018-12-16T14:14:44.231-05:002018-12-16T14:14:44.231-05:00You would maximize $b'x + \sum_{i=0}^N e^{W_i}...You would maximize $b'x + \sum_{i=0}^N e^{W_i} y_i$, which is linear in $x$ and $y$. Any integer linear programming solver that recognizes SOS2 constraints could be used.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-22955879404753773992018-12-15T13:33:46.050-05:002018-12-15T13:33:46.050-05:00Hello Professor Rubin,
I am studying on probabili...Hello Professor Rubin, <br />I am studying on probabilistic chance constraints. My objective function is in the shape you mentioned here,<br /> <br />https://www.quora.com/How-can-I-solve-a-constrained-optimization-problem-where-the-objective-function-is-sum-of-a-linear-expression-and-an-exponential-of-linear-expression<br /><br />I understood additional constraint but I could not understand how I will modify the objective function ? How can I solve this problem ,with which solver ? <br /><br />Any help is appreciated <br /><br />Thank you so muchAnonymoushttps://www.blogger.com/profile/10419863758087972465noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-39003032678881945802018-11-15T13:52:04.299-05:002018-11-15T13:52:04.299-05:00OK, again thanks much. Very helpful and I learned ...OK, again thanks much. Very helpful and I learned something new :-)Unknownhttps://www.blogger.com/profile/05810668373168924861noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-41007459946052958332018-11-15T13:27:22.177-05:002018-11-15T13:27:22.177-05:00I've seen pw-linear functions of two arguments...I've seen pw-linear functions of two arguments, but not in a while, and I can't point to any examples.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-86142445191095733622018-11-15T13:09:52.732-05:002018-11-15T13:09:52.732-05:00Thanks Paul.
When I include temp2 (capital gains ...Thanks Paul.<br /><br />When I include temp2 (capital gains tax associated with taxable income) in the objective function the cgt constraint works as I want but it has the, for me, unintended side effect of causing the model to minimize income tax which is slightly different from maximizing spendable. The minimization gives unwanted transfers of money from 401k to investment account. All that does lower the taxes and increase the object function while slightly lowering spendable. <br /><br />I think I will try to convert the capital gains function from 2d to 3d and having piecewise linear plains to represent the function. Have you ever seen this done? know of any examples?<br /><br />Thanks Much,Unknownhttps://www.blogger.com/profile/05810668373168924861noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-39441738159246357132018-11-15T11:15:40.601-05:002018-11-15T11:15:40.601-05:00I assume that first constraint was supposed to be ...I assume that first constraint was supposed to be == or >= rather than <=; otherwise the model is unbounded. Assuming that, spendable increases as CG tax decreases, and your model lets you have zero CG tax by setting temp2 equal to temp1. I suspect you need to tie temp2 to income tax in a way that discourages padding temp2, but that is an accounting question and I am (blissfully!) ignorant of accounting.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-3992184703544826722018-11-14T19:26:40.935-05:002018-11-14T19:26:40.935-05:00Sorry for not being more clear. The object functio...Sorry for not being more clear. The object function I want is to maximize spendable dollars. Call this 'spendable.' Then I have another constraint that takes income sources with their various type of taxes and other expenses to define s. The model is to create a plan for using retirement funds optimally. So as it maximizes after tax spendable money the constraint defining s includes these income(s) minus their taxes. So, yes, the lower the tax the higher the spendable money. <br /><br />maximize spendable<br />s.t. <br />401k Withdrawal + Investment Account Withdrawal - Income tax - CapGainsTax <= spendable<br />Income tax >= 7 linear functions for the income tax brackets x=taxable income<br />temp1 >= 3 linear functions for the capital gains brackets x=taxable income + capital gains <br />temp2 >= 3 linear functions for the capital gains brackets x=taxable income<br />CapGainsTax >= temp1 - temp2<br /><br />I hope that is more clear.<br />Thanks,Unknownhttps://www.blogger.com/profile/05810668373168924861noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-86851290586250538692018-11-14T18:25:48.972-05:002018-11-14T18:25:48.972-05:00I'm not sure I'm following this, but my fi...I'm not sure I'm following this, but my first guess would be that you might be minimizing ctg rather than minimizing total tax. If I were filling out a tax return and focused only on minimizing capital gains tax, I would declare all my income as "ordinary". That would give me not capital gains tax (but would have me paying more tax overall, since I just passed up the lower CG rate in favor of the higher ordinary rate).Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-57531668367573562692018-11-14T17:23:31.837-05:002018-11-14T17:23:31.837-05:00Very useful post. I used it to guide the construct...Very useful post. I used it to guide the construction of a income tax calculation and it works great. I then tried to use it for calculation of capital gains taxes but this does not work. Basically I created the same piecewise linear tax function and then tried ctg >= f(ti+cg) - f(ti) where cgt is the capital gains tax, f() is the piecewise linear function, ti is taxable income and cg is capital gains. What happens is that f(ti) rises to match f(ti+cg) so cgt becomes zero. I don't know how to correct this or how to rewrite the capital gains tax function to get around this. Any ideas?<br />Thanks much,Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-19656052937366752552017-08-19T16:08:47.940-04:002017-08-19T16:08:47.940-04:00Sorry, your condition does not make any sense. Mig...Sorry, your condition does not make any sense. Might it be missing a few symbols? If you know LaTeX, you can write LaTeX math notation bracketed by dollar signs. When you post the comment, you won't see the math output, but after refreshing the page you should.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-47099971604845160582017-08-19T02:34:42.590-04:002017-08-19T02:34:42.590-04:00Dear Sir
I have function
if c A(c) = 1;elseif (c1...Dear Sir<br />I have function <br />if c A(c) = 1;elseif (c1 A(c) = 1- eq;elseif(c>c2) =>A(c) = 0;<br />what would be my breakpoints if i want to solve this by piece wise linear?Anonymoushttps://www.blogger.com/profile/10765131788909185489noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-41521011511879398752017-05-21T10:27:44.046-04:002017-05-21T10:27:44.046-04:00Sorry, no; I don't work with Python.Sorry, no; I don't work with Python.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-12532783998061638002017-05-21T04:25:54.912-04:002017-05-21T04:25:54.912-04:00Thank you so much for the prompt replies, could yo...Thank you so much for the prompt replies, could you recommend any python module (that provides an interface to a solver) which could allow handling of SOS2 ?joy1993https://www.blogger.com/profile/00914610718786575201noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-520028242700216912017-05-18T17:33:44.235-04:002017-05-18T17:33:44.235-04:00Just found out that there is no mailing list for C...Just found out that there is no mailing list for CyLP. The issue tracker on the project's GitHub page serves that role.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-33752856395207013562017-05-18T17:08:25.835-04:002017-05-18T17:08:25.835-04:00I don't use either CBC or CyLP, so I'm afr...I don't use either CBC or CyLP, so I'm afraid I cannot point you directly to a tutorial or example code. There is a mailing list for CBC, though, which you can access from a link in the bottom of their project page (https://projects.coin-or.org/Cbc). The archives don't have a search feature, but Google can help you out. For instance, you could try the search query "sos2 site:https://list.coin-or.org/pipermail/cbc/".Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-53391028650887344362017-05-18T15:57:11.254-04:002017-05-18T15:57:11.254-04:00Hi,
Is there any possible link or tutorial that hi...Hi,<br />Is there any possible link or tutorial that highlights how to use SOS2 with CBC or CyLP?joy1993https://www.blogger.com/profile/17486082254935918727noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-66658367265724507082015-12-16T18:25:23.009-05:002015-12-16T18:25:23.009-05:00You're welcome. The content is "general k...You're welcome. The content is "general knowledge", nothing original, so you do not need to cite it for purposes of acknowledging authorship. If you want to cite it to demonstrate that someone other than you actually said it, the citation style will depend on the publication (journal?) to which you are submitting. The Wikipedia lists a variety of ways to cite Wikipedia pages (https://en.wikipedia.org/wiki/Wikipedia:Citing_Wikipedia); you should be able to adapt one to this blog.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-54340498227519198272015-12-16T16:41:12.873-05:002015-12-16T16:41:12.873-05:00Dear Dr. Rubin,
Thank you so much for the post. H...Dear Dr. Rubin,<br /><br />Thank you so much for the post. How can I cite this work in my study?<br /><br /> Anonymoushttps://www.blogger.com/profile/05033197214900242610noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-65731165304124790692015-07-22T14:56:11.954-04:002015-07-22T14:56:11.954-04:00Thank you so much for your reply!Thank you so much for your reply!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-69330770443213275862015-07-22T10:29:46.495-04:002015-07-22T10:29:46.495-04:00I answered this on the other post where you asked ...I answered this on the other post where you asked it. Meanwhile, you might find this informative: http://www.urbandictionary.com/define.php?term=cross-posting.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-5998734233229363242015-07-22T04:40:34.294-04:002015-07-22T04:40:34.294-04:00Hello Paul,
I'm doing some modeling using Guro...Hello Paul,<br />I'm doing some modeling using Gurobi, and I encounter a problem (Q is not psd)when I tried to set a quadratic constraint like this : cx - s*x = b, I wonder if I can use SOS 2 to solve my problem by transforming cx-s*x = b to s(x) = b/(c-x) , then use sos 2 to linearize it ? Can I approximate the function by a set of piecewise linear function? Then what is the linearization of s(x).? Or is there any other way to solve it ? <br />Thank you!<br /><br />Thank you !<br /><br />Thank yoAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-36817770723460734482014-02-13T15:28:03.134-05:002014-02-13T15:28:03.134-05:00Dear Mr Rubin,
Thank you so much for your quick r...Dear Mr Rubin,<br /><br />Thank you so much for your quick reply.<br />Yes, I write OPL Language. I was just going to write a reply, because I have found an answer to one question. I should use stepwisefunction; then I dont need to worry for increasing or decreasing steps. The following link is a very helpful document (for those who might be interested) particularly page 71:<br /><br />http://www.ensta-paristech.fr/~diam/ro/online/ilog/cplex124_pdfs/opl_langref.pdf<br /><br />For my second question though I have not yet figured out if the parenthesis helps or not. I will check the link you have provided.<br /><br />Many thanks,<br />HeliaAnonymoushttps://www.blogger.com/profile/04327442363670820406noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-88714073794459397852014-02-13T13:54:33.123-05:002014-02-13T13:54:33.123-05:00This seems to be a syntax question, but you did no...This seems to be a syntax question, but you did not indicate what language you are using. It looks close to OPL, but I'm not sure it is valid OPL syntax. In any case, I don't know much about OPL, so if that is what you are using, you might want to try the discussion forum for it: https://www.ibm.com/developerworks/community/forums/html/forum?id=11111111-0000-0000-0000-000000002053.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-16622426973835380482014-02-13T13:19:52.124-05:002014-02-13T13:19:52.124-05:00Hello,
Thanks for your post. I have two questions,...Hello,<br />Thanks for your post. I have two questions, I appreciate if you can give me some hints.<br />1- I need to write the steps in discontinuous piecewise linear functions (stepwise) in a decreasing order. For example the first step is 1 but the second should decrease to 0.8. Can I define negative steps like this: <br /><br />piecewise{ 0->7904; -0.1->7904; 0->11856; -0.1->11856; 0}(7903,1) X * y<br /><br />2- in the sample function above, lets say X is a decision variable and y is a parameter. I dont want the value of piecewise function to be selected based on X * y but only X. does using a parenthesis make this distinction? or the function below is equal to the one above?<br /><br />(piecewise{ 0->7904; -0.1->7904; 0->11856; -0.1->11856; 0}(7903,1) X) * y<br /><br />Thank you so much in advance<br />HeliaAnonymoushttps://www.blogger.com/profile/04327442363670820406noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-41185445613709535682013-08-29T16:46:08.113-04:002013-08-29T16:46:08.113-04:00Thanks so much Prof. Paul,
Thanks so much Prof. Paul, <br />Anonymoushttps://www.blogger.com/profile/06191780519947772549noreply@blogger.com