<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML DIR=ltr><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"></HEAD><BODY>
<DIV id=idOWAReplyText10929 dir=ltr>
<DIV dir=ltr><FONT size=2>Hello,</FONT></DIV>
<DIV dir=ltr><FONT size=2>what can go wrong if I get a non-integer solution
to the following integer linear program :</FONT></DIV>
<DIV dir=ltr><FONT size=2></FONT> </DIV>
<DIV dir=ltr><FONT color=#008000 size=2>
<P>// initialize model for MPS</P></FONT><FONT size=2>
<P>modelForILP = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2>
ClpSimplex;</P>
<P></FONT><FONT color=#008000 size=2>//set columns</P></FONT><FONT size=2>
<P>modelForILP->resize(0,nrCol);</P>
<P></FONT><FONT color=#008000 size=2>// x-variables are binary and
</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// have coefficient weight[i][j] in the
objective </FONT><FONT size=2></P>
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2> (</FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> i=0;i<nrJournals-1;i++)</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2> for</FONT><FONT size=2>
(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2>
j=i+1;j<nrJournals;j++)</P>
<P> {</P>
<P> counter[i][j] = counterNrCol;</P>
<P> counterNrCol++;</P>
<P></FONT><FONT color=#008000 size=2><FONT
color=#000000> </FONT>//putting
(c[i][j]-c[j][i])*x[i][j]+ c[j][i] in the objective</P></FONT><FONT size=2>
<P>
modelForILP->setObjCoeff(counter[i][j],c[i][j]-c[j][i]);</P>
<P>
modelForILP->setColLower(counter[i][j],0.0);</P>
<P>
modelForILP->setColumnUpper(counter[i][j],1.0);</P>
<P>
modelForILP->setInteger(counter[i][j]);</FONT><FONT color=#008000
size=2></P></FONT><FONT size=2>
<P> }</P>
<P>}</P>
<P>modelForILP->setOptimizationDirection(1.0); </FONT><FONT color=#008000
size=2>//1.0 minimizing, -1.0 maximizing</P></FONT>
<P><FONT color=#008000 size=2>//add constraints</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// 0 <= x[i][j] + x[j][k] - x[i][k]
<= 1</P></FONT><FONT size=2>
<P>rowIndex = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2>[3];</P>
<P>rowValue = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2>[3];</P>
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2>
i=0;i<nrJournals-2;i++)</FONT><FONT color=#008000 size=2>//nrJournals-2 oder
nrJournals</P></FONT><FONT size=2>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2> for</FONT><FONT
size=2>(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2>
j=i+1;j<nrJournals;j++)</FONT><FONT color=#008000 size=2>//j=i+1 and
nrJournals-1 oder 0 and nrJournals</P></FONT><FONT size=2>
<P> {</P>
<P></FONT><FONT color=#0000ff size=2><FONT
color=#000000> </FONT>for</FONT><FONT
size=2>(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2>
k=j+1;k<nrJournals;k++)</FONT><FONT color=#008000 size=2>//k=j+1 oder
k=0</P></FONT><FONT size=2>
<P> {</P>
<P></P>
<P></FONT><FONT color=#0000ff size=2><FONT
color=#000000>
</FONT>if</FONT><FONT size=2>(i!=j && j<k && k!=i)</P>
<P> {</P>
<P>
rowIndex[0] = counter[i][j];</P>
<P>
rowIndex[1] = counter[j][k];</P>
<P>
rowIndex[2] = counter[i][k];</P>
<P>
rowValue[0] = 1;</P>
<P>
rowValue[1] = 1;</P>
<P>
rowValue[2] = -1;</P>
<P>
modelForILP->addRow(3,rowIndex,rowValue,0.0,1.0);</P>
<P> } </P>
<P> }</P>
<P> }</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>delete</FONT><FONT size=2> []rowIndex;</P>
<P></FONT><FONT color=#0000ff size=2>delete</FONT><FONT size=2>
[]rowValue;</P></FONT></DIV>
<DIV dir=ltr><FONT size=2></FONT> </DIV>
<DIV dir=ltr><FONT size=2>and then depending on the situation, add the following
type of contraints, where temp4 = 0 or 1</FONT></DIV>
<DIV dir=ltr><FONT size=2></FONT> </DIV>
<DIV dir=ltr><FONT size=2><FONT size=2>
<P>rowIndex = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2>[1];</P>
<P>rowValue = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2>[1];</P>
<P>rowIndex[0] = variable; </FONT><FONT color=#008000 size=2>//column-number,
i.e. the variable that has to be fixed</P></FONT><FONT size=2>
<P>rowValue[0] = 1;</P>
<P>modelForILP->addRow(1,rowIndex,rowValue,temp4,temp4);</P></FONT><FONT
size=2>
<P></FONT><FONT color=#0000ff size=2>delete</FONT><FONT size=2> []rowIndex;</P>
<P></FONT><FONT color=#0000ff size=2>delete</FONT><FONT size=2>
[]rowValue;</P></FONT></FONT></DIV>
<DIV dir=ltr><FONT size=2></FONT> </DIV>
<DIV dir=ltr><FONT size=2>I'd be very happy if anyone of you has an
idea!!!</FONT></DIV>
<DIV dir=ltr><FONT size=2>kind regards</FONT></DIV>
<DIV dir=ltr><FONT size=2>Kirsten</FONT></DIV></DIV></BODY></HTML>