# Tag Info

9

Of the open source LP and MILP solvers, I would recommend investigating the COIN-OR based solvers CLP and CBC. These are C++ based libraries, though work has been done to make them more accessible from Java. See https://spartanideas.msu.edu/2016/06/01/using-clp-with-java/ for example.

6

This can be handled by transforming this to a bilinear problem, i.e., a problem only involving products of no more than 2 variables at a time. This is accomplished by lifting the problem into a higher dimension, i.e., by introducing new variables and corresponding constraints. For instance, the term $x^3$ can be made bilinear (quadratic), by introducing a ...

6

About the issue you reported on the function getNcuts(), we looked at it and I can confirm that we have a bug in the number of Benders cuts reported by the function getNcuts() (the issue is there with all CPLEX APIs). The Benders algorithm implemented in CPLEX consists of two main phases. In the first phase, we solve the continuous relaxation of the (...

6

I found a manual in Coin-OR Github page where they explained the implementation of the method through 3 different examples. You can find the document in this web address

5

Here is how I would do this: you essentially have a facility location problem, every data point is a potential facility and you decide whether you open it or not (i.e., whether it is the leader of its group). Same goes for the other points, will they be served by the opened facility or not (i.e., will they belong to its group). Standard MILP models don't ...

5

OptaPlanner is an open source constraint solver in Java. It's: Used across the globe in governments, Fortune 500 and other companies, startups, nonprofits, ... 1000+ zip downloads per month and far more from Maven Central 100% pure java - just a jar compatible with Kotlin and Scala too open source (Apache License), so you can modify/redistribute without ...

5

This question was also asked and answered on a CPLEX forum and on my blog. Update: The gist of the answer is that when you add a cut in a callback, CPLEX updates the node solution to reflect that cut and then invokes the callback again (still at the same node) to see if you have more cuts to add. To let CPLEX move on to another node, your callback needs to ...

4

I think that you're looking for function IloCP::typeOfPrev. Its documentation is for example here, the description of the general concept is here. Basically, each interval participating in sequence variable can have a type. By default each interval has different type counted from 0 in the order as they are specified in the sequence variable. So type of the ...

4

It sounds like what you want is to reduce each vector in your matrix to the relevant entries, and take the Cartesian Product of the column vectors. That is definitely not a problem where linear programming can help, but where you should resort either to traditional combinatorial algorithms, or use a database system that typically has support for generating ...

4

A few key ones that I use are: algs4 -- a variety of programs/utilities from an online course at Princeton (Go Tiger!), including some graph/network libraries Various Apache Commons libraries -- for reading/writing CSV files, doing operations on collections that Java currently does not directly support, and so on Renjin -- let's me execute R code inside a ...

4

You need to use a callback, and CPLEX introduced a new callback system ("generic callbacks") in version 12.8 (I think) while maintaining support, at least for now, for the original callback system ("legacy callbacks"). The details of doing the branching depend in part on which system you use. With legacy callbacks, you create a class that ...

3

Ok so I have figured out a way to speed up the solver and have it return a solution. Key here seems to be adding the following method. public void setDisjunction() { long penalty = 100000; ...

3

I'm not a CP Optimizer user, so this may be clunkier than necessary (by an order of magnitude). I'm going to assume that your setup times satisfy the triangle inequality (meaning it's faster to go straight from A to B than from A to C to B). For each place where you would use an interval variable for down time, you could instead create multiple interval ...

2

The JOpt Mixed Integer Program Optimization Package Wrapper: What is JOpt? JOpt is an open source Java wrapper that provides objects like Variable, Constraint, and Term and lets you express your linear or mixed integer programs in a natural manner, while remaining agnostic to the details of the solver backend. JOpt is not a solver. Rather, it ...

2

The idea behind roulette wheel selection is to use a random number generator to pick an index, so that the probability of index $i$ being selected is your $p_i$. One way to do this is to compute partial sums $s_i = \sum_{j=1}^i p_j$, then generate a random value $u~U(0,1)$ and pick the largest index $i$ for which $u\le s_i$. Below is a Java function that ...

2

The type of a variable cannot be changed. However, it can be overwritten for a particular model by adding an IloConversion object, which allows you to specify new types for variables within that model. When ILOG CPLEX finds a conversion object in the active model, it uses the variable types specified in the conversion object instead of the original type ...

2

In the end, I reduced the matrix by using HashMaps and ignoring the 0 entities. The code needs around 60' to run for a maximum of 2 different row combinations. I am sure that I can still optimize it, by reducing the iterations when I need at maximum X different row combinations. The following code, is what I have at this moment. import org.apache.poi.ss....

2

I suspect you have not assigned names to your variables. Try doing that and then exporting the .lp file, and I think you will discover that the bidirectional constraint involves a variable that CPLEX added. As a small example, I created a model with a single binary variable "x", a single continuous variable "y" (domain [0, 10]), and a ...

2

"variable c (no optimization variable)" is not something that one can say in linear and (mixed) integer programming. There are decision variables and there are parameters (coefficients). That's it. There are no local variables as in computer programming. It is best to look at things as solving large sparse systems of linear equations. Now, Gurobi ...

1

for (int m = 0; m < (int)this.Anzahl_Monate; m++) { constra = new GRBLinExpr(); constra.addTerm(150, x_m[m]); constra.addTerm(0.000001, x_m[m]); constra.addConstant(-0.000001); model.addConstr(constra, GRB.GREATER_EQUAL, S_m[m], "a"); constrb = new GRBLinExpr(); ...

1

In addition to what @Richard mentioned: You can consider $a=0$ and $b=\epsilon$ in @Richard's answer. Here you can find how special functions in the constraint can be modeled using Gurobi. Yours is defining an indicator variable for $S_m$ to find out whether the value of your variable is positive or negative. Edit: you can model it as follow: $$S_m \leq ... 1 The easiest would probably be to model it as follows:$$ S_m \leq a + bx_m \\ S_m \geq ax_m  where $a$ is the switch and $a+b$ is the upper bound for variable $S_m$. In this case, if $S_m< a$, then $x_m$ has to be 0 (otherwise this is infeasible). Similarly, if $S_m > a$, then $x_m$ has to be 1. The key question here is what you want to happen if \$...

1

Related to my previous comment: About the issue you reported on the function getNcuts(), we looked at it and I can confirm that we have a bug in the number of Benders cuts reported by the function getNcuts() (the issue is there with all CPLEX APIs). The issue which I described will be fixed in the next CPLEX release.

1

I once made CBC work from JAVA with Google's OR-Tools. From the "free" category, it should also allow to use GLPK.

Only top voted, non community-wiki answers of a minimum length are eligible