<div> </div>
<div>Thanks Tim, that worked. </div>
<div> </div>
<div>For the benefit of those who are reading this thread in future: you must run the following three commands all over again anytime you make changes in source code:</div>
<div> </div>
<div>>> make<br>>> make test</div>
<div>>> make install</div>
<div> </div>
<div>this would reinstall the affected libraries...<br> </div>
<div>Once again Tim, this was really great help.</div>
<div> </div>
<div>regards,</div>
<div>vishy</div>
<div> </div>
<div> </div>
<div><span class="gmail_quote">On 12/20/06, <b class="gmail_sendername">Tim Hultberg</b> <<a href="mailto:Tim.Hultberg@eumetsat.int">Tim.Hultberg@eumetsat.int</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Vishy,<br><br>a) you probably want to use: such_that(N < N.size()-1) (since N<br>implicitly counts from zero)
<br><br>b) the bad news is that this wont work either with the current version.<br>(it used to though) To correct it go to MP_constraint.cpp<br>and find the lines:<br> left->generate(<br>S1(I1)*S2(I2)*S3(I3)*S4(I4)*S5(I5).such_that(B),v,f,
1.0);<br> right->generate(<br>S1(I1)*S2(I2)*S3(I3)*S4(I4)*S5(I5).such_that(B),v,f,-1.0);<br>and change them to:<br> left->generate(<br>(S1(I1)*S2(I2)*S3(I3)*S4(I4)*S5(I5)).such_that(B),v,f,1.0);<br> right->generate(
<br>(S1(I1)*S2(I2)*S3(I3)*S4(I4)*S5(I5)).such_that(B),v,f,-1.0);<br>I will correct it in the next release. Sorry for the inconvenience.<br><br>Let me know if you get any more problems with this.<br><br>Cheesr, Tim<br><br>
<br>Tim Hultberg<br><br>>>> "Vishy Jeet" <<a href="mailto:vishv.jeet@gmail.com">vishv.jeet@gmail.com</a>> 12/19/06 8:53 PM >>><br>I have written the following small prograg to solve GAP on size (3, 10)
<br><br> 1 // $Id$<br> 2 #include "flopc.hpp"<br> 3 using namespace flopc;<br> 4 #include "OsiCbcSolverInterface.hpp"<br> 5<br> 6 /* Generalized Assignment Problem */<br> 7<br>
8 class Gap : public MP_model {<br> 9 public:<br> 10 MP_set M,N;<br> 11 MP_data c;<br> 12 MP_data a;<br> 13 MP_data b;<br> 14 MP_variable x;<br> 15 MP_constraint cap, feas;<br> 16
<br> 17 Gap(int numM, int numN) : MP_model(new OsiCbcSolverInterface),<br> 18 M(numM), N(numN),<br> 19 c(M,N), a(M,N), b(M),<br> 20 x(M,N),<br> 21 cap(M), feas(N)<br> 22 {<br> 23 x.binary
();<br> 24 cap(M) = sum(N, a(M,N)*x(M,N)) <= b(M);<br> 25 feas(N).*such_that(N < N.size())* = sum(M, x(M,N)) == 1;<br> 26 add(cap); add(feas);<br> 27 setObjective( sum(M*N, c(M,N)*x(M,N)));
<br> 28 }<br> 29 };<br> 30<br> 31 int main() {<br> 32 double cost[3][11] = {{47,16,27,21,25,12,55,31,40,40,1000},<br> 33 {45,18,56,33,36,46,11,17,31,50,1000},<br> 34 {50,23,22,59,31,35,40,41,40,11,1000}};
<br> 35<br> 36 double req[3][11] = {{24,12,8,12,16,14,13,15,23,5,100},<br> 37 {7,17,8,5,6,19,20,7,22,9,100},<br> 38 {23,18,14,8,18,23,19,11,15,11,100}};<br>
39<br> 40 double capc[3] = {37,32,42};<br> 41<br> 42 Gap instance(3,11);<br> 43<br> 44 instance.c.value(&cost[0][0]);<br> 45 instance.a.value(&req[0][0]);<br> 46 instance.b.value
(&capc[0]);<br> 47<br> 48 instance.minimize();<br> 49<br> 50 cout<<"numRow:="<<instance->getNumRows()<<"\n";<br> 51 cout<<"numCols:="<<instance->getNumCols()<<"\n";
<br> 52 cout<<"numEle:="<<instance->getNumElements()<<"\n";<br> 53 cout<<"obj:="<<instance->getObjValue()<<"\n";<br> 54
instance.x.display("Solution of first instance (x)");<br> 55 }<br><br>To learn how the such_that statement works, I introduced the 11th job<br>with<br>very high cost of assignment and infeasible<br>requirement on any of the machines...to prevent infeasibility I write
<br>the<br>"feas" constraints using such_that statement so<br>that 11th job doesn't have to be assigned....but I am not able to see<br>whats<br>wrong with the code that it doesn't work.<br>Any help on this is much appreciated..
<br><br>regards,<br>vishy<br><br></blockquote></div><br><br clear="all"><br>-- <br>--vishy