Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fails when forced to use SparseTableau #170

Closed
jbx1 opened this issue Feb 13, 2019 · 5 comments
Closed

Test fails when forced to use SparseTableau #170

jbx1 opened this issue Feb 13, 2019 · 5 comments

Comments

@jbx1
Copy link

jbx1 commented Feb 13, 2019

When the SimplexTableau is forced to use the SparseTableau in all cases (by making SimplexTableau:872 always return SparseTableau and commenting out the check on the number of constraints), the following tests fail:

MarketShareCase#testMipButSomeConstainedToOptimatl
DesignCase#testFacilityLocation
DesignCase#testSOS

with the following exception:

java.lang.IllegalStateException: java.lang.IllegalStateException: Requires a count/size greater than the limit!

	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
	at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
	at org.ojalgo.optimisation.integer.IntegerSolver.compute(IntegerSolver.java:438)
	at org.ojalgo.optimisation.integer.IntegerSolver$BranchAndBoundNodeTask.compute(IntegerSolver.java:125)
	at org.ojalgo.optimisation.integer.IntegerSolver$BranchAndBoundNodeTask.compute(IntegerSolver.java:80)
	at java.util.concurrent.RecursiveTask.exec(RecursiveTask.java:94)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinTask.externalAwaitDone(ForkJoinTask.java:326)
	at java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:391)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:719)
	at org.ojalgo.optimisation.integer.IntegerSolver.compute(IntegerSolver.java:438)
	at org.ojalgo.optimisation.integer.IntegerSolver.compute(IntegerSolver.java:438)
	at org.ojalgo.optimisation.integer.IntegerSolver.compute(IntegerSolver.java:438)
	at org.ojalgo.optimisation.integer.IntegerSolver.compute(IntegerSolver.java:438)
	at org.ojalgo.optimisation.integer.IntegerSolver.compute(IntegerSolver.java:438)
	at org.ojalgo.optimisation.integer.IntegerSolver$BranchAndBoundNodeTask.compute(IntegerSolver.java:125)
	at org.ojalgo.optimisation.integer.IntegerSolver$BranchAndBoundNodeTask.compute(IntegerSolver.java:80)
	at java.util.concurrent.RecursiveTask.exec(RecursiveTask.java:94)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinTask.externalAwaitDone(ForkJoinTask.java:326)
	at java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:391)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:719)
	at java.util.concurrent.ForkJoinPool.invoke(ForkJoinPool.java:2616)
	at org.ojalgo.optimisation.integer.IntegerSolver.solve(IntegerSolver.java:291)
	at org.ojalgo.optimisation.ExpressionsBasedModel$Intermediate.solve(ExpressionsBasedModel.java:267)
	at org.ojalgo.optimisation.ExpressionsBasedModel.optimise(ExpressionsBasedModel.java:1378)
	at org.ojalgo.optimisation.ExpressionsBasedModel.minimise(ExpressionsBasedModel.java:1037)
	at org.ojalgo.optimisation.integer.MarketShareCase.testMipButSomeConstainedToOptimatl(MarketShareCase.java:170)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:515)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:171)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:167)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:114)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:59)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:105)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:71)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:110)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:71)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:110)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:71)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.IllegalStateException: Requires a count/size greater than the limit!
	at org.ojalgo.array.DenseCapacityStrategy.grow(DenseCapacityStrategy.java:95)
	at org.ojalgo.array.DenseCapacityStrategy.grow(DenseCapacityStrategy.java:87)
	at org.ojalgo.array.SparseArray.update(SparseArray.java:575)
	at org.ojalgo.array.SparseArray.set(SparseArray.java:462)
	at org.ojalgo.optimisation.linear.SimplexTableau$SparseTableau$3.set(SimplexTableau.java:772)
	at org.ojalgo.optimisation.linear.SimplexSolver.build(SimplexSolver.java:230)
	at org.ojalgo.optimisation.linear.LinearSolver$ModelIntegration.build(LinearSolver.java:114)
	at org.ojalgo.optimisation.linear.LinearSolver$ModelIntegration.build(LinearSolver.java:103)
	at org.ojalgo.optimisation.ExpressionsBasedModel$Intermediate.getSolver(ExpressionsBasedModel.java:318)
	at org.ojalgo.optimisation.ExpressionsBasedModel$Intermediate.solve(ExpressionsBasedModel.java:263)
	at org.ojalgo.optimisation.integer.IntegerSolver.compute(IntegerSolver.java:344)
	at org.ojalgo.optimisation.integer.IntegerSolver$BranchAndBoundNodeTask.compute(IntegerSolver.java:125)
	at org.ojalgo.optimisation.integer.IntegerSolver$BranchAndBoundNodeTask.compute(IntegerSolver.java:80)
	at java.util.concurrent.RecursiveTask.exec(RecursiveTask.java:94)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

@apete
Copy link
Contributor

apete commented Feb 13, 2019

Very interested in finding and fixing this problem, but I need a way to reproduce it.

@jbx1
Copy link
Author

jbx1 commented Feb 13, 2019

In SimplexTableau.java just change the method make() to this:

  protected static SimplexTableau make(final int numberOfConstraints, final int numberOfProblemVariables, final int numberOfSlackVariables) {

       return new SparseTableau(numberOfConstraints, numberOfProblemVariables, numberOfSlackVariables);
}

Then those tests will start to fail.

apete added a commit that referenced this issue Feb 13, 2019
Alaso increased the initial size of the sparse rows from 3 to 9.

#170

#169
@apete
Copy link
Contributor

apete commented Feb 13, 2019

Not sure exactly what happened, but believe it is fixed with that commit.

ee7bbf1

I did these changes in a branch I'm currently working in. There are a lot of ongoing work with the tests. If you exclude everything that is either tagged "slow" or "unstable" you should be able to run the tests to verify that the exception no longer happens.

@apete
Copy link
Contributor

apete commented Feb 15, 2019

@jbx1 Could you either close this issue or inform me that you still see the problem.

@jbx1
Copy link
Author

jbx1 commented Feb 15, 2019

I pulled the latest version of feature/TestCasePlex, forced SimplexTableau to always use SparseTableau and all tests passed.

@jbx1 jbx1 closed this as completed Feb 15, 2019
apete added a commit that referenced this issue Feb 17, 2019
* ModelFileMPS

* Moved extensions tests here

* Moved mps files to resources

* Update Tsp.java

* Turned Tsp into a test case

* NetlibCase

* Intermediate test refactoring

* Test refactoring step 2

* doTest

* ISRAEL

* NetlibCase

* COMMENT_REF

* Update NetlibCase.java

* Fix @tag("slow,unstable")

* Configurable factory instance cannot be static

Alaso increased the initial size of the sparse rows from 3 to 9.

#170

#169

* Update NetlibCase.java

* Better initialisaton of sparse rows in tableau

* Formatting

* Update NetlibCase.java

* Update NetlibCase.java

* Update NetlibCase.java

* Delete crap

* Always use dense tableau if #constr > #vars

* MPS ROWS

* MPS

* Update MathProgSysModel.java

* Update NetlibCase.java

* MPS parse seems ok

* MPS parser now disregards multiple RHS, RANGES & BOUNDS

* Remove some unused classes

* Added missing test case

* Differentiate between preferred / fallback solver integrations

* addPreferredSolver
danoliv pushed a commit to danoliv/Optimus that referenced this issue May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants