{"id":2834,"date":"2024-11-04T11:11:23","date_gmt":"2024-11-04T16:11:23","guid":{"rendered":"https:\/\/blogs.mathworks.com\/matlab\/?p=2834"},"modified":"2024-11-04T11:11:23","modified_gmt":"2024-11-04T16:11:23","slug":"linear-programming-the-highs-optimization-library-and-matlab","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/matlab\/2024\/11\/04\/linear-programming-the-highs-optimization-library-and-matlab\/","title":{"rendered":"Linear Programming, the HiGHS Optimization library and MATLAB"},"content":{"rendered":"<div class = rtcContent><h4  style = 'margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: 700; text-align: left; '><span style=' font-weight: bold;'>What is linear <\/span><span>programming<\/span><span style=' font-weight: bold;'>?<\/span><\/h4><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Linear programming (LP) is a mathematical method used to determine the best possible outcome (such as maximum profit or lowest cost) in a mathematical model whose requirements are represented by linear relationships. It involves optimizing a linear objective function, subject to a set of linear constraints (equalities and inequalities). <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Put more formally, we want to find the vector x that minimizes the function<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;munder&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;min&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/munder&gt;&lt;mrow&gt;&lt;mo&gt;{&lt;\/mo&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;f&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mo&gt;\u22a4&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/msup&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;}&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-16px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><munder><mrow><mi mathvariant=\"normal\">min<\/mi><\/mrow><mrow><mi mathvariant=\"italic\">x<\/mi><\/mrow><\/munder><mrow><mo>{<\/mo><mrow><msup><mrow><mi mathvariant=\"italic\">f<\/mi><\/mrow><mrow><mo>\u22a4<\/mo><\/mrow><\/msup><mi mathvariant=\"italic\">x<\/mi><\/mrow><mo>}<\/mo><\/mrow><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>subject to the constraints <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center; '><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mtable columnalign=&quot;left&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Ax&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;b&lt;\/mi&gt;&lt;mtext&gt;\u2009\u2009\u2009\u2009\u2009\u2009\u2009\u2009&lt;\/mtext&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;inequality&lt;\/mi&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;constraints&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/mtd&gt;&lt;\/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eq&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;b&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eq&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;mtext&gt;\u2009\u2009\u2009&lt;\/mtext&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;equality&lt;\/mi&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;constraints&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/mtd&gt;&lt;\/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;lb&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;\/mi&gt;&lt;mo&gt;\u2264&lt;\/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;ub&lt;\/mi&gt;&lt;mtext&gt;\u2009&lt;\/mtext&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;\/mo&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;bound&lt;\/mi&gt;&lt;mtext&gt;\u2009\u2009&lt;\/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;constraints&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mo&gt;)&lt;\/mo&gt;&lt;\/mrow&gt;&lt;\/mrow&gt;&lt;\/mtd&gt;&lt;\/mtr&gt;&lt;\/mtable&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-27px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mrow><mtable columnalign=\"left\"><mtr><mtd><mrow><mi mathvariant=\"normal\">Ax<\/mi><mo>\u2264<\/mo><mi mathvariant=\"italic\">b<\/mi><mtext>\u2009\u2009\u2009\u2009\u2009\u2009\u2009\u2009<\/mtext><mrow><mo>(<\/mo><mrow><mi mathvariant=\"normal\">inequality<\/mi><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">constraints<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/mtd><\/mtr><mtr><mtd><mrow><msub><mrow><mi mathvariant=\"italic\">A<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">eq<\/mi><\/mrow><\/msub><mi mathvariant=\"italic\">x<\/mi><mo>=<\/mo><msub><mrow><mi mathvariant=\"italic\">b<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">eq<\/mi><\/mrow><\/msub><mtext>\u2009\u2009\u2009<\/mtext><mrow><mo>(<\/mo><mrow><mi mathvariant=\"normal\">equality<\/mi><mtext>\u2009<\/mtext><mi mathvariant=\"normal\">constraints<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/mtd><\/mtr><mtr><mtd><mrow><mi mathvariant=\"normal\">lb<\/mi><mo>\u2264<\/mo><mi mathvariant=\"italic\">x<\/mi><mo>\u2264<\/mo><mi mathvariant=\"normal\">ub<\/mi><mtext>\u2009<\/mtext><mrow><mo>(<\/mo><mrow><mi mathvariant=\"normal\">bound<\/mi><mtext>\u2009\u2009<\/mtext><mi mathvariant=\"normal\">constraints<\/mi><\/mrow><mo>)<\/mo><\/mrow><\/mrow><\/mtd><\/mtr><\/mtable><\/mrow><\/math><\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>where<\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">A<\/span><span>and <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;A&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eq&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">A<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">eq<\/mi><\/mrow><\/msub><\/mrow><\/math><\/span><span> are matrices while <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">f<\/span><span>, <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: italic; font-weight: 400; color: rgb(33, 33, 33);\">b<\/span><span>, <\/span><span mathmlencoding=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;b&lt;\/mi&gt;&lt;\/mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;eq&lt;\/mi&gt;&lt;\/mrow&gt;&lt;\/msub&gt;&lt;\/mrow&gt;&lt;\/math&gt;\" style=\"vertical-align:-6px\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msub><mrow><mi mathvariant=\"italic\">b<\/mi><\/mrow><mrow><mi mathvariant=\"normal\">eq<\/mi><\/mrow><\/msub><\/mrow><\/math><\/span><span>, <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: normal; font-weight: 400; color: rgb(33, 33, 33);\">lb<\/span><span> and <\/span><span style=\"font-family: STIXGeneral-webfont, serif; font-style: normal; font-weight: 400; color: rgb(33, 33, 33);\">ub<\/span><span> are vectors.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>For me, this makes more sense when looking at a specific example.So, let's consider the classic diet problem as described in [1]. Suppose you have three foods available: Corn, Milk and Bread<\/span><\/div><table  style = 'margin: 3px; border: 1px solid rgb(191, 191, 191); border-collapse: collapse; '><col\/><col\/><col\/><col\/><col\/><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Food<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Cost \/ Serving<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Vitamin A<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Calories<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Maximum servings<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Corn (C)<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>$0.18<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>107<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>72<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>10<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Milk (M)<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>$0.23<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>500<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>121<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>10<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Bread (B)<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>$0.05<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>0<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>65<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>10<\/span><\/div><\/td><\/tr><\/table><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>You also have two nutritional requirements to satisfy<\/span><\/div><table  style = 'margin: 3px; border: 1px solid rgb(191, 191, 191); border-collapse: collapse; '><col\/><col\/><col\/><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Nutrient<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Minimum amount in diet<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Maximum amount in diet<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Calories<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>2,000<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>2,250<\/span><\/div><\/td><\/tr><tr  style = 'background-color: rgba(0, 0, 0, 0); '><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Vitamin A<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>5,000<\/span><\/div><\/td><td  style = 'border: 1px solid rgb(191, 191, 191); vertical-align: top; '><div  style = 'margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>50,000<\/span><\/div><\/td><\/tr><\/table><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>and you can have a maximum of 10 portions of any one food type. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>How would you choose the foods that minimise the cost while satisfying all of the constraints?  <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>In MATLAB, here's how to solve this using the <\/span><a href = \"https:\/\/uk.mathworks.com\/help\/optim\/ug\/problem-based-workflow.html\"><span>Problem-based approach<\/span><\/a><span>, which is the easiest way to get started with solving linear programs in MATLAB. An alternative method would be to use the <\/span><a href = \"https:\/\/uk.mathworks.com\/help\/optim\/optimization-problem-setup-solver-based.html\"><span>solver-based approach<\/span><\/a><span>, which we'll look at later.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: rgb(0, 128, 19);\">% How many servings of each food to eat each day<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >C = optimvar(<\/span><span style=\"color: rgb(167, 9, 245);\">\"corn\"<\/span><span >, LowerBound = 0,UpperBound = 10);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >M = optimvar(<\/span><span style=\"color: rgb(167, 9, 245);\">\"milk\"<\/span><span >, LowerBound = 0,UpperBound = 10);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >B = optimvar(<\/span><span style=\"color: rgb(167, 9, 245);\">\"bread\"<\/span><span >,LowerBound = 0,UpperBound = 10);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '>&nbsp;<\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >prob = optimproblem;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >prob.Objective = C*0.18 + M*0.23 + B*0.05; <\/span><span style=\"color: rgb(0, 128, 19);\">% The cost to minimise<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '>&nbsp;<\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: rgb(0, 128, 19);\">% Add constraints for the Vitamin A requirements<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >prob.Constraints.c1 = C*107 + M*500 &gt;= 5000;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >prob.Constraints.c2 = C*107 + M*500 &lt;= 50000;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '>&nbsp;<\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: rgb(0, 128, 19);\">% Add constraints for the Calories requirements<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >prob.Constraints.c3 = C*72 + M*121 + B*65 &gt;= 2000;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >prob.Constraints.c4 = C*72 + M*121 + B*65 &lt;= 2250;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '>&nbsp;<\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >diet = solve(prob)<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement\" uid=\"3257E650\" prevent-scroll=\"true\" data-testid=\"output_0\" tabindex=\"-1\" style=\"width: 1145px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\" textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"46\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">Solving problem using linprog.\n\nOptimal solution found.<\/div><\/div><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableStringElement\" uid=\"16439357\" prevent-scroll=\"true\" data-testid=\"output_1\" tabindex=\"-1\" style=\"width: 1145px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"64\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"variable output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><span class=\"variableNameElement\" style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">diet = <span class=\"headerElement\" style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">struct with fields:<\/span><\/span><\/div><div style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">    bread: 10\n     corn: 1.9444\n     milk: 10\n<\/div><\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The <\/span><a href = \"https:\/\/uk.mathworks.com\/help\/optim\/ug\/optim.problemdef.optimizationproblem.solve.html\"><span style=' font-family: monospace;'>solve<\/span><\/a><span> function tells us that it decided to use the <\/span><a href = \"https:\/\/uk.mathworks.com\/help\/optim\/ug\/linprog.html\"><span style=' font-family: monospace;'>linprog<\/span><\/a><span> function to find the solution, useful information if we ever decide to switch to the-solver based approach in the future. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The result tells us that the cheapest solution is to have 10 portions of bread, 1.944 portions of corn and 10 portions of milk. To see how much this costs, we evaluate the objective function at the solution point.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >cost = evaluate(prob.Objective, diet);<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >fprintf(<\/span><span style=\"color: rgb(167, 9, 245);\">\"The optimal diet would cost $%.2f\\n\"<\/span><span >,cost)<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement\" uid=\"53815B52\" prevent-scroll=\"true\" data-testid=\"output_2\" tabindex=\"-1\" style=\"width: 1145px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\" textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"17\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">The optimal diet would cost $3.15<\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This is a very small problem with only 3 variables; you may even be able to solve it by hand! <\/span><\/div><h4  style = 'margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: 700; text-align: left; '><span>Real linear problems are difficult to solve<\/span><\/h4><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Real problems tend to be much larger with many thousands of variables and constraints. In addition, there is a class of linear programs called <\/span><a href = \"https:\/\/uk.mathworks.com\/help\/optim\/ug\/intlinprog.html\"><span>Mixed Integer Linear Programs (MILP) <\/span><\/a><span>which have the extra constraint that some or all entries of the solution vector be integers.  <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Solving them can be very difficult! Indeed, there is a <\/span><a href = \"https:\/\/miplib.zib.de\/index.html\" target=\"_blank\"><span>collection called MIPLIB 2017<\/span><\/a><span> (to which MathWorks is a contributor) that contains problems so hard that even the best solvers in the world can't tackle them. To get your head around this, consider that an <\/span><span style=' font-weight: bold;'>easy<\/span><span> problem in the MIPLIB 2017 collection is defined as something that can be solved in less than an hour on a machine with 16 cores. That's a lot of compute for something that's defined as 'easy'.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Let's take a look at one such 'easy' problem from MIPLIB 2017 using the latest version of MATLAB, R2024b. The <\/span><a href = \"https:\/\/miplib.zib.de\/instance_details_acc-tight5.html\" target=\"_blank\"><span>problem is called acc-tight5<\/span><\/a><span> and is a basketball scheduling instance that's stored in the <\/span><a href = \"https:\/\/en.wikipedia.org\/wiki\/MPS_(format)\" target=\"_blank\"><span>MPS file format<\/span><\/a><span>.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span style=\"color: rgb(0, 128, 19);\">% Download and unzip the MPS file containing the problem<\/span><\/span><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >gunzip(<\/span><span style=\"color: rgb(167, 9, 245);\">\"https:\/\/miplib.zib.de\/WebData\/instances\/acc-tight5.mps.gz\"<\/span><span >)<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >problem = mpsread(<\/span><span style=\"color: rgb(167, 9, 245);\">\"acc-tight5.mps\"<\/span><span >)<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement\" uid=\"68F11BD2\" prevent-scroll=\"true\" data-testid=\"output_3\" tabindex=\"-1\" style=\"width: 1145px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\" textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"17\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">Running HiGHS 1.7.0: Copyright (c) 2024 HiGHS under MIT licence terms<\/div><\/div><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsVariableStringElement\" uid=\"4EAB343F\" prevent-scroll=\"true\" data-testid=\"output_4\" tabindex=\"-1\" style=\"width: 1145px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"textElement eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"167\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"variable output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><span class=\"variableNameElement\" style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">problem = <span class=\"headerElement\" style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">struct with fields:<\/span><\/span><\/div><div style=\"white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">          f: [1339\u00d71 double]\n      Aineq: [2775\u00d71339 double]\n      bineq: [2775\u00d71 double]\n        Aeq: [277\u00d71339 double]\n        beq: [277\u00d71 double]\n         lb: [1339\u00d71 double]\n         ub: [1339\u00d71 double]\n     intcon: [1339\u00d71 double]\n     solver: 'intlinprog'\n    options: [1\u00d71 optim.options.Intlinprog]\n<\/div><\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>The <\/span><a href = \"https:\/\/uk.mathworks.com\/help\/optim\/ug\/mpsread.html\"><span style=' font-family: monospace;'>mpsread<\/span><\/a><span> function creates a structure that is suitable for the solver-based approach to solving linear programs and also tells us which solver we should use: <\/span><a href = \"https:\/\/uk.mathworks.com\/help\/optim\/ug\/intlinprog.html\"><span style=' font-family: monospace;'>intlinprog<\/span><\/a><span>, since this is a mixed integer problem. <\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 4px 4px 0px 0px; padding: 6px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >acc_tight5_solution = intlinprog(problem);<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement scrollableOutput\" uid=\"815541F3\" prevent-scroll=\"true\" data-testid=\"output_5\" tabindex=\"-1\" style=\"width: 1145px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"textElement eoOutputContent scrollArea\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"977\" data-hashorizontaloverflow=\"true\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 261px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">Running HiGHS 1.7.0: Copyright (c) 2024 HiGHS under MIT licence terms\nCoefficient ranges:\n  Matrix [1e+00, 1e+00]\n  Cost   [1e+00, 1e+00]\n  Bound  [1e+00, 1e+00]\n  RHS    [1e+00, 4e+00]\nPresolving model\n3041 rows, 1332 cols, 16057 nonzeros  0s\n2454 rows, 1007 cols, 12389 nonzeros  0s\n2337 rows, 988 cols, 12345 nonzeros  0s\nObjective function is integral with scale 1\n\nSolving MIP model with:\n   2337 rows\n   988 cols (988 binary, 0 integer, 0 implied int., 0 continuous)\n   12345 nonzeros\n\n        Nodes      |    B&amp;B Tree     |            Objective Bounds              |  Dynamic Constraints |       Work      \n     Proc. InQueue |  Leaves   Expl. | BestBound       BestSol              Gap |   Cuts   InLp Confl. | LpIters     Time\n\n         0       0         0   0.00%   0               inf                  inf        0      0      0         0     0.2s\n         0       0         0   0.00%   0               inf                  inf        0      0      3      1635     0.4s\n         0       0         0   0.00%   0               inf                  inf      381     10    385     75371    13.6s\n\n0.7% inactive integer columns, restarting\nModel after restart has 2312 rows, 981 cols (981 bin., 0 int., 0 impl., 0 cont.), and 12154 nonzeros\n\n         0       0         0   0.00%   0               inf                  inf       10      0      0     75371    13.6s\n         0       0         0   0.00%   0               inf                  inf       10      6      8     75740    13.7s\n         0       0         0   0.00%   0               inf                  inf      384     19    286    135490    25.0s\n        59       8        22   0.87%   0               inf                  inf      425     19   1006    175042    30.3s\n       120      17        50   9.79%   0               inf                  inf      501     22   2020    212149    35.4s\n       176      19        74  11.07%   0               inf                  inf      564     26   2705    251875    40.6s\n       246      26       104  12.06%   0               inf                  inf      619     28   3560    289301    45.7s\n       292      29       122  13.13%   0               inf                  inf      768     29   4472    327492    50.9s\n B     311      29       131  13.37%   0               1                100.00%      785     29   4949    339919    52.7s\n       432      49       173  22.12%   0               1                100.00%      860      9   5728    374411    57.7s\n       503      52       207  32.03%   0               1                100.00%      890     16   6425    407007    62.7s\n       578      54       239  35.77%   0               1                100.00%     1361     14   7012    439704    67.8s\n       682      77       278  36.29%   0               1                100.00%     1279     17   7776    473939    72.9s\n       763      73       315  39.62%   0               1                100.00%     1597     18   8667    505596    78.0s\n       858      77       359  40.62%   0               1                100.00%     1702     23   9529    538912    83.1s\n T     890       0       373 100.00%   0               0                  0.00%     1720     27   9794    546054    84.4s\n\nSolving report\n  Status            Optimal\n  Primal bound      0\n  Dual bound        0\n  Gap               0% (tolerance: 0.01%)\n  Solution status   feasible\n                    0 (objective)\n                    0 (bound viol.)\n                    2.78645351635e-13 (int. viol.)\n                    0 (row viol.)\n  Timing            84.40 (total)\n                    0.23 (presolve)\n                    0.00 (postsolve)\n  Nodes             891\n  LP iterations     546171 (total)\n                    49690 (strong br.)\n                    9159 (separation)\n                    129933 (heuristics)\n\nOptimal solution found.\n\nIntlinprog stopped because the objective value is within a gap tolerance of the optimal value, options.AbsoluteGapTolerance = 1e-06. The intcon variables are integer within tolerance, options.ConstraintTolerance = 1e-06.<\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>We can see that <\/span><span style=' font-family: monospace;'>intlinprog<\/span><span> took 84.4 seconds to solve this problem and that, like the <\/span><span style=' font-family: monospace;'>mpsread<\/span><span> function, it uses something called HiGHS. We switched to using the HiGHS library by default in MATLAB R2024a for both <\/span><span style=' font-family: monospace;'>linprog<\/span><span> and <\/span><span style=' font-family: monospace;'>intlinprog, <\/span><span>while <\/span><span style=' font-family: monospace;'>mpsread<\/span><span> started using it in R2024b. You can get a clue as to why we switched to HiGHS by asking <\/span><span style=' font-family: monospace;'>intlinprog<\/span><span> to use its original solver, the one that was used by default until recently.<\/span><\/div><div style=\"background-color: #F5F5F5; margin: 10px 15px 10px 0; display: inline-block\"><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 4px 4px 0px 0px; padding: 6px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >options = optimoptions(<\/span><span style=\"color: rgb(167, 9, 245);\">\"intlinprog\"<\/span><span >,Algorithm=<\/span><span style=\"color: rgb(167, 9, 245);\">\"legacy\"<\/span><span >);<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsWarningElement\" uid=\"21102D34\" prevent-scroll=\"true\" data-testid=\"output_6\" tabindex=\"-1\" style=\"width: 1145px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"diagnosticMessage-wrapper diagnosticMessage-warningType eoOutputContent\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"19\" data-hashorizontaloverflow=\"false\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"warning output \" style=\"max-height: 261px; white-space: normal; font-style: normal; color: rgb(179, 98, 5); font-size: 12px;\"><div class=\"diagnosticMessage-messagePart\" style=\"white-space: pre-wrap; font-style: normal; color: rgb(179, 98, 5); font-size: 12px;\">Warning: Option \"Algorithm\" will be removed in a future release. Then intlinprog will use its current default algorithm, \"highs\".<\/div><div class=\"diagnosticMessage-stackPart\" style=\"white-space: pre; font-style: normal; color: rgb(179, 98, 5); font-size: 12px;\"><\/div><\/div><\/div><\/div><\/div><div class=\"inlineWrapper\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >problem.options = options;<\/span><\/span><\/div><\/div><div class=\"inlineWrapper outputs\"><div  style = 'border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace, Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; '><span style=\"white-space: pre\"><span >acc_tight5_solution_old = intlinprog(problem);<\/span><\/span><\/div><div  style = 'color: rgb(33, 33, 33); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; '><div class=\"inlineElement eoOutputWrapper disableDefaultGestureHandling embeddedOutputsTextElement scrollableOutput\" uid=\"5FE15D95\" prevent-scroll=\"true\" data-testid=\"output_7\" tabindex=\"-1\" style=\"width: 1145px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\"><div class=\"textElement eoOutputContent scrollArea\" tabindex=\"-1\" data-previous-available-width=\"1108\" data-previous-scroll-height=\"283\" data-hashorizontaloverflow=\"true\" role=\"article\" aria-roledescription=\"Use Browse Mode to explore \" aria-description=\"text output \" style=\"max-height: 294px; white-space: pre; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;\">LP:                Optimal objective value is 0.000000.                                             \n\nCut Generation:    Applied 81 clique cuts,                                                          \n                   and 3 zero-half cuts.                                                            \n                   Lower bound is 0.000000.                                                         \n\nCut Generation:    Applied 16 clique cuts,                                                          \n                   and 2 zero-half cuts.                                                            \n                   Lower bound is 0.000000.                                                         \n\nBranch and Bound:\n\n   nodes     total   num int        integer       relative                                          \nexplored  time (s)  solution           fval        gap (%)                                         \n    7202   1617.89         1   0.000000e+00   0.000000e+00                                          \n\nOptimal solution found.\n\nIntlinprog stopped because the objective value is within a gap tolerance of the optimal value, options.AbsoluteGapTolerance = 0. The intcon variables are integer within tolerance, options.IntegerTolerance = 1e-05.<\/div><\/div><\/div><\/div><\/div><div  style = 'margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>At 1617.9 seconds, the legacy algorithm took rather longer, 20x longer in fact. Now such amazing speed-ups won't always be the case. Sometimes, HiGHS is only a little faster, other times it can even be slower. When considering many problems the transition was worth making.  <\/span><\/div><h4  style = 'margin: 3px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: 700; text-align: left; '><span style=' font-weight: bold;'>What is HiGHS?<\/span><\/h4><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><a href = \"https:\/\/highs.dev\" target=\"_blank\"><span>HiGHS<\/span><\/a><span> is high performance software for solving large-scale sparse linear programming (LP), mixed-integer programming (MIP) and quadratic programming (QP) models. It is developed in C++11, with interfaces to several other languages.The name HiGHS comes from the initials of its original developers.<\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>Back in June 2024 I had the pleasure of attending the first ever<\/span><a href = \"https:\/\/workshop24.highs.dev\/home\" target=\"_blank\"><span> HiGHS workshop<\/span><\/a><span> at The University of Edinburgh of which MathWorks was one of the sponsors and where MathWorks developer, Franz Wesselmann, was one of the speakers. While there I met <\/span><a href = \"https:\/\/www.linkedin.com\/in\/julian-hall-3123a21a\/?originalSubdomain=uk\" target=\"_blank\"><span>Julian Hall<\/span><\/a><span> and <\/span><a href = \"https:\/\/www.linkedin.com\/in\/ivet-galabova\/\" target=\"_blank\"><span>Ivet Galabova<\/span><\/a><span> who are responsible for three of the initials in HiGHS and are the current maintainers and leaders of the project. MathWorks has been working closely with them for a while now as we worked towards <\/span><a href = \"https:\/\/www.maths.ed.ac.uk\/school-of-mathematics\/news?nid=1062\" target=\"_blank\"><span>incorporating HiGHS into MATLAB<\/span><\/a><span> via Optimization Toolbox. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><img class = \"imageNode\" src = \"http:\/\/blogs.mathworks.com\/matlab\/files\/2024\/11\/Highs24b_1.png\" width = \"732\" height = \"528\" alt = \"\" style = \"vertical-align: baseline; width: 732px; height: 528px;\"><\/img><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>One of the contributions that MathWorks makes back into the HiGHS project is to work directly on the code. MathWorker Franz Wesselmann is now in the<\/span><a href = \"https:\/\/github.com\/ERGO-Code\/HiGHS\/graphs\/contributors\" target=\"_blank\"><span> top 5 contibutors to the project<\/span><\/a><span> in terms of numbers of commits. <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><a href = \"https:\/\/github.com\/ERGO-Code\/HiGHS\/graphs\/contributors\" target=\"_blank\"><img class = \"imageNode\" src = \"http:\/\/blogs.mathworks.com\/matlab\/files\/2024\/11\/Highs24b_2.png\" width = \"710\" height = \"848\" alt = \"\" style = \"vertical-align: baseline; width: 710px; height: 848px;\"><\/img><\/a><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>This is a fruitful collaboration for all concerned and you can expect more HiGHS-related functionality coming to MATLAB in the future. Thanks to everyone in the HiGHS team for welcoming us to their community. <\/span><\/div><h2  style = 'margin: 20px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left; '><span>References<\/span><\/h2><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><span>[1] <\/span><a href = \"https:\/\/ftp.mcs.anl.gov\/pub\/tech_reports\/reports\/P602.pdf\" target=\"_blank\"><span>The Diet Problem: A WWW-based Interactive Case Study in Linear Programming<\/span><\/a><span>. Joseph Czyzyk and Timothy J. Wisniewski <\/span><\/div><div  style = 'margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; '><\/div>\n<\/div><script type=\"text\/javascript\">var css = '.eoOutputWrapper { width: calc(90vw - 10px) !important; } \/* Styling that is common to warnings and errors is in diagnosticOutput.css *\/.embeddedOutputsErrorElement {    min-height: 18px;    max-height: 550px;} .embeddedOutputsErrorElement .diagnosticMessage-errorType {    overflow: auto;} .embeddedOutputsErrorElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} .embeddedOutputsErrorElement.activeOutput .eoOutputContent button {    user-select: none;    -webkit-user-select: none;} .embeddedOutputsErrorElement .eoOutputContent ::selection {} .embeddedOutputsErrorElement.inlineElement {} .embeddedOutputsErrorElement.rightPaneElement {} \/* Styling that is common to warnings and errors is in diagnosticOutput.css *\/.embeddedOutputsWarningElement {    min-height: 18px;    max-height: 550px;} .embeddedOutputsWarningElement .diagnosticMessage-warningType {    overflow: auto;} .embeddedOutputsWarningElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} .embeddedOutputsWarningElement .eoOutputContent ::selection {} .embeddedOutputsWarningElement.inlineElement {} .embeddedOutputsWarningElement.rightPaneElement {} \/* Copyright 2015-2023 The MathWorks, Inc. *\/\/* In this file, styles are not scoped to rtcContainer since they could be in the Dojo Tooltip *\/.diagnosticMessage-wrapper {    font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;    font-size: 12px;} .diagnosticMessage-wrapper.diagnosticMessage-warningType {    \/*This fallback value will be used for appdesigner warnings*\/    color: var(--rtc-warning-output-color, var(--mw-color-matlabWarning));} .diagnosticMessage-wrapper.diagnosticMessage-warningType a {    \/*This fallback value will be used for appdesigner warnings*\/    color: var(--rtc-warning-output-color, var(--mw-color-matlabWarning));    text-decoration: underline;} .rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-warningType,.rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-warningType a {    color: var(--mw-color-matlabWarning) !important;} .diagnosticMessage-wrapper.diagnosticMessage-errorType {    \/*This fallback value will be used in appdesigner error tooltip text*\/    color: var(--rtc-error-output-color, var(--mw-color-matlabErrors));} .diagnosticMessage-wrapper.diagnosticMessage-errorType a {    \/*This fallback value will be used in appdesigner error tooltip text*\/    color: var(--rtc-error-output-color, var(--mw-color-matlabErrors));    text-decoration: underline;} .rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-errorType,.rtcThemeDefaultOverride .diagnosticMessage-wrapper.diagnosticMessage-errorType a {    color: var(--mw-color-matlabErrors) !important;} .diagnosticMessage-wrapper .diagnosticMessage-messagePart,.diagnosticMessage-wrapper .diagnosticMessage-causePart {    white-space: pre-wrap;} .diagnosticMessage-wrapper .diagnosticMessage-stackPart {    white-space: pre;} .embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {    white-space: pre;    word-wrap:  initial;    min-height: 18px;    max-height: 550px;} .embeddedOutputsTextElement .textElement,.embeddedOutputsVariableStringElement .textElement {    overflow: auto;} .embeddedOutputsTextElement.activeOutput .eoOutputContent,.embeddedOutputsVariableStringElement.activeOutput .eoOutputContent {    user-select: text;    -webkit-user-select: text;} \/*embeddedOutputsTextElement has a different dom structure than embeddedOutputsVariableStringElement.Unlike variableString, the text output has both TEXT nodes and elements as children. Hence we needa selector for each.*\/.embeddedOutputsTextElement .eoOutputContent::selection,.embeddedOutputsTextElement .eoOutputContent ::selection,.embeddedOutputsVariableStringElement .eoOutputContent ::selection {} .textElement,.rtcDataTipElement .textElement {    padding-top: 2px;} .embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {} .inlineElement .textElement {} .embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {    min-height: 16px;} .rightPaneElement .textElement {    padding-top: 2px;    padding-left: 9px;}'; var head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); style.type = 'text\/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); }<\/script>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/matlab\/files\/2024\/11\/Highs24b_1.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>What is linear programming?Linear programming (LP) is a mathematical method used to determine the best possible outcome (such as maximum profit or lowest cost) in a mathematical model whose... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/matlab\/2024\/11\/04\/linear-programming-the-highs-optimization-library-and-matlab\/\">read more >><\/a><\/p>","protected":false},"author":176,"featured_media":2849,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,64,50,14],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts\/2834"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/users\/176"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/comments?post=2834"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts\/2834\/revisions"}],"predecessor-version":[{"id":2858,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/posts\/2834\/revisions\/2858"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/media\/2849"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/media?parent=2834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/categories?post=2834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/matlab\/wp-json\/wp\/v2\/tags?post=2834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}