Accesing NL model information

Hello,

I usually work with DWave CQM to model and solve combinatorial optimizations problems, and recently I'm testing the new NL solver and I have the following question:

How can one access the full problem information on the model and solution?

For comparison, after creating my model in CQM (setting variables, adding constrains...) and performing the sampling task, I can access every bit of information about it. If I inspect it in a Python debugger I can check the whole structure, including variables, its values, energy... and thus I know how to obtain the relevant data for my problem.

However, when I work with NL, all it seems I can acces is a a SampleResult, which has a tuple containing the timing information, and then the model itself, but the model has no attributes I can check. For example, if I have a model with, lets say, 3 types of variables (a list, some integers and some binaries) how can I see the values set on these variables after the sampling process? It seems to be opaque. I also don't fully understand how iter_decisions() work.

Thank you in advance!

Pablo

 

0

Comments

1 comment
  • Hello,

    A great resource to get you started is the Nonlinear Model section of the documentation.

    The iter_decisions() function returns an iterator that can be used to step through all of the Symbols that make up the model. 

    Check out the States section of the documentation for more information about accessing the values.

    You can do something like the following:

    for symbol in model.iter_symbols(): 
    print(symbol, symbol.state(0))

    Hopefully this was helpful. Please let us know if you have any questions.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post