nazemian
nazemian

Reputation: 159

Convex optimization, java

I'm looking for a Java library to solve this problem:

enter image description here

We know X is sparse(most of it's entries are zero), so X can be recovered by solving this:

   variable X;
   minimize(norm(X,1)+norm(A*X - Y,2));

It's a MATLAB code, matrix A and vector Y are known and I want the best X.

I saw JOptimizer, but I couldn't use it. (Doesn't have good documentation or examples).

Upvotes: 2

Views: 2550

Answers (3)

Holger Brandl
Holger Brandl

Reputation: 11222

To solve convex optimization problems in java you can use the following library https://github.com/erikerlandson/gibbous

Upvotes: 0

user327301
user327301

Reputation: 2641

As far as I can tell, you're trying to solve a binary integer program for feasibility

Ax = b, x in {0,1}.

I'm not completely sure, but it seems that you might be interested in the optimization problem

min 1'*x
s.t. Ax = b, x in {0,1}

where 1 is a vector of 1's of the same dimension as x.

The feasibility problem may be in practice much easier than the optimization problem - it all depends on a particular A and b.

If you can get a license of either CPLEX or Gurobi (if you're an academic), these are excellent integer programming solvers with good Java API's. If you don't have access to these, lpsolve may be a good option.

As far as I can tell, JOptimizer will not solve your problem since your variables are integers (although I have never used JOptimizer).

Upvotes: 1

Ram Narasimhan
Ram Narasimhan

Reputation: 22516

What you need is a reasonably good LP Solver.

Possible Java LP Solver Options

  1. Apache Commons (Math) Simplex Solver. See this blog post.

  2. If you have access to CPLEX (not-free), its Java API would work great.

  3. Also, you can look into SuanShu, a Java numerical and statistical library

  4. lpSolve has a Java wrapper which can do the job.

  5. Finally, JOptimizer is indeed a good option. Not sure if you looked at this example.

Hope at least one of those help.

Upvotes: 2

Related Questions