@@ -188,7 +188,7 @@ public String toString() {
188
188
* {@link ExpressionsBasedModel.Integration#toModelState(org.ojalgo.optimisation.Optimisation.Result, ExpressionsBasedModel)}.
189
189
* </ol>
190
190
*/
191
- public static interface EntityMap extends ProblemStructure {
191
+ public interface EntityMap extends ProblemStructure {
192
192
193
193
/**
194
194
* The number of variables, in the solver, that directly correspond to a model variable. (Not slack or
@@ -346,7 +346,7 @@ protected final void setSwitch(final ExpressionsBasedModel model, final Integrat
346
346
* @see ExpressionsBasedModel.Integration#setSwitch(ExpressionsBasedModel, IntegrationProperty, boolean)
347
347
* @see ExpressionsBasedModel.Integration#isSwitch(ExpressionsBasedModel, IntegrationProperty)
348
348
*/
349
- public static enum IntegrationProperty {
349
+ public enum IntegrationProperty {
350
350
351
351
/**
352
352
* Any integration that can switch between Java and native code solvers.
@@ -482,6 +482,37 @@ static final class DefaultIntermediate extends IntermediateSolver {
482
482
483
483
}
484
484
485
+ static final class IntegrationWrapper extends ExpressionsBasedModel .Integration <Optimisation .Solver > {
486
+
487
+ private final Optimisation .Integration <ExpressionsBasedModel , ?> myDelegate ;
488
+
489
+ IntegrationWrapper (final Optimisation .Integration <ExpressionsBasedModel , ?> delegate ) {
490
+ super ();
491
+ myDelegate = delegate ;
492
+ }
493
+
494
+ @ Override
495
+ public Solver build (final ExpressionsBasedModel model ) {
496
+ return myDelegate .build (model );
497
+ }
498
+
499
+ @ Override
500
+ public boolean isCapable (final ExpressionsBasedModel model ) {
501
+ return myDelegate .isCapable (model );
502
+ }
503
+
504
+ @ Override
505
+ public Result toModelState (final Result solverState , final ExpressionsBasedModel model ) {
506
+ return myDelegate .toModelState (solverState , model );
507
+ }
508
+
509
+ @ Override
510
+ public Result toSolverState (final Result modelState , final ExpressionsBasedModel model ) {
511
+ return myDelegate .toSolverState (modelState , model );
512
+ }
513
+
514
+ }
515
+
485
516
static abstract class Simplifier <ME extends ModelEntity <?>, S extends Simplifier <?, ?>> implements Comparable <S > {
486
517
487
518
private final int myExecutionOrder ;
@@ -699,8 +730,12 @@ void update(final ArrayList<Variable> variables) {
699
730
/**
700
731
* Add an integration for a solver that will be used rather than the built-in solvers
701
732
*/
702
- public static boolean addIntegration (final Integration <?> integration ) {
703
- return INTEGRATIONS .add (integration );
733
+ public static boolean addIntegration (final Optimisation .Integration <ExpressionsBasedModel , ?> integration ) {
734
+ if (integration instanceof ExpressionsBasedModel .Integration <?>) {
735
+ return INTEGRATIONS .add ((ExpressionsBasedModel .Integration <?>) integration );
736
+ } else {
737
+ return INTEGRATIONS .add (new IntegrationWrapper (integration ));
738
+ }
704
739
}
705
740
706
741
public static boolean addPresolver (final Presolver presolver ) {
0 commit comments