<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Haroldo,<br>
      <br>
      CMPL doesn't have any string functions beside concatenation. You
      cannot address a character within a string by indexing it.<br>
      <br>
      If you want to address the single characters you must define it as
      single array elements. For instance:<br>
      <br>
      VInteractions[,] := ( ("a", "u"), ("c", "g"), ("g", "c"), ("g",
      "u"), ("u", "g"), ("u", "a") );<br>
      <br>
      You can then query it like:<br>
      <br>
      s[i] = VInteractions[k,1] && s[j] = VInteractions[k,2]<br>
      <br>
      Thomas Schleiff<br>
      <br>
      <br>
      <br>
      Am 22.11.2017 um 00:48 schrieb Haroldo Santos:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACO7Fp1K+cnQgy2JHdnOd4q3iTVB6iwTo9DZbEz4c5Sqg9-KWA@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small">Thanks
          a lot !!!</div>
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small">Now
          I'm having a problem using a vector of strings.</div>
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small"><br>
        </div>
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small">Apparently
          querying a vector of strings using</div>
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small">  <b>s[i]
            = VInteractions[k][1]  <br>
          </b></div>
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small">is not
          valid. I'm getting an error for the part in bold in the model.
          Could you tell what I'm doing wrong ?<b><br>
          </b></div>
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small"><br>
        </div>
        <div class="gmail_default"
          style="font-family:monospace,monospace;font-size:small">
          <p style="margin:0px;text-indent:0px">parameters:</p>
          <p style="margin:0px;text-indent:0px">  s[] := ("u", "c", "c",
            "a", "g", "c", "a", "g", "g", "a", "a", "a", "g", "c");</p>
          <p style="margin:0px;text-indent:0px">   Interactions := set(
            "au", "cg", "gc", "gu", "ug", "ua" );</p>
          <p style="margin:0px;text-indent:0px">   VInteractions[] := (
            "au", "cg", "gc", "gu", "ug", "ua" );</p>
          <p style="margin:0px;text-indent:0px">   # weights for
            different interactions</p>
          <p style="margin:0px;text-indent:0px">  
            e[1..len(Interactions),1..len(Interactions)] :=</p>
          <p style="margin:0px;text-indent:0px">    ( ( -1.1, -2.1,
            -2.2, -1.4, -0.9, -0.6 ),  </p>
          <p style="margin:0px;text-indent:0px">     ( -2.1, -2.4, -3.3,
            -2.1, -2.1, -1.4 ),</p>
          <p style="margin:0px;text-indent:0px">     ( -2.2, -3.3, -3.4,
            -2.5, -2.4, -1.5 ),</p>
          <p style="margin:0px;text-indent:0px">     ( -1.4, -2.1, -2.5,
            -1.3, -1.3, -0.5 ),</p>
          <p style="margin:0px;text-indent:0px">     ( -0.9, -2.1, -2.4,
            -1.3, -1.3, -1.0 ),</p>
          <p style="margin:0px;text-indent:0px">      ( -0.6, -1.4,
            -1.5, -0.5, -1.0, -0.3 ) );</p>
          <p style="margin:0px;text-indent:0px"> # penalty for
            pseudoknots, since there types</p>
          <p style="margin:0px;text-indent:0px"> # of interactions are
            less common in nature</p>
          <p style="margin:0px;text-indent:0px">   sigma := 0.55;</p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
          <p style="margin:0px;text-indent:0px">variables:</p>
          <p style="margin:0px;text-indent:0px"> # x[i,j]</p>
          <p style="margin:0px;text-indent:0px">    { i in
            1..count(s[])-1,j in 2..count(s[]), i<j &&
            s[i]+s[j] << Interactions : x[i,j] : binary; }</p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
          <p style="margin:0px;text-indent:0px"> # zx[i,j]</p>
          <p style="margin:0px;text-indent:0px"> { i in 1..count(s[])-3,
            j in 4..count(s[]), k in 1..len(Interactions), l in
            1..len(Interactions), </p>
          <p style="margin:0px;text-indent:0px"> j-i >= 3 </p>
          <p style="margin:0px;text-indent:0px"><b> && s[i] =
              VInteractions[k][1] && s[j] = VInteractions[k][2]
            </b></p>
          <b>
          </b>
          <p style="margin:0px;text-indent:0px"><b> </b>&&
            s[i+1] = VInteractions[l][1] && s[j-1] =
            VInteractions[k][1] : zx[i,j,k,l] : binary; }</p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
          <p style="margin:0px;text-indent:0px">objectives:</p>
          <p style="margin:0px;text-indent:0px"> maxInteractions: </p>
          <p style="margin:0px;text-indent:0px"> sum{ i in
            1..count(s[])-3, j in 4..count(s[]), k in
            1..count(Interations), l in 1..count(Interations), j-i >=
            3 </p>
          <p style="margin:0px;text-indent:0px"> && s[i]+s[j]
            << Interactions && s[i+1]+s[j-1] <<
            Interactions : e[k,l] * zx[i,j,k,l] } -> max;</p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
          <p style="margin:0px;text-indent:0px">constraints:</p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
          <p style="margin:0px;text-indent:0px"><br>
          </p>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Mon, Nov 20, 2017 at 8:44 AM, <span
              dir="ltr"><<a href="mailto:mike.steglich@th-wildau.de"
                target="_blank" moz-do-not-send="true">mike.steglich@th-wildau.de</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div lang="DE">
                <div class="gmail-m_-8304275115060761401WordSection1">
                  <p class="MsoNormal"><span>Hi Haroldo,</span></p>
                  <p class="MsoNormal"><span> </span></p>
                  <p class="MsoNormal"><span>Please use << to test
                      wheter an entry is an element of a set. Your
                      definition of the variables shout look like the
                      following expression:</span></p>
                  <p class="MsoNormal"><span> </span></p>
                  <p class="MsoNormal">variables:</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; }</p>
                  <p class="MsoNormal"> </p>
                  <p class="MsoNormal"><span> </span></p>
                  <p class="MsoNormal"><span>Thanks,</span></p>
                  <p class="MsoNormal"><span> </span></p>
                  <p class="MsoNormal"><span>Mike</span></p>
                  <p class="MsoNormal"><a
                      name="m_-8304275115060761401__MailEndCompose"
                      moz-do-not-send="true"><span> </span></a></p>
                  <span></span>
                  <p class="MsoNormal"><b>Von:</b> Cmpl [mailto:<a
                      href="mailto:cmpl-bounces@coin-or.org"
                      target="_blank" moz-do-not-send="true">cmpl-bounces@coin-or.<wbr>org</a>]
                    <b>Im Auftrag von </b>Haroldo Santos<br>
                    <b>Gesendet:</b> Sonntag, 19. November 2017 20:22<br>
                    <b>An:</b> <a href="mailto:cmpl@list.coin-or.org"
                      target="_blank" moz-do-not-send="true">cmpl@list.coin-or.org</a><br>
                    <b>Betreff:</b> [Cmpl] Conditional creation of
                    variables</p>
                  <div>
                    <div class="gmail-h5">
                      <p class="MsoNormal"> </p>
                      <div>
                        <div>
                          <p class="MsoNormal"><span
                              style="font-size:12pt;font-family:"Courier
                              New"">Hi,</span></p>
                        </div>
                        <div>
                          <p class="MsoNormal"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                        </div>
                        <div>
                          <p class="MsoNormal"><span
                              style="font-size:12pt;font-family:"Courier
                              New"">I'm working with a
                              computational biology problem where the
                              input is a string.</span></p>
                        </div>
                        <div>
                          <p class="MsoNormal"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                        </div>
                        <div>
                          <p class="MsoNormal"><span
                              style="font-size:12pt;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.</span></p>
                        </div>
                        <div>
                          <p class="MsoNormal"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                        </div>
                        <div>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New";color:blue">parameters:</span><span
style="font-size:12pt;font-family:"Courier New""></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;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:12pt;font-family:"Courier
                              New""></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New";color:blue">    interactions :=
                              set( "au", "cg", "gc", "gu", "ug", "ua" );</span><span
style="font-size:12pt;font-family:"Courier New""></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New";color:blue">variables:</span><span
style="font-size:12pt;font-family:"Courier New""></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;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:12pt;font-family:"Courier
                              New""></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;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></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New";color:black">Could someone tell
                              me what is wrong ?</span><span
                              style="font-size:12pt;font-family:"Courier
                              New""></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New";color:black">Thanks  </span><span
style="font-size:12pt;font-family:"Courier New""></span></p>
                          <p style="margin:0cm 0cm 0.0001pt"><span
                              style="font-size:12pt;font-family:"Courier
                              New""> </span></p>
                        </div>
                        <p class="MsoNormal"><br>
                          -- </p>
                        <div>
                          <div>
                            <div>
                              <p class="MsoNormal"><span
                                  style="font-family:"Courier
                                  New"">==============================<wbr>==============================<wbr>=<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"
                                    moz-do-not-send="true">iceb.ufop.br</a><br>
                                  home/research page: <a
                                    href="http://www.decom.ufop.br/haroldo/"
                                    target="_blank"
                                    moz-do-not-send="true">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></p>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <br>
          -- <br>
          <div class="gmail_signature">
            <div dir="ltr">
              <div><span style="font-family:monospace,monospace">=============================================================<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" moz-do-not-send="true">iceb.ufop.br</a><br>
                  home/research page: <a
                    href="http://www.decom.ufop.br/haroldo/"
                    target="_blank" moz-do-not-send="true">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"<br>
                </span></div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Cmpl mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Cmpl@list.coin-or.org">Cmpl@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="https://list.coin-or.org/mailman/listinfo/cmpl">https://list.coin-or.org/mailman/listinfo/cmpl</a></pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>