Coder Social home page Coder Social logo

Comments (5)

jjhforrest avatar jjhforrest commented on July 29, 2024

Looking at #339, I can see problems - including large overheads. But I think you have a much simpler request if you are just modifying one coefficient - even simpler if you are not changing the coefficient to or from zero.
ClpModel.cpp has -
/// Modify one element of a matrix
inline void modifyCoefficient(int row, int column, double newElement,
bool keepZero = false)
and it should be easy to transfer functionality to the C interface.

Will this be done outside a solve - or at least before cuts have been added? Inside Cbc there are really two solvers - one as passed in and the other after cuts and fixing.

So it could be done at Osi level e.g.
CBCLIB_EXPORT void CBC_LINKAGE
Osi_modifyCoef(void *osi, int row, int column, double newValue);

or at Cbc level
CBCLIB_EXPORT void CBC_LINKAGE
Cbc_modifyCoef(Cbc_Model *model, int row, int column, double newValue );

from cbc.

jetuk avatar jetuk commented on July 29, 2024

Thanks for the advice. I'll take a look over the next couple of days. Will you want this against the stable or master branch (or both)?

from cbc.

jetuk avatar jetuk commented on July 29, 2024

Will this be done outside a solve - or at least before cuts have been added?

For my use case, the update is between solves.

from cbc.

jjhforrest avatar jjhforrest commented on July 29, 2024

Do it to master. Looking at code, modifyCoefficient in ClpModel doesn't do some things that would make it safer e.g. check if there is matrix stored by row which would also need updating. Also if a factorization has been saved it may not may not be valid so that should be noted. It is unlikely that any of that will matter, but I may add a safer version.

from cbc.

jjhforrest avatar jjhforrest commented on July 29, 2024

Only needed a tiny change to make safer - done that in master.

Also I was only looking Cbc C interface. When I looked at Clp C interface the function you need is already there.

/* Change matrix coefficients */
void CLP_LINKAGE
Clp_modifyCoefficient(Clp_Simplex *model, int row, int column, double newElement,
int keepZero)
{
model->model_->modifyCoefficient(row, column, newElement, keepZero);
}

from cbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.