java,constraints,mathematical-optimization,cplex

It is far more likely to be a flaw in your code's logic. The code snippet you give us looks OK to me - I can't see where the problem would be without more context, knowing what the values are in the m matrix etc. First, try outputting your model...

Yes, you can do this by introducing a new binary variable. (Note that we are modifying the underlying formulation, not tinkering with CPLEX per se for the modulo.) Your constraints are x1 + x2 + x3 = 0 OR 2 Let's introduce a new binary variable Y and rewrite the...

math,model,binary,constraints,cplex

From memory, the sum(q in papers) only applies to the immediate following term. Try putting the two separate parts in parentheses, like: forall(p in papers) sum (q in papers) ( y[p][q] + y[q][p] ) <= 1; ...

constraints,scheduling,subset,cplex,opl

It is not clear what your problem is, but I am guessing your problem is to do with modelling things like products(j) in constraint 2. Try using sets for these - so create an array of sets of products in each product family. There are examples of this in the...

java,eclipse,unsatisfiedlinkerror,cplex

What I've found in the interwebs is that one possible cause for this problem is the dll being in 32 or 64 bits and your java being in the opposite architecture. Try verifying that your java and cplex.dll match....

IloLinearNumExpr.addTerm only applies to double and IloNumVar. By the error message, your SupplierCost[i] is a IloNumExpr, not an IloNumVar. You can add Pc[i] * Supplier[i] to objective by using the IloCplex.prod method to create a new IloNumExpr and using the IloNumExpr.add method to add the resulting IloNumExpr to objective. IloLinearNumExpr...

algorithm,linear-algebra,linear-programming,cplex,traveling-salesman

According to this Wikipedia article the travelling salesman problem can be modelled as an integer linear program, which I believe to be the key issue of the question. The idea is to have decision variables of permitted values in {0,1} which model selected edges in the graph. Suitable constraints must...

My standard approach for these sorts of issues is to get CPLEX to dump out the internal model as an LP file and check that it makes sense and matches what you were expecting. Then maybe try solving the LP file in the standalone CPLEX, and check the answers. I...

The % gap is the relative difference between the best solution and the best known bound for a solution. This is guaranteed to be higher than the gap between the best known solution and the true global optimum. In your case, the best bound is 83.9275, the best bound is...

After trying to find how certain parameters can be changed in CPLEX, I have found the answer to my own question. To change parameters (using CPLEX only) you don't need to type in any code. All you have to do is creating a "Settings" file within your project file. You...

You can suppress all output by redirecting it to /dev/null (or NUL on Windows) in addition to setting solver_msg to 0: option solver_msg 0; solve > /dev/null; That said, most of the solver running time is usually spent in optimization algorithms, not output....

Try something like for (i=0; i<numNodes; i++) { if (i == 0) { IloExpr expr1(env); for (j=0; j<numIn[0]; j++) expr1 += x[EInIndex[0][j]]; IloExpr expr2(env); expr2 += x[EOutIndex[0][j]]; model.add(expr1 - expr2 == -1); } else if ((i >= 1) && (i < n/2)) { // etc } else { // etc...

You are declaring Array as: int [] Array = {12,11,10,15,16,17}; and then iterating in: for (int i=0; i< inputData.Array().length;i++){ this means that the values of i are {0,1,2,3,4,5} and x is defined like IloNumVar[6][6][6] when you do: this.x[inputData.Array()[i]] is and error because you dont have indexes {12,11,10,15,16,17} in the x...

The official ILOG documentation has this to say (emphasis mine): Each call to a method of the API goes through a wrapping layer. This may result in a slight performance overhead while the model is created, compared to using the C++ API, depending on the number of API function calls....