Re: diet problem disregarding cost

Bjørnar Ness <[email protected]> Wed, 20 Mar 2024 15:25:58 +0100
Newsgroups gmane.comp.gnu.glpk
Message-ID <CAJO99Tn1CM3R3YFy0woP6Dg8+_CZCi9dYjCXeP78GHzB9qyHyQ@mail.gmail.com>
--00000000000046f5c30614185f40
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks a lot. But do you have a small example I can continue on? It
important that the values are not absolute, but fractions of the needed
quantities

ons. 20. mars 2024 kl. 15:21 skrev Meketon, Marc <
[email protected]>:

> In general, if you have variables rpos_i and rneg_i (the ith constraint),
> and you have:
>
>
>
> [linear equation i] =3D rpos_i =E2=80=93 rneg_i
>
>
>
> Then (rpos_i + rneg_i) is the absolute value
>
>
>
> If you then have
>
> rpos_i + rneg_i <=3D z
>
>
>
> z would be the maximum absolute value, and then you just minimize  z.
>
>
>
> *From:* [email protected]
> <[email protected]> *On Behalf Of =
*Du=C5=A1an
> Plav=C3=A1k
> *Sent:* Wednesday, March 20, 2024 7:02 AM
> *To:* Bj=C3=B8rnar Ness <[email protected]>
> *Cc:* [email protected]
> *Subject:* Re: diet problem disregarding cost
>
>
>
>
>
> *CAUTION:* This email originated outside the company. Do not click links
> or open attachments unless you are expecting them from the sender.
>
>
>
> Hi, feel free to send me an email. I did this ~ 9-10 years ago for our
> startup where we generate personalized nutrition plans for our clients
> using glpk.
>
>
>
> Basically you want to build bunch of inequalities and most probably you
> want to have more variables not only nutrients... Depend on your exact us=
e
> case.
>
>
>
> On Wed, Mar 20, 2024 at 4:34=E2=80=AFPM Bj=C3=B8rnar Ness <bjornar.ness@g=
mail.com>
> wrote:
>
> Can anyone point me to an diet problem example that tries to minimize
> max deviation in percentage for each nutrient, disregarding cost?
>
> --
> Bj(/)rnar
>
>
>
>
> --
>
> S pozdravom Du=C5=A1an Plav=C3=A1k
>
> ------------------------------
> This e-mail and any attachments may be confidential or legally privileged=
.
> If you received this message in error or are not the intended recipient,
> you should destroy the e-mail message and any attachments or copies, and
> you are prohibited from retaining, distributing, disclosing or using any
> information contained herein. Please inform us of the erroneous delivery =
by
> return e-mail. Thank you for your cooperation. For more information on ho=
w
> we use your personal data please see our Privacy Notice
> <https://www.oliverwyman.com/policies/privacy-notice.html>.
>


--=20
Bj(/)rnar

--00000000000046f5c30614185f40
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Thanks a lot. But do you have a small example I can c=
ontinue on? It important that the values are not absolute, but fractions of=
 the needed quantities</div></div><br><div class=3D"gmail_quote"><div dir=
=3D"ltr" class=3D"gmail_attr">ons. 20. mars 2024 kl. 15:21 skrev Meketon, M=
arc &lt;<a href=3D"mailto:[email protected]">Marc.Meketon@oliver=
wyman.com</a>&gt;:<br></div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x"><div class=3D"msg-5387924152580346089">





<div lang=3D"EN-US" style=3D"overflow-wrap: break-word;">
<div class=3D"m_-5387924152580346089WordSection1">
<p class=3D"MsoNormal">In general, if you have variables rpos_i and rneg_i =
(the ith constraint), and you have:<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">[linear equation i] =3D rpos_i =E2=80=93 rneg_i<u></=
u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">Then (rpos_i + rneg_i) is the absolute value<u></u><=
u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">If you then have <u></u><u></u></p>
<p class=3D"MsoNormal">rpos_i + rneg_i &lt;=3D z<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">z would be the maximum absolute value, and then you =
just minimize =C2=A0z.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<div style=3D"border-width:1pt medium medium;border-style:solid none none;b=
order-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"=
>
<p class=3D"MsoNormal"><b>From:</b> help-glpk-bounces+marc.meketon=3D<a hre=
f=3D"mailto:[email protected]" target=3D"_blank">oliverwyman.com@gnu.=
org</a> &lt;help-glpk-bounces+marc.meketon=3D<a href=3D"mailto:oliverwyman.=
[email protected]" target=3D"_blank">[email protected]</a>&gt;
<b>On Behalf Of </b>Du=C5=A1an Plav=C3=A1k<br>
<b>Sent:</b> Wednesday, March 20, 2024 7:02 AM<br>
<b>To:</b> Bj=C3=B8rnar Ness &lt;<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&gt;<br>
<b>Cc:</b> <a href=3D"mailto:[email protected]" target=3D"_blank">help-glpk=
@gnu.org</a><br>
<b>Subject:</b> Re: diet problem disregarding cost<u></u><u></u></p>
</div>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<table border=3D"0" cellspacing=3D"3" cellpadding=3D"0">
<tbody>
<tr>
<td style=3D"border:1pt solid rgb(201,132,20);background:rgb(255,244,202);p=
adding:3pt 5pt">
<p class=3D"MsoNormal"><b><span style=3D"font-size:10pt;color:rgb(201,132,2=
0)">CAUTION:</span></b><span style=3D"font-size:10pt;color:black"> This ema=
il originated outside the company. Do not click links or open attachments u=
nless you are expecting them from the sender.<u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<div>
<div>
<p class=3D"MsoNormal">Hi, feel free to send me an email. I did this ~ 9-10=
 years ago for our startup where we generate personalized nutrition plans f=
or our clients using glpk.
<u></u><u></u></p>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Basically you want to build bunch of inequalities an=
d most probably you want to have more variables not only nutrients... Depen=
d on your exact use case.<u></u><u></u></p>
</div>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<div>
<p class=3D"MsoNormal">On Wed, Mar 20, 2024 at 4:34=E2=80=AFPM Bj=C3=B8rnar=
 Ness &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">bjorn=
[email protected]</a>&gt; wrote:<u></u><u></u></p>
</div>
<blockquote style=3D"border-width:medium medium medium 1pt;border-style:non=
e none none solid;border-color:currentcolor currentcolor currentcolor rgb(2=
04,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class=3D"MsoNormal" style=3D"margin-bottom:12pt">Can anyone point me to =
an diet problem example that tries to minimize<br>
max deviation in percentage for each nutrient, disregarding cost?<br>
<br>
-- <br>
Bj(/)rnar<u></u><u></u></p>
</blockquote>
</div>
<p class=3D"MsoNormal"><br clear=3D"all">
<u></u><u></u></p>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<p class=3D"MsoNormal"><span class=3D"m_-5387924152580346089gmailsignaturep=
refix">-- </span><u></u><u></u></p>
<div>
<p class=3D"MsoNormal">S pozdravom Du=C5=A1an Plav=C3=A1k<u></u><u></u></p>
</div>
</div>
</div>
<br>
<font size=3D"1" face=3D"Arial" color=3D"#999999">
<hr>
This e-mail and any attachments may be confidential or legally privileged. =
If you received this message in error or are not the intended recipient, yo=
u should destroy the e-mail message and any attachments or copies, and you =
are prohibited from retaining, distributing,
 disclosing or using any information contained herein. Please inform us of =
the erroneous delivery by return e-mail. Thank you for your cooperation. Fo=
r more information on how we use your personal data please see our
<a href=3D"https://www.oliverwyman.com/policies/privacy-notice.html" target=
=3D"_blank">Privacy Notice</a>.</font>
</div>

</div></blockquote></div><br clear=3D"all"><br><span class=3D"gmail_signatu=
re_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature">Bj(/)rn=
ar</div>

--00000000000046f5c30614185f40--