Re: [ojAlgo-user] optimizing from a .mps file
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: David S. <d.s...@4c...> - 2009-10-19 10:50:38
|
We have tried on problems with up to 2400 variables and 200 constraints/rows and it solves it quickly (1.6~ seconds). Copied below is a complete case which causes the problem described (for any .mps file I can give it): import java.io.File; import org.ojalgo.optimisation.OptimisationSolver; import org.ojalgo.optimisation.OptimisationSolver.Result; import org.ojalgo.optimisation.linear.mps.MathProgSysModel; public class Temp2 { public static void main(String[] args) { File aFile = new File("temp.mps"); MathProgSysModel mps = MathProgSysModel.makeFromFile(aFile); OptimisationSolver os = mps.getDefaultSolver(); Result rs = os.solve(); System.out.println( rs.getSolution() ); } } I am using v28 of ojAlgo, and running it through Eclipse 3.5. Stepping through it I find that the thread is created at this point of BigDenseStore, in the method fillMatching: public void fillMatching(final MatrixStore<BigDecimal> aLeftArg, final BinaryFunction<BigDecimal> aFunc, final MatrixStore<BigDecimal> aRightArg) { final BigDenseStore tmpLeftArg = this.cast(aLeftArg); final BigDenseStore tmpRightArg = this.cast(aRightArg); final int tmpLength = length; final int tmpHalf = tmpLength / 2; final Future<?> tmpFirstHalf = ConcurrentUtils.EXECUTOR.submit(new Runnable() { public void run() { BigDenseStore.this.fill(0, tmpHalf, tmpLeftArg, aFunc, tmpRightArg); } }); this.fill(tmpHalf, tmpLength, tmpLeftArg, aFunc, tmpRightArg); try { tmpFirstHalf.get(); } catch (final InterruptedException anException) { anException.printStackTrace(); } catch (final ExecutionException anException) { anException.printStackTrace(); } } The Future object's thread never seems to stop running though I am not sure why not. Regards, David -----Original Message----- From: Anders Peterson [mailto:an...@op...] Sent: 16 October 2009 22:05 To: oja...@li... Cc: j.f...@4c... Subject: Re: [ojAlgo-user] optimizing from a .mps file On 16 okt 2009, at 14.25, David Stynes wrote: > Hello, > I am trying to use ojAlgo to read from a .mps file and use Linear/ > Mixed > Integer Programming to solve it. Currently the code for this is as > follows: > > MathProgSysModel mps = MathProgSysModel.makeFromFile(aFile); > OptimisationSolver os = mps.getDefaultSolver(); > Result rs = os.solve(); > > This runs correctly and solves the .mps input file as desired. Should have written somewhere that the MIP solver is new and experimental - glad to hear that it solves your problem. How big is it? > However the > second line (calling getDefaultSolver()) appears to start an > additional > thread running or something, as the java process does not stop after > the > rest of my code finishes (but the remaining code after this line > does get > executed). Is this intended, and/or am I using it incorrectly and > how can I > use it correctly to prevent the java process continuing to be active > indefinitely instead of closing? The MIP solver is multithreaded, but I don't see why any additional threads should be created before you call solve(). I have a number of junit tests that basically do what you do. As far as I can see they terminate as expected. Could you step through the code and tell me more precisely where that thread is created? /Anders > Thanks, > David > > > ---------------------------------------------------------------------------- -- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ ojAlgo-user mailing list ojA...@li... https://lists.sourceforge.net/lists/listinfo/ojalgo-user |