var is a bound to be used in constraints
I have an n-dim array, shape is \((d_0, d_1, ..., d_n)\), I want to split the array along each dim. I use a list of variable \((p_0, p_1, ..., p_n)\) to denote split i-th dim into \(p_i\) parts. and one constraint is \(p_0*...*p_n <= N\). I want to get each part of array \(array_p_k = (k*d_0 / p_0, ..., k*d_n / p_n)\) and then add some other constraints. But \(k\) is related to the var bound. Is there any solutions or programming tricks?
-
Official comment
This post is more than three 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 why not try our AI Gurobot?. -
Hi Jiangfei,
I don't understand the question. What's the dimension of \(d_i\)? Are these coefficients for your constraints? What do you mean by "\(k\) is related to the var bound"?
PS: I edited your post to fix the LaTeX code. Please check our guide for help on formatting posts:
Posting to the Community Forum – Gurobi Support PortalCheers,
Matthias0 -
Hi Matthias,
Thanks for your reply.
1. \(d_i\) represents the dimension bound of the i-th dim, for example, a 3-dim array (2, 3, 4), \(d_0 = 2, d_1 = 3, d_2 = 4\), the array has 2*3*4 elements. I want to split the array into \(p_0 * p_1 * p_2\) parts, for example, \(p_0 = 2, p_1 = p_2 = 1\) represents that I split the array into 2 parts, each part's shape is \((1, 3 ,4)\).
2. No coefficients.
3. array_p_k is the k-th part of the array. As the total number of parts is related to the value of var \(p_0*p_1*p_2\), so when I want to get the start position of each array on the original array, I have to iterate k over \(p_0*p_1*p_2\). But it seems that I cannot use the value of var to add constraints?
Best,Jiangfei0
Post is closed for comments.
Comments
3 comments