Questions tagged [ojalgo]

oj! Algorithms – ojAlgo – is Open Source Java code to do mathematics, linear algebra and optimisation

74 questions
3
votes
2 answers

Ojalgo: Handling of singular matrices

I am using ojalgo to solve a (NxN) Ax = b System in java. Since there are chances that A will be a singular matrix, I would like my code to know this somehow. Is there a way? (documentation states that the solve() method returns one possible…
Nick Simos
  • 67
  • 4
3
votes
1 answer

Using ojalgo: Create Matrix from Array

I am trying to use ojAlgo to solve some linear algebra problems in Java. I am asking if there is any "clever" way to create a matrix using an existent array. This is my naive approach: final double[][] myArray = { { 1.1, 1.2, 1.3, 1.4, 1.5 }, …
2
votes
1 answer

Ojalgo - Load Matrix from CSV

I have some large headered CSV file that contains values I would like to load into a Matrix. I have come across the LineSplittingParser class but cannot find good examples on how to use this to actually get a Matrix object from a file. Could anyone…
2
votes
1 answer

How to use abs, sqrt etc on OperateOnAll with OjAlgo?

I'm trying to take square root on all elements in a matrix A by doing the following command. A.operateOnAll() But the argument must be UnaryFunction and I don't know how to create that. I reading the API documention, but still don't know how to…
euraad
  • 2,467
  • 5
  • 30
  • 51
2
votes
1 answer

How to store ojalgo sparse array to file in java?

I currently have a SparseStore matrix on which I perform a lot of counting and calculations. I want to store it to file, so I can later reuse it without re-doing all previous calculations. I tried basic serialization in Java: ObjectOutputStream…
glicerico
  • 690
  • 4
  • 20
2
votes
1 answer

How to add all elements of an ojalgo SparseArray?

I have a SparseArray and need to obtain the sum of all its elements I'm currently doing a dot product of the array with a same-sized array filled with ones, but I feel there should be something more straightforward (and efficient?) Can't find a…
glicerico
  • 690
  • 4
  • 20
2
votes
1 answer

Speed of ojAlgo linear programming solver

I'm pretty new to linear programming, I did solve my first problem with lpsolve (binary dll called from Java, via the JavaILP wrapper to have a more object-oriented code) and it was very fast (50 ms). I then decided to avoid native code (if…
lapo
  • 3,136
  • 26
  • 34
2
votes
0 answers

How do I get solver tasks in ojalgo to return the correct size result

I am trying various implementers of SolverTask with the intent of solving A * x = b, where A is 601 x 1100 and b is 601 x 1 in my tests. So far I have tried GaussSeidelSolver and JacobiSolver, both by invoking solve(A, b) directly and, in the case…
prubin
  • 366
  • 2
  • 14
2
votes
1 answer

ojAlgo Linear Optimization - Preventing work shift overlaps?

I'm kind of new to linear optimization, and I want to apply it to classic scheduling problems. For staffing problems I'm not quite clear how to declare functions that capture the concept of a "shift" being taken. I'm using ojAlgo which has been…
tmn
  • 11,121
  • 15
  • 56
  • 112
1
vote
2 answers

How Can I Use ojAlgo To Solve Quadratic Programming (QP) in Java?

I have a quadratic programming problem (quadratic objective function with linear constraints, integer variables) that I want to solve in Java. ojAlgo seems capable of this. Unfortunately, I can't find documentation or examples for how to use it. Can…
Tom D
  • 175
  • 1
  • 4
  • 12
1
vote
1 answer

ojalgo : How to sort each row of a matrix?

I have a question about using the oj algo library, I would like to know if there is an easy and efficient way to take a row out of a Primitive64Matrix, sort it, and then replace it in the matrix, Or alternatively to sort each row of a…
user642308
  • 19
  • 1
1
vote
1 answer

Sparse matrix solver in java using ojAlgo library

I'm currently doing FEM calculations in java on very large square matrices with sizes up to 1M x 1M. These are very sparse though with under 10M entries. I'm using ojAlgo with the SparseStore matrix implementation and I'm really happy with it so…
1
vote
1 answer

How to find the index of maximum element in ojalgo?

How to find the index of maximum element in ojalgo? To find maximum I can use double res = mat.aggregateAll(Aggregator.MAXIMUM);, but how to find the maximum's indices? PS: the mat is type of SparseStore
Yu Jiaao
  • 4,444
  • 5
  • 44
  • 57
1
vote
1 answer

Dual and reduced costs using SimplexSolver from ojAlgo

I would like to solve a linear problem using the simplex from ojAlgo (version 51.4.0) and to be able to retrieve its dual variables as well as its reduced costs. I was expecting the method getMultipliers() from Result to return the dual variables…
Taxation
  • 13
  • 2
1
vote
1 answer

How to get multiple values by index in an ojAlgo-array?

Let's say I have an ojAlgo-array defined like this ArrayAnyD regularArray = ArrayAnyD.PRIMITIVE64.make(10); regularArray.loopAll((final long[] ref) -> regularArray.set(ref, ref[0]*ref[0])); which just contains the squares of the numbers…
PebNischl
  • 163
  • 5
1
2 3 4 5