简体   繁体   中英

How to get how many binary variables used by Gurobi?

How can I get the number of binary variables that have been used in Gurobi during the optimization: for instance, I have run a minimization problem and got the output below, I can see some binary numbers but I'm not sure if it is the correct number. How to extract the exact binary variables number?

PS I'm new to Gurobi

And thank you

在此处输入图像描述

There are 13 binary variables in your original formulation. That is reported in the first statistic in the log. The second such line reporting 37 binary variables, refers to the presolved and reformulated model. You are using quadratic terms in your objective as well as in the constraints and some of those are reformulated by adding auxiliary binary variables. You will not see these variables in the solution because this is always computed with respect to your original formulation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM