Cplex in java: constraint depends on the objective array
up vote
0
down vote
favorite
I am new to learn cplex in java. As I was trying to solve a special case in which the constraint needs calculation by the IloNumVar array, I met the trouble about how add this calculation into cplex.
The model is
get a matrix m[i][j], for example a 3*3 matrix:
1 2 3
2 1 2
3 2 1
objective: min sum(a[i]) i = {1 ... n}
s.t. a[i] = 0 or 1
b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
b[i] <= 2
Is there a way to add this b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
into cplex java code? Thanks a lot.
java cplex
New contributor
add a comment |
up vote
0
down vote
favorite
I am new to learn cplex in java. As I was trying to solve a special case in which the constraint needs calculation by the IloNumVar array, I met the trouble about how add this calculation into cplex.
The model is
get a matrix m[i][j], for example a 3*3 matrix:
1 2 3
2 1 2
3 2 1
objective: min sum(a[i]) i = {1 ... n}
s.t. a[i] = 0 or 1
b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
b[i] <= 2
Is there a way to add this b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
into cplex java code? Thanks a lot.
java cplex
New contributor
Sorry, but I don't see which are your decision variables, what are the constants? You mention a matrix m, but don't use it? You also use 'a' as a 1-dimensional array in some places and as a 2-dimensional array in others?
– TimChippingtonDerrick
11 hours ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am new to learn cplex in java. As I was trying to solve a special case in which the constraint needs calculation by the IloNumVar array, I met the trouble about how add this calculation into cplex.
The model is
get a matrix m[i][j], for example a 3*3 matrix:
1 2 3
2 1 2
3 2 1
objective: min sum(a[i]) i = {1 ... n}
s.t. a[i] = 0 or 1
b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
b[i] <= 2
Is there a way to add this b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
into cplex java code? Thanks a lot.
java cplex
New contributor
I am new to learn cplex in java. As I was trying to solve a special case in which the constraint needs calculation by the IloNumVar array, I met the trouble about how add this calculation into cplex.
The model is
get a matrix m[i][j], for example a 3*3 matrix:
1 2 3
2 1 2
3 2 1
objective: min sum(a[i]) i = {1 ... n}
s.t. a[i] = 0 or 1
b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
b[i] <= 2
Is there a way to add this b[i] = min (a[i][j]) j = {1 ... n} where a[i] = 1
into cplex java code? Thanks a lot.
java cplex
java cplex
New contributor
New contributor
New contributor
asked yesterday
Shaw Xia
1
1
New contributor
New contributor
Sorry, but I don't see which are your decision variables, what are the constants? You mention a matrix m, but don't use it? You also use 'a' as a 1-dimensional array in some places and as a 2-dimensional array in others?
– TimChippingtonDerrick
11 hours ago
add a comment |
Sorry, but I don't see which are your decision variables, what are the constants? You mention a matrix m, but don't use it? You also use 'a' as a 1-dimensional array in some places and as a 2-dimensional array in others?
– TimChippingtonDerrick
11 hours ago
Sorry, but I don't see which are your decision variables, what are the constants? You mention a matrix m, but don't use it? You also use 'a' as a 1-dimensional array in some places and as a 2-dimensional array in others?
– TimChippingtonDerrick
11 hours ago
Sorry, but I don't see which are your decision variables, what are the constants? You mention a matrix m, but don't use it? You also use 'a' as a 1-dimensional array in some places and as a 2-dimensional array in others?
– TimChippingtonDerrick
11 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Shaw Xia is a new contributor. Be nice, and check out our Code of Conduct.
Shaw Xia is a new contributor. Be nice, and check out our Code of Conduct.
Shaw Xia is a new contributor. Be nice, and check out our Code of Conduct.
Shaw Xia is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349290%2fcplex-in-java-constraint-depends-on-the-objective-array%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Sorry, but I don't see which are your decision variables, what are the constants? You mention a matrix m, but don't use it? You also use 'a' as a 1-dimensional array in some places and as a 2-dimensional array in others?
– TimChippingtonDerrick
11 hours ago