Coder Social home page Coder Social logo

Set coin_cbc verbosity about good_lp HOT 6 CLOSED

rust-or avatar rust-or commented on June 10, 2024
Set coin_cbc verbosity

from good_lp.

Comments (6)

TeXitoi avatar TeXitoi commented on June 10, 2024 2

You can also add a fn set_parameter(key: &str, value: &str) without any invariant breaking.

from good_lp.

Rahix avatar Rahix commented on June 10, 2024 1

I would prefer having direct access to the parameter here. I feel like wiring this up to log is be not a good idea:

  1. log provides a mechanism for libraries and applications to write log messages and an implementation of a filtering mechanism to only show some of those messages. Especially, behind log you'll always need a backend which actually takes care of logging the generated messages somewhere and initializing the filters. CBC doesn't care about all this and just writes its messages to stdout directly. So it wouldn't really tie into the log ecosystem at all. The only "connection" which could be made is by asking log of the (default!) log-level and setting something similar in CBC.
  2. The log-levels from log don't really map to the verbosity levels from CBC well, I think. So it would be confusing for downstream users to understand what log-level from log corresponds to which setting from CBC.
  3. There might also be a mismatch between what the user wants to see logged from the application and what they want to see logged from CBC. To some degree, applications might want to control this, too. You could use a magic module name for setting the CBC log-level but that feels like a hack to me.

In the end I think this wouldn't gain us much and just make the original task I wanted to accomplish more complicated. I think what I wanted to do is what most people will care about: silencing CBC to keep the console free for actually interesting messages.

We don't want people changing the solver parameters, and for instance removing variables from under our feet, do we ?

That's why I would suggest making the access to the CBC model "unsafe":

unsafe fn as_inner_mut(&mut self) -> &mut Model {
    // ...
}

This way people can't possibly destroy invariants assumed by good_lp without unsafe code.

In parallel to adding the above (which is probably useful beyond this issue alone), for logging in particular, maybe adding another method specifically to set the verbosity might be a good idea? It would certainly help people searching through good_lp documentation for terms like "log" or "verbosity" to find what they need... For example:

fn set_solver_verbosity(&mut self, v: &str) {
    // ...
}

from good_lp.

lovasoa avatar lovasoa commented on June 10, 2024

I think a good solution would be to depend on the almost universal log crate, and set the cbc verbosity based on the standard rust log level. What do you think ?

from good_lp.

TeXitoi avatar TeXitoi commented on June 10, 2024

I think exposing parameters is a good idea: there is log, bit also solver tunning available.

The log crate has a complicated syntax, and levels that doesn't really match with coin.

from good_lp.

lovasoa avatar lovasoa commented on June 10, 2024

We don't want people changing the solver parameters, and for instance removing variables from under our feet, do we ?

How is the log crate syntax complicated?

from good_lp.

ihowell avatar ihowell commented on June 10, 2024

I would like to add that we are experiencing the same problems in the highs solver. Any way of changing the verbosity would be extremely appreciated. I think being able to set the options on the models themselves would be extremely useful.

from good_lp.

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.