[Coin-discuss] CoinModel functionality

Mustafa R. Kilinc mustafa at lehigh.edu
Tue Apr 10 14:30:01 EDT 2007


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.cpp
Type: text/x-c++src
Size: 1694 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20070410/92f86928/attachment.bin>


More information about the Coin-discuss mailing list