Error with Invalid argument to QuadExpr multiplication
AnsweredHi everyone,
I am new to the forum and am seeking assistance on a matter. I am currently trying to calculate the total number of products to load into a trailer taking a series of dimensions (L, W, and Height) as decision variables and using volume to do the below conversion:
- Number of sandwiches in a carton * Number of cartons in a case * Number of cases in a pallet * Number of pallets on a trailer.
The below is a screenshot of my code, with two errors. The first error being the "Invalid argument to QuadExpr multiplication" error on the objective function. The second error is the "Invalid argument to QuadExpr multiplication" (same error) on the first constraint.
I know that this has exceeded the number of required multiplications, but I am unsure how to re-write the objective function and constraint to prevent this error from going away without changing the decision variables. Thanks!


-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
It is not possible to divide by an optimization variable. We discuss a way to formulate division in the Knowledge Base article How do I divide by a variable in Gurobi?
It is always best to simplify the fractional expression as far as possible before reformulating it via a bilinear term.
Best regards,
Jaromił0
Post is closed for comments.
Comments
2 comments