سؤال

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. (has't good document or example).

Thanks.

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top