Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Implementing solvers with Object Oriented Programming

    Posted Mon November 25, 2019 10:06 AM

    Originally posted by: naveendivakaran


    I would like to know what are some best practices in designing a solver implementation with Object Oriented Programming. We have implemented a solver with procedural programming paradigm, using python, and therefore we have data structures and functions written all in one python file. The solver works and is adding value to the organization. But now that we have to maintain and scale the code, (as always developing is just 20% of work load, maintenance is where 80% is) we are stumbling upon the need to design the solution with clear separation of model, data, algorithm, and reporting.

     

    Can anyone help shed some light on how to do this the best way?


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Implementing solvers with Object Oriented Programming

    Posted Tue November 26, 2019 03:25 AM

    Hi,

    I tried to address that question in https://www.linkedin.com/pulse/optimization-aka-prescriptive-analytics-should-we-write-fleischer/

    with some survey at https://www.linkedin.com/pulse/which-aml-gpl-do-you-use-call-cplex-alex-fleischer/

    If you use python and " design the solution with clear separation of model, data, algorithm, and reporting " is your main concern, you could either

    - Use OPL and call OPL from python through doopl

    - Use docplex , a high level CPLEX API

    regards

    https://www.linkedin.com/pulse/making-optimization-simple-python-alex-fleischer/

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Implementing solvers with Object Oriented Programming

    Posted Tue November 26, 2019 08:58 PM

    Originally posted by: naveendivakaran


    Thank you Alex.

    These answers help with what i should use for interacting with cplex through python. My question was more general as to what would be a good methodology of separating model, data, algorithm and reporting, with object oriented programming. Maybe I should not have cross-posted this question. My bad. I get a few directions from answers in this posting: https://or.stackexchange.com/questions/3103/implementing-solvers-with-object-oriented-programming.

    I did not know about the existence of doopl. i was aware of docplex. Is doopl newer than docplex?

    I tried to use doopl, but I get the following error while trying to import ..

    Is it because it does not work very well with anaconda. I added it to path to bin to the environment variables too.

     

    from doopl.factory import *

    Traceback (most recent call last):

      File "//anaconda/lib/python3.5/site-packages/doopl/opl.py", line 8, in <module>

        from doopl.internal.opl1290.opl import *

      File "//anaconda/lib/python3.5/site-packages/doopl/internal/opl1290/opl.py", line 7, in <module>

        from . import _opl

    ImportError: dlopen(//anaconda/lib/python3.5/site-packages/doopl/internal/opl1290/_opl.so, 2): Library not loaded: libopl1290.dylib

      Referenced from: //anaconda/lib/python3.5/site-packages/doopl/internal/opl1290/_opl.so

      Reason: image not found

     

    During handling of the above exception, another exception occurred:

     

    Traceback (most recent call last):

      File "//anaconda/lib/python3.5/site-packages/doopl/opl.py", line 11, in <module>

        from doopl.internal.opl1280.opl import *

      File "//anaconda/lib/python3.5/site-packages/doopl/internal/opl1280/opl.py", line 7, in <module>

        from . import _opl

    ImportError: dlopen(//anaconda/lib/python3.5/site-packages/doopl/internal/opl1280/_opl.so, 2): Library not loaded: libopl1280.dylib

      Referenced from: //anaconda/lib/python3.5/site-packages/doopl/internal/opl1280/_opl.so

      Reason: image not found

    Traceback (most recent call last):

      File "//anaconda/lib/python3.5/site-packages/doopl/opl.py", line 8, in <module>

        from doopl.internal.opl1290.opl import *

      File "//anaconda/lib/python3.5/site-packages/doopl/internal/opl1290/opl.py", line 7, in <module>

        from . import _opl

    ImportError: dlopen(//anaconda/lib/python3.5/site-packages/doopl/internal/opl1290/_opl.so, 2): Library not loaded: libopl1290.dylib

      Referenced from: //anaconda/lib/python3.5/site-packages/doopl/internal/opl1290/_opl.so

      Reason: image not found

     

    During handling of the above exception, another exception occurred:

     

    Traceback (most recent call last):

      File "//anaconda/lib/python3.5/site-packages/doopl/opl.py", line 11, in <module>

        from doopl.internal.opl1280.opl import *

      File "//anaconda/lib/python3.5/site-packages/doopl/internal/opl1280/opl.py", line 7, in <module>

        from . import _opl

    ImportError: dlopen(//anaconda/lib/python3.5/site-packages/doopl/internal/opl1280/_opl.so, 2): Library not loaded: libopl1280.dylib

      Referenced from: //anaconda/lib/python3.5/site-packages/doopl/internal/opl1280/_opl.so

      Reason: image not found

     

    During handling of the above exception, another exception occurred:

     

    Traceback (most recent call last):

      File "<stdin>", line 1, in <module>

      File "//anaconda/lib/python3.5/site-packages/doopl/factory.py", line 7, in <module>

        from doopl.opl import *

      File "//anaconda/lib/python3.5/site-packages/doopl/opl.py", line 15, in <module>

        raise ImportError('Could not import OPL wrappers. Make sure than OPL bin directory is in the PATH')

    ImportError: Could not import OPL wrappers. Make sure than OPL bin directory is in the PATH.

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Implementing solvers with Object Oriented Programming

    Posted Wed November 27, 2019 01:40 AM

    Hi,

    yes doopl is newer than docplex

    you seem to have some paths issue

    regards


    #CPLEXOptimizers
    #DecisionOptimization