Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model value extraction #219

Open
AdamGlass opened this issue Dec 21, 2022 · 3 comments
Open

model value extraction #219

AdamGlass opened this issue Dec 21, 2022 · 3 comments

Comments

@AdamGlass
Copy link

Is there a way to get value assignments out of the model without having a reference to the variable handy?

Basically i built a Int expression during a recursive process and one of the children created an integer variable. I build my computation, get Optimize to do its thing and get a model. I can print the model and see the solution including the variable name. Model::Eval wants that variable reference. Is there another way to get that reference by name after the fact? Or to enumerate the variables. An alternative is to clearly thread the the reference through the recursion but I'll take something simpler if i can get it.

thanks,
Adam

@HKalbasi
Copy link
Contributor

If the variable has name, wouldn't Int::new_const("name") work?

@AdamGlass
Copy link
Author

I was worried it had to be a reference to the same instance.

@HKalbasi
Copy link
Contributor

It would be the case if you use fresh_const, but with new_const you just need to pick the same name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants