[Coin-discuss] CoinModel functionality

John J Forrest jjforre at us.ibm.com
Thu Apr 19 12:28:08 EDT 2007


Mustafa,

getColumn did not trigger the standard hash lookup initialization - hence
bug.  A dummy getElement at beginning would fix (but is not a good
solution).

Hopefully OK now.

John Forrest


                                                                           
             "Mustafa R.                                                   
             Kilinc"                                                       
             <mustafa at lehigh.e                                          To 
             du>                       coin-discuss at list.coin-or.org       
             Sent by:                                                   cc 
             coin-discuss-boun                                             
             ces at list.coin-or.                                     Subject 
             org                       [Coin-discuss] CoinModel            
                                       functionality                       
                                                                           
             04/10/07 02:30 PM                                             
                                                                           
                                                                           
             Please respond to                                             
             Discussions about                                             
                open source                                                
               software for                                                
                Operations                                                 
                 Research                                                  
             <coin-discuss at lis                                             
              t.coin-or.org>                                               
                                                                           
                                                                           




Hi,

I am having a bit of trouble using some of the functionality in
CoinModel.  I'd like to be able to use the setElement() method to be
able to change certain Matrix elements in an integer program.
I can't seem to make it work as I would expect it to.
Instead of changing the element value, it seems to add another element
to the matrix.  It seems that the "position" method is unable to find
the element (it returns -1).

Here is a code snippet to demonstrate my calling sequence:

int main(){
   CoinModel model;
      .....
    //read model using CoinMpsIO
      ....
    int numrows = model.numberRows();
    int cmatind[numrows];
    double cmatval[numrows];
    int nnz = model.getColumn(0,cmatind, cmatval);
    int pos = model.position(cmatind[0],0);
    cout<<"pos: "<<pos<<endl;
    model.setElement(cmatind[0],0,2.0);
    model.writeMps("stein27_changed");

}

I am using the CoinUtils checked out as part of coin-Cbc latest stable
branch.  (revision 489).

A small code that demonstrates the trouble I am having is attached.

Thanks for any help you can provide and for such a useful quite of
software.

Cheers,
Mustafa Kilinc

--
Mustafa Rasim Kilinc
Graduate Student
Industrial & Systems Engineering
Lehigh University
Office:  (610)-758-4042
E-mail:  mustafa at lehigh.edu
MSN:     mrkilinc at hotmail.com


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

[attachment "example.cpp" deleted by John J Forrest/Watson/IBM]
_______________________________________________
Coin-discuss mailing list
Coin-discuss at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-discuss





More information about the Coin-discuss mailing list