<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Hi Haroldo,<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Please use << to test wheter an entry is an element of a set. Your definition of the variables shout look like the following expression:<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal>variables:<o:p></o:p></p><p class=MsoNormal>{ i in 1..count(s[]),j in 1..count(s[]), i<j, s[i]+s[j] << interactions : x[i,j] : binary; }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Mike<o:p></o:p></span></p><p class=MsoNormal><a name="_MailEndCompose"><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></a></p><span style='mso-bookmark:_MailEndCompose'></span><p class=MsoNormal><b>Von:</b> Cmpl [mailto:cmpl-bounces@coin-or.org] <b>Im Auftrag von </b>Haroldo Santos<br><b>Gesendet:</b> Sonntag, 19. November 2017 20:22<br><b>An:</b> cmpl@list.coin-or.org<br><b>Betreff:</b> [Cmpl] Conditional creation of variables<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>Hi,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>I'm working with a computational biology problem where the input is a string.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>I would like to create variables for pairs of positions (i,j : i<j) in this string where a matching is possible.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p></div><div><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New";color:blue'>parameters:</span><span style='font-size:12.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New";color:blue'> s[] := ("u", "c", "c", "a", "g", "c", "a", "g", "g", "a", "a", "a", "g", "c");</span><span style='font-size:12.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New";color:blue'> interactions := set( "au", "cg", "gc", "gu", "ug", "ua" );</span><span style='font-size:12.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New";color:blue'>variables:</span><span style='font-size:12.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New";color:blue'> { i in 1..count(s[]),j in 1..count(s[]), i<j && s[i]+s[j] in interactions : x[i,j] : binary; }</span><span style='font-size:12.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'>The error appeared after I inserted <span style='color:blue'>&& s[i]+s[j] in interactions .</span><span style='color:black'> The intent of this part was to limit the creation of these variables only for valid matches (specified in interactions).</span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New";color:black'>Could someone tell me what is wrong ?</span><span style='font-size:12.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New";color:black'>Thanks </span><span style='font-size:12.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p></div><p class=MsoNormal><br>-- <o:p></o:p></p><div><div><div><p class=MsoNormal><span style='font-family:"Courier New"'>=============================================================<br>Haroldo Gambini Santos<br>Computing Department<br>Universidade Federal de Ouro Preto - UFOP<br>email: haroldo [at ] <a href="http://iceb.ufop.br" target="_blank">iceb.ufop.br</a><br>home/research page: <a href="http://www.decom.ufop.br/haroldo/" target="_blank">www.decom.ufop.br/haroldo</a><br><br><br>It has long been an axiom of mine that the little things are infinitely<br>the most important.<br>-- Sir Arthur Conan Doyle, "A Case of Identity"</span><o:p></o:p></p></div></div></div></div></div></body></html>