SlideShare uma empresa Scribd logo
1 de 28
Optimization Seminar - OptiMax




Embedding Optimization in Applications
         with MPL OptiMax

               Presented by
            Bjarni Kristjansson
           Maximal Software, Inc.




      Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                    1
Presentation Overview


• Tools and Methods for embedding optimization in Applications
• Introduction to MPL OptiMax for Visual Basic, CSharp, Python,
  and Matlab
• Using the Python Command Language Interface (IDLE)
• Using the Numpy, Scipy, and MatPlotLib with MPL for Python
• Writing GUI Optimization Applications in Python and CSharp
• Multi-Threaded support for MPL OptiMax on Servers
• Connecting MPL OptiMax with Web API’s and Web Services
• Deploying Optimization on Mobile/Tablet Computers




               Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                             2
Building Optimization Applications
            Development/Deployment Issues


Phase I - Development
   •   Model Development Environment
   •   Formulating the Model
   •   Connecting to External Data
   •   Solver Testing and Tuning


Phase II - Deployment
   •   End-User Applications
   •   Run-times / Component Libraries
   •   Embedding Optimization into Application
   •   Packaging/Distribution



                 Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                               3
Callable Libraries for Solvers




                    Program
                     Program




                      Solver
                       Solver




 Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                               4
Algebraic Modeling Languages




ModLang
ModLang                                                        Program
                                                                Program




Solver
 Solver                                                            Solver
                                                                    Solver




     Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                             5
Connecting to Databases




          ModLang
          ModLang                                                    Program
                                                                      Program




Solver
 Solver                   DB                            Solver
                                                         Solver                 DB
                          DB                                                    DB




             Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                6
Merging Program with Model




                     Program
                      Program
                     ModLang
                     ModLang




        Solver
         Solver                             DB
                                            DB




 Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                               7
Programming vs. Optimization Modeling


Application Programming
•   Programming Languages (Procedural)
•   Application/User-Interface
•   Database Programming
•   Most programmers tend to know rather little about
    optimization and formulating models



Optimization Modeling
•   Modeling Languages (Declarative)
•   Optimization Packages
•   Most model builders tend to know rather little about
    application/GUI and database programming




                  Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                8
Program Running Model



                    Program
                     Program                                    DB
                                                                DB

Application
Optimization


                                        ModLang
                                        ModLang




                                           Solver
                                            Solver




               Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                             9
Optimization Component Library


                                        Program
                                         Program




                            OptiMax
                            OptiMax                           DB
                                                              DB

Application
Optimization

                                          ModLang
                                          ModLang




                                            Solver
                                             Solver



                  Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                10
OptiMax Component Library
      Seamless Integration of Technologies

•   Modeling Language
•   Solver/Optimizers
•   Database/Data Sources
•   Programming Languages (COM/ActiveX)
     • Visual Basic/VBA
     • C/C++
     • Java
     • Delphi
     • Web scripting




             Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                           11
MPL/OptiMax Design Overview


                                       VB               C++              Delphi        Java




MPLWIN                        MPLX                             OptiMax




                     MPL Library (C++)




                  MPL Modeling Language




    Solvers                                          Database




          Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                  12
OptiMax Component Library
   Object Model Hierarchy

OptiMax

   Solvers (Solver)

      SolverOptions (SolverOption)


   MplOptions (MplOption)


   StatusWindow


   Models (Model)


      Matrix

          Variables (Variable)

          Constraints (Constraint)


      Solution

          Variables (Variable)

          Constraints (Constraint)


      Symbols (Symbol)




    Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                  13
OptiMax Component Library
    Object Model - Symbols

OptiMax


   Models (Model)


      Symbols (Symbol)


      IndexSets (IndexSet)


      DataConstants (DataConstant)

      DataVectors (DataVector)

          Subscripts (Subscript)


      Macros (Macro)

      VariableVectors (VariableVector)

          Subscripts (Subscript)


      ConstraintVectors (ConstraintVector)

          Subscripts (Subscript)

      PlainVariables (Variable)

      PlainConstraints (Constraint)




     Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                   14
OptiMax Component Library
           Application Building Features

•   General Model Handling
•   Model Parsing
•   Model Querying
•   Modifying Models / Solving Models
•   Write Standard Output Files
•   Database Import/Export
•   Multiple Models in Memory
•   Multiple Model Runs / Iterations over models
•   Use Solution Values as Input
•   Callbacks/User Exits
•   Access to MPL Internal Indexing Data Structures



              Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                            15
MPL OptiMax for .Net


MPL Release 4.2n:
   • Supports both CSharp and Visual Basic (2008/2010 - 32/64 bit)
   • Multiple new objects, methods and properties
   • Seamless integration with native .Net data structures
       • Array
       • ArrayList
       • Generic List
       • ICollection
       • IEnumerable
   • Iterators for all collection classes to support foreach loops
   • ToString() implementation for all classes
   • Exception handling with detailed error messages
   • Extensive code samples showing the new OptiMax features
   • Server version with full multi-threaded support
                 Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                               16
MPL OptiMax for Python


MPL Release 4.2n:
   •   Supports Python 2.6, 2.7, 3.1, and 3.2 in both 32-bit and 64-bit mode
   •   Distributed as compiled PYD files for increased speed
   •   Multiple new objects, methods and properties
   •   Seamless integration with native python data structures
         • Lists, List of Lists
         • Tuples, Tuples of Tuples
   •   Iterators for all collection classes to support for loops
   •   Implementation of magic methods for all classes
                      __init__(), __len__(), __iter__(), __getitem__(), __str__()
   •   Dynamic object attributes for model identifiers
   •   Exception handling with detailed error messages
   •   Extensive code samples showing the new OptiMax features
   •   Server version with full multi-threaded support


                   Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                 17
MPL OptiMax for Matlab


MPL Release 4.2n:
   • Supports Matlab in both 32-bit and 64-bit mode
   • Distributed as compiled MEX files
   • Utilizes the new C-API Mpllib42.dll library
   • Based on the standard interface of Matlab Optimization Toolbox
      • mpl_initlibrary()
      • mpl_linprog()
      • mpl_bintprog()
      • mpl_mintprog()
      • mpl_freelibrary()
   • MPL can be kept in memory through the hmpl library handle
   • Solver can be specified through the solverName argument
   • Solver options can be set through the option list argument


                 Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                               18
MPLLib C-API DLL Library


MPL Release 4.2n:
   • Full C-Api library interface with over 600 functions
   • Available in both 32-bit and 64-bit versions
   • Utilized by MPL OptiMax Component Libraries
      • MPL OptiMax for .Net
      • MPL OptiMax for Python
      • MPL OptiMax for Matlab
   • Supports all functionality of MPL OptiMax from the C language




                 Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                               19
Simple MPL OptiMax Example in Python


from mplpy import *

def RunModel(modelName):
   modelFile = mpl.HomeDir + modelName + ".mpl"
   print("MPL file: " + modelFile)
   mod.ReadModel(modelFile)
   print("Variables = " + str(mod.Matrix.Variables.Count))
   print("Constraints = " + str(mod.Matrix.Constraints.Count))
   print("")
   print("Solving " + modelName + " with " + mpl.Solver.Name + " solver:")
   mod.Solve(mpl.coinmp)
   print("")
   print(mod.Solution.ResultString)
   print("ObjectValue = " + str(mod.Solution.ObjectValue))
   for var in mod.Solution.Variables:
         print(var.Name + " = " + str(var.Activity))




                      Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                    20
Planning Example in CSharp


OptiMax mpl = new OptiMax();
mpl.UseExceptions = false;
Solver solver = mpl.Solvers.Add("CPLEX");
Model model = mpl.Models.Add("Planning");
string modelFile = mpl.HomeDirectory + modelName + ".mpl";
Console.WriteLine("Reading MPL file: " + modelFile);
ResultType result = model.ReadModel(modelFile);
if (result != ResultType.Success)
{
    Console.WriteLine(model.Error.ToString());
}
Console.WriteLine("Solving " + modelName + " with " + solver.Name + " solver");
result = model.Solve(solver);
foreach (Variable var in model.Solution.Nonzeros)
{
    Console.WriteLine(var.Name + " " + var.Activity.ToString());
}
Console.WriteLine(model.Solution.ResultString +
   " ObjectValue = " + model.Solution.ObjectValue);
Console.WriteLine("Nonzeros = " + model.Solution.Nonzeros.Count.ToString());


                   Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                 21
Portfolio Example - Dynamic Attributes


from mplpy import mpl
from numpy import arange, float32
from matplotlib import pyplot as plot

modelFilename = mpl.HomeDir + "Portfolio.mpl"
result = mpl.model.SolveModel(modelFilename, mpl.cplex)

investVect = mpl.model.Invest
investVect.ZeroTol = 0.001

count = investVect.Nonzeros.Count
investAmount = arange(count, dtype=float32)
stockNames = range(count)

for i, var in enumerate(investVect.Nonzeros):
    investAmount[i] = var.Activity
    stockNames[i] = investVect.stock.ValueStr
    print((stockNames[i] + ":").ljust(8) +
          ("%1.1f%%" % (investAmount[i] * 100.0)).rjust(6))




                   Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                 22
EFrontier Example - Changing RHS

iterCount = 100
deltaPercent = 0.02
CPLEX_OPTIMAL = 1
targetReturnData = model.TargetReturn
varianceMacro = model.Variance
meetTargetCon = model.MeetTarget
TargetArray = arange(iterCount, dtype=float32)
VarianceArray = arange(iterCount, dtype=float32)

for i in range(iterCount):
    target = targetReturnData.Value * (1 + i * deltaPercent)
    meetTargetCon.RHSValue = target
    model.Solve(mpl.cplex)
    print(str(i) + ") " + str(target) + ", " + str(varianceMacro.Value))
    if model.Solution.ResultCode == CPLEX_OPTIMAL:
        TargetArray[i] = target
        VarianceArray[i] = varianceMacro.Value
    else:
        solCount = i
        print(str(solCount + 1) + ") " +
              model.Solution.ResultString + " (" +
              str(model.Solution.ResultCode) + ")")
        break
                   Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                 23
CutStock Example – Add() Statements

def LoadModel(self, model, cutNames, patternNames, priceSheet, sheetsAvail,
               cutDemand, cutsInPattern):
    try:
         model.IndexSets.AddNameSet("cuts", cutNames)
         model.IndexSets.AddNameSet("patterns", patternNames)
         model.DataConstants.Add("PriceSheet", priceSheet)
         model.DataConstants.Add("SheetsAvail", sheetsAvail)
         model.DataVectors.AddDense("CutDemand[cuts]", cutDemand)
         model.DataVectors.Add("CutsInPattern[patterns, cuts]", cutsInPattern)
         model.PlainVariables.Add("SheetsCut", "-> T1")
         model.PlainVariables.Add("TotalCost", "-> TC")
         model.VariableVectors.Add("PatternCount[patterns]", "-> """)
         model.VariableVectors.Add("ExcessCuts[cuts]", "-> X")
         model.Objectives.Add("TotalCost", ObjectSense.Minimize)
         model.PlainConstraints.Add("TotCost", "TotalCost = PriceSheet*SheetsCut")
         model.PlainConstraints.Add("RawAvail", "SheetsCut < SheetsAvail")
         model.PlainConstraints.Add("Sheets",
             "SheetsCut = SUM(patterns: PatternCount[patterns])")
         model.ConstraintVectors.Add("CutReq[cuts]",
             "SUM(patterns: CutsInPattern[patterns, cuts] * PatternCount[patterns])
             CutDemand[cuts] + ExcessCuts[cuts]")
    except Exception as ex:
         print(str(ex))
    result = model.LastResult
    return result



                       Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                     24
Add Statements - IndexSet / DataVectors


Adding IndexSet:

cutNames = ['w1', 'w2', 'w3', 'w4', 'w5', 'w6', 'w7', 'w8']

model.IndexSets.AddNameSet("cuts", cutNames)


Adding DataVectors:

cutDemand = [500, 400, 300, 450, 350, 200, 800, 200]

model.DataVectors.AddDense("CutDemand[cuts]", cutDemand)


cutsInPattern = ['p1', 'w1', 1,
                 'p1', 'w8', 1,
                 'p2', 'w2', 1,
                 'p2', 'w7', 1,
                 . . .
                 'p28', 'w8', 5,
                 'p29', 'w8', 7]

model.DataVectors.Add("CutsInPattern[patterns, cuts]", cutsInPattern)


                      Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                    25
Exceptions with Detailed Syntax Error Messages

Syntax Error:
     model.PlainConstraints.Add("TotCost", "TotalCost = PriceSheet */ SheetsCut")


Exception Output:


     The PlainConstraints.Add('TotCost', expr='TotalCost = PriceSheet */ SheetsCut') method
     returned 'SyntaxError' (2) with the following error message:

     **** A minor mistake was found in line 1:

     6. I expected to see either a number or a variable, but found instead '/'.

     File: C:MplWin4OptiMaxPythonCutStock
     Line: (line=1, col=43)

     SUBJECT TO TotCost: TotalCost = PriceSheet */ SheetsCut;
                                                ^




                                  Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                                26
Exceptions with Wrong Data Types

Syntax Error:
      cutNames = ['w1', 'w2', 'w3', 'w4', 'w5', 'w6', 'w7', 'w8']
      model.DataConstants.Add("SheetsAvail", cutNames)



Exception Output:


     The argument 'dataValue' for the 'DataConstants.Add('SheetsAvail', dataValue, dataAttr)' method
     cannot be assigned the value '['w1', 'w2', 'w3', 'w4', 'w5', 'w6', 'w7', 'w8']' of type 'list'.


     Quick fix: Please enter either a numeric or string value.




                                   Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                                       27
Applications with MPL OptiMax


•   Model written in MPL
•   Data transferred to/from MPL through
    • Excel Ranges
    • Database Connection
    • Text files
•   End-User Application Building
    •   User-Interface done in VB/CSharp/C-API/C++/Java/Phyton
    •   Process Input from User
    •   Control Solver Runs
    •   Process Output from Model
    •   Display graphs
•   Model solved with any supported solver

              No limits on size, speed, or robustness
                   Copyright © 2012 Maximal Software, Inc. All rights reserved
                                                                                 28

Mais conteúdo relacionado

Mais procurados

Data Science at Scale on MPP databases - Use Cases & Open Source Tools
Data Science at Scale on MPP databases - Use Cases & Open Source ToolsData Science at Scale on MPP databases - Use Cases & Open Source Tools
Data Science at Scale on MPP databases - Use Cases & Open Source ToolsEsther Vasiete
 
Greenplum Database Open Source December 2015
Greenplum Database Open Source December 2015Greenplum Database Open Source December 2015
Greenplum Database Open Source December 2015PivotalOpenSourceHub
 
SparkR best practices for R data scientist
SparkR best practices for R data scientistSparkR best practices for R data scientist
SparkR best practices for R data scientistDataWorks Summit
 
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsTensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsStijn Decubber
 
Meet HBase 2.0 and Phoenix-5.0
Meet HBase 2.0 and Phoenix-5.0Meet HBase 2.0 and Phoenix-5.0
Meet HBase 2.0 and Phoenix-5.0DataWorks Summit
 
Apache Spark 2.3 boosts advanced analytics and deep learning with Python
Apache Spark 2.3 boosts advanced analytics and deep learning with PythonApache Spark 2.3 boosts advanced analytics and deep learning with Python
Apache Spark 2.3 boosts advanced analytics and deep learning with PythonDataWorks Summit
 
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFiThe First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFiDataWorks Summit
 
Best practices and lessons learnt from Running Apache NiFi at Renault
Best practices and lessons learnt from Running Apache NiFi at RenaultBest practices and lessons learnt from Running Apache NiFi at Renault
Best practices and lessons learnt from Running Apache NiFi at RenaultDataWorks Summit
 

Mais procurados (9)

Data Science at Scale on MPP databases - Use Cases & Open Source Tools
Data Science at Scale on MPP databases - Use Cases & Open Source ToolsData Science at Scale on MPP databases - Use Cases & Open Source Tools
Data Science at Scale on MPP databases - Use Cases & Open Source Tools
 
Greenplum Database Open Source December 2015
Greenplum Database Open Source December 2015Greenplum Database Open Source December 2015
Greenplum Database Open Source December 2015
 
SparkR best practices for R data scientist
SparkR best practices for R data scientistSparkR best practices for R data scientist
SparkR best practices for R data scientist
 
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsTensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
 
Meet HBase 2.0 and Phoenix-5.0
Meet HBase 2.0 and Phoenix-5.0Meet HBase 2.0 and Phoenix-5.0
Meet HBase 2.0 and Phoenix-5.0
 
Apache Nifi Crash Course
Apache Nifi Crash CourseApache Nifi Crash Course
Apache Nifi Crash Course
 
Apache Spark 2.3 boosts advanced analytics and deep learning with Python
Apache Spark 2.3 boosts advanced analytics and deep learning with PythonApache Spark 2.3 boosts advanced analytics and deep learning with Python
Apache Spark 2.3 boosts advanced analytics and deep learning with Python
 
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFiThe First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
 
Best practices and lessons learnt from Running Apache NiFi at Renault
Best practices and lessons learnt from Running Apache NiFi at RenaultBest practices and lessons learnt from Running Apache NiFi at Renault
Best practices and lessons learnt from Running Apache NiFi at Renault
 

Semelhante a Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012

Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...Bjarni Kristjánsson
 
From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012
From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012
From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012Marc Dutoo
 
Aras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration ManagementAras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration ManagementAras
 
Oracle Fusion applications 101 [2010 OAUG Collaborate]
Oracle Fusion applications 101 [2010 OAUG Collaborate]Oracle Fusion applications 101 [2010 OAUG Collaborate]
Oracle Fusion applications 101 [2010 OAUG Collaborate]Rhapsody Technologies, Inc.
 
From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System Intland Software GmbH
 
Hadoop Overview
Hadoop Overview Hadoop Overview
Hadoop Overview EMC
 
Cast Iron Overview Webinar 6.13.12 Final(Jb)
Cast Iron Overview Webinar 6.13.12 Final(Jb)Cast Iron Overview Webinar 6.13.12 Final(Jb)
Cast Iron Overview Webinar 6.13.12 Final(Jb)Carolyn Crowe
 
RTView - Monitoring Service for SmartCloud Applications
RTView - Monitoring Service for SmartCloud ApplicationsRTView - Monitoring Service for SmartCloud Applications
RTView - Monitoring Service for SmartCloud ApplicationsSL Corporation
 
MoDisco Eclipse-OMG Symp 2010
MoDisco Eclipse-OMG Symp 2010MoDisco Eclipse-OMG Symp 2010
MoDisco Eclipse-OMG Symp 2010fmadiot
 
Aras PLM Software Update
Aras PLM Software UpdateAras PLM Software Update
Aras PLM Software UpdateAras
 
Cast Iron Overview Webinar 6.13
Cast Iron Overview Webinar 6.13Cast Iron Overview Webinar 6.13
Cast Iron Overview Webinar 6.13gaborvodics
 
Analyze your software assets with Modisco par Frédéric Madiot
Analyze your software assets with Modisco par Frédéric MadiotAnalyze your software assets with Modisco par Frédéric Madiot
Analyze your software assets with Modisco par Frédéric MadiotEclipseDayParis
 
Best practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini PatilBest practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini PatilRoopa Nadkarni
 
2012 ukdc shared services value prop growth day newbury
2012 ukdc shared services value prop growth day newbury2012 ukdc shared services value prop growth day newbury
2012 ukdc shared services value prop growth day newburybara2cls
 
New Features of OBIEE 11.1.1.6.x
New Features of OBIEE 11.1.1.6.x New Features of OBIEE 11.1.1.6.x
New Features of OBIEE 11.1.1.6.x Capgemini
 
Apptio up cloud conference 2012 [final].pptx
Apptio up cloud conference 2012 [final].pptxApptio up cloud conference 2012 [final].pptx
Apptio up cloud conference 2012 [final].pptxKhazret Sapenov
 
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012Bjarni Kristjánsson
 
Effective Application Development with WebSphere Message Broker
Effective Application Development with WebSphere Message BrokerEffective Application Development with WebSphere Message Broker
Effective Application Development with WebSphere Message BrokerAnt Phillips
 
What Is Slowing My Application Releases?
What Is Slowing My Application Releases?What Is Slowing My Application Releases?
What Is Slowing My Application Releases?Datical
 

Semelhante a Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012 (20)

Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
 
From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012
From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012
From Eclipse to Document Management - Eclipse DemoCamp Grenoble 2012
 
Aras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration ManagementAras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration Management
 
Oracle Fusion applications 101 [2010 OAUG Collaborate]
Oracle Fusion applications 101 [2010 OAUG Collaborate]Oracle Fusion applications 101 [2010 OAUG Collaborate]
Oracle Fusion applications 101 [2010 OAUG Collaborate]
 
From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System
 
Hadoop Overview
Hadoop Overview Hadoop Overview
Hadoop Overview
 
Cast Iron Overview Webinar 6.13.12 Final(Jb)
Cast Iron Overview Webinar 6.13.12 Final(Jb)Cast Iron Overview Webinar 6.13.12 Final(Jb)
Cast Iron Overview Webinar 6.13.12 Final(Jb)
 
RTView - Monitoring Service for SmartCloud Applications
RTView - Monitoring Service for SmartCloud ApplicationsRTView - Monitoring Service for SmartCloud Applications
RTView - Monitoring Service for SmartCloud Applications
 
MoDisco Eclipse-OMG Symp 2010
MoDisco Eclipse-OMG Symp 2010MoDisco Eclipse-OMG Symp 2010
MoDisco Eclipse-OMG Symp 2010
 
Aras PLM Software Update
Aras PLM Software UpdateAras PLM Software Update
Aras PLM Software Update
 
Cast Iron Overview Webinar 6.13
Cast Iron Overview Webinar 6.13Cast Iron Overview Webinar 6.13
Cast Iron Overview Webinar 6.13
 
Analyze your software assets with Modisco par Frédéric Madiot
Analyze your software assets with Modisco par Frédéric MadiotAnalyze your software assets with Modisco par Frédéric Madiot
Analyze your software assets with Modisco par Frédéric Madiot
 
Managing SAP Custom Code
Managing SAP Custom CodeManaging SAP Custom Code
Managing SAP Custom Code
 
Best practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini PatilBest practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini Patil
 
2012 ukdc shared services value prop growth day newbury
2012 ukdc shared services value prop growth day newbury2012 ukdc shared services value prop growth day newbury
2012 ukdc shared services value prop growth day newbury
 
New Features of OBIEE 11.1.1.6.x
New Features of OBIEE 11.1.1.6.x New Features of OBIEE 11.1.1.6.x
New Features of OBIEE 11.1.1.6.x
 
Apptio up cloud conference 2012 [final].pptx
Apptio up cloud conference 2012 [final].pptxApptio up cloud conference 2012 [final].pptx
Apptio up cloud conference 2012 [final].pptx
 
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
 
Effective Application Development with WebSphere Message Broker
Effective Application Development with WebSphere Message BrokerEffective Application Development with WebSphere Message Broker
Effective Application Development with WebSphere Message Broker
 
What Is Slowing My Application Releases?
What Is Slowing My Application Releases?What Is Slowing My Application Releases?
What Is Slowing My Application Releases?
 

Mais de Bjarni Kristjánsson

Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...Bjarni Kristjánsson
 
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012Bjarni Kristjánsson
 
Seminar: New Stochastic Programming Features for MPL - Nov 2011
Seminar: New Stochastic Programming Features for MPL - Nov 2011Seminar: New Stochastic Programming Features for MPL - Nov 2011
Seminar: New Stochastic Programming Features for MPL - Nov 2011Bjarni Kristjánsson
 
Seminar: CoinMP - Open Source Solver - Nov 2011
Seminar: CoinMP - Open Source Solver - Nov 2011Seminar: CoinMP - Open Source Solver - Nov 2011
Seminar: CoinMP - Open Source Solver - Nov 2011Bjarni Kristjánsson
 
Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012Bjarni Kristjánsson
 
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011Bjarni Kristjánsson
 
INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011Bjarni Kristjánsson
 
INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011Bjarni Kristjánsson
 

Mais de Bjarni Kristjánsson (8)

Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
 
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
 
Seminar: New Stochastic Programming Features for MPL - Nov 2011
Seminar: New Stochastic Programming Features for MPL - Nov 2011Seminar: New Stochastic Programming Features for MPL - Nov 2011
Seminar: New Stochastic Programming Features for MPL - Nov 2011
 
Seminar: CoinMP - Open Source Solver - Nov 2011
Seminar: CoinMP - Open Source Solver - Nov 2011Seminar: CoinMP - Open Source Solver - Nov 2011
Seminar: CoinMP - Open Source Solver - Nov 2011
 
Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012
 
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
 
INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011
 
INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011
 

Último

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Último (20)

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012

  • 1. Optimization Seminar - OptiMax Embedding Optimization in Applications with MPL OptiMax Presented by Bjarni Kristjansson Maximal Software, Inc. Copyright © 2012 Maximal Software, Inc. All rights reserved 1
  • 2. Presentation Overview • Tools and Methods for embedding optimization in Applications • Introduction to MPL OptiMax for Visual Basic, CSharp, Python, and Matlab • Using the Python Command Language Interface (IDLE) • Using the Numpy, Scipy, and MatPlotLib with MPL for Python • Writing GUI Optimization Applications in Python and CSharp • Multi-Threaded support for MPL OptiMax on Servers • Connecting MPL OptiMax with Web API’s and Web Services • Deploying Optimization on Mobile/Tablet Computers Copyright © 2012 Maximal Software, Inc. All rights reserved 2
  • 3. Building Optimization Applications Development/Deployment Issues Phase I - Development • Model Development Environment • Formulating the Model • Connecting to External Data • Solver Testing and Tuning Phase II - Deployment • End-User Applications • Run-times / Component Libraries • Embedding Optimization into Application • Packaging/Distribution Copyright © 2012 Maximal Software, Inc. All rights reserved 3
  • 4. Callable Libraries for Solvers Program Program Solver Solver Copyright © 2012 Maximal Software, Inc. All rights reserved 4
  • 5. Algebraic Modeling Languages ModLang ModLang Program Program Solver Solver Solver Solver Copyright © 2012 Maximal Software, Inc. All rights reserved 5
  • 6. Connecting to Databases ModLang ModLang Program Program Solver Solver DB Solver Solver DB DB DB Copyright © 2012 Maximal Software, Inc. All rights reserved 6
  • 7. Merging Program with Model Program Program ModLang ModLang Solver Solver DB DB Copyright © 2012 Maximal Software, Inc. All rights reserved 7
  • 8. Programming vs. Optimization Modeling Application Programming • Programming Languages (Procedural) • Application/User-Interface • Database Programming • Most programmers tend to know rather little about optimization and formulating models Optimization Modeling • Modeling Languages (Declarative) • Optimization Packages • Most model builders tend to know rather little about application/GUI and database programming Copyright © 2012 Maximal Software, Inc. All rights reserved 8
  • 9. Program Running Model Program Program DB DB Application Optimization ModLang ModLang Solver Solver Copyright © 2012 Maximal Software, Inc. All rights reserved 9
  • 10. Optimization Component Library Program Program OptiMax OptiMax DB DB Application Optimization ModLang ModLang Solver Solver Copyright © 2012 Maximal Software, Inc. All rights reserved 10
  • 11. OptiMax Component Library Seamless Integration of Technologies • Modeling Language • Solver/Optimizers • Database/Data Sources • Programming Languages (COM/ActiveX) • Visual Basic/VBA • C/C++ • Java • Delphi • Web scripting Copyright © 2012 Maximal Software, Inc. All rights reserved 11
  • 12. MPL/OptiMax Design Overview VB C++ Delphi Java MPLWIN MPLX OptiMax MPL Library (C++) MPL Modeling Language Solvers Database Copyright © 2012 Maximal Software, Inc. All rights reserved 12
  • 13. OptiMax Component Library Object Model Hierarchy OptiMax Solvers (Solver) SolverOptions (SolverOption) MplOptions (MplOption) StatusWindow Models (Model) Matrix Variables (Variable) Constraints (Constraint) Solution Variables (Variable) Constraints (Constraint) Symbols (Symbol) Copyright © 2012 Maximal Software, Inc. All rights reserved 13
  • 14. OptiMax Component Library Object Model - Symbols OptiMax Models (Model) Symbols (Symbol) IndexSets (IndexSet) DataConstants (DataConstant) DataVectors (DataVector) Subscripts (Subscript) Macros (Macro) VariableVectors (VariableVector) Subscripts (Subscript) ConstraintVectors (ConstraintVector) Subscripts (Subscript) PlainVariables (Variable) PlainConstraints (Constraint) Copyright © 2012 Maximal Software, Inc. All rights reserved 14
  • 15. OptiMax Component Library Application Building Features • General Model Handling • Model Parsing • Model Querying • Modifying Models / Solving Models • Write Standard Output Files • Database Import/Export • Multiple Models in Memory • Multiple Model Runs / Iterations over models • Use Solution Values as Input • Callbacks/User Exits • Access to MPL Internal Indexing Data Structures Copyright © 2012 Maximal Software, Inc. All rights reserved 15
  • 16. MPL OptiMax for .Net MPL Release 4.2n: • Supports both CSharp and Visual Basic (2008/2010 - 32/64 bit) • Multiple new objects, methods and properties • Seamless integration with native .Net data structures • Array • ArrayList • Generic List • ICollection • IEnumerable • Iterators for all collection classes to support foreach loops • ToString() implementation for all classes • Exception handling with detailed error messages • Extensive code samples showing the new OptiMax features • Server version with full multi-threaded support Copyright © 2012 Maximal Software, Inc. All rights reserved 16
  • 17. MPL OptiMax for Python MPL Release 4.2n: • Supports Python 2.6, 2.7, 3.1, and 3.2 in both 32-bit and 64-bit mode • Distributed as compiled PYD files for increased speed • Multiple new objects, methods and properties • Seamless integration with native python data structures • Lists, List of Lists • Tuples, Tuples of Tuples • Iterators for all collection classes to support for loops • Implementation of magic methods for all classes __init__(), __len__(), __iter__(), __getitem__(), __str__() • Dynamic object attributes for model identifiers • Exception handling with detailed error messages • Extensive code samples showing the new OptiMax features • Server version with full multi-threaded support Copyright © 2012 Maximal Software, Inc. All rights reserved 17
  • 18. MPL OptiMax for Matlab MPL Release 4.2n: • Supports Matlab in both 32-bit and 64-bit mode • Distributed as compiled MEX files • Utilizes the new C-API Mpllib42.dll library • Based on the standard interface of Matlab Optimization Toolbox • mpl_initlibrary() • mpl_linprog() • mpl_bintprog() • mpl_mintprog() • mpl_freelibrary() • MPL can be kept in memory through the hmpl library handle • Solver can be specified through the solverName argument • Solver options can be set through the option list argument Copyright © 2012 Maximal Software, Inc. All rights reserved 18
  • 19. MPLLib C-API DLL Library MPL Release 4.2n: • Full C-Api library interface with over 600 functions • Available in both 32-bit and 64-bit versions • Utilized by MPL OptiMax Component Libraries • MPL OptiMax for .Net • MPL OptiMax for Python • MPL OptiMax for Matlab • Supports all functionality of MPL OptiMax from the C language Copyright © 2012 Maximal Software, Inc. All rights reserved 19
  • 20. Simple MPL OptiMax Example in Python from mplpy import * def RunModel(modelName): modelFile = mpl.HomeDir + modelName + ".mpl" print("MPL file: " + modelFile) mod.ReadModel(modelFile) print("Variables = " + str(mod.Matrix.Variables.Count)) print("Constraints = " + str(mod.Matrix.Constraints.Count)) print("") print("Solving " + modelName + " with " + mpl.Solver.Name + " solver:") mod.Solve(mpl.coinmp) print("") print(mod.Solution.ResultString) print("ObjectValue = " + str(mod.Solution.ObjectValue)) for var in mod.Solution.Variables: print(var.Name + " = " + str(var.Activity)) Copyright © 2012 Maximal Software, Inc. All rights reserved 20
  • 21. Planning Example in CSharp OptiMax mpl = new OptiMax(); mpl.UseExceptions = false; Solver solver = mpl.Solvers.Add("CPLEX"); Model model = mpl.Models.Add("Planning"); string modelFile = mpl.HomeDirectory + modelName + ".mpl"; Console.WriteLine("Reading MPL file: " + modelFile); ResultType result = model.ReadModel(modelFile); if (result != ResultType.Success) { Console.WriteLine(model.Error.ToString()); } Console.WriteLine("Solving " + modelName + " with " + solver.Name + " solver"); result = model.Solve(solver); foreach (Variable var in model.Solution.Nonzeros) { Console.WriteLine(var.Name + " " + var.Activity.ToString()); } Console.WriteLine(model.Solution.ResultString + " ObjectValue = " + model.Solution.ObjectValue); Console.WriteLine("Nonzeros = " + model.Solution.Nonzeros.Count.ToString()); Copyright © 2012 Maximal Software, Inc. All rights reserved 21
  • 22. Portfolio Example - Dynamic Attributes from mplpy import mpl from numpy import arange, float32 from matplotlib import pyplot as plot modelFilename = mpl.HomeDir + "Portfolio.mpl" result = mpl.model.SolveModel(modelFilename, mpl.cplex) investVect = mpl.model.Invest investVect.ZeroTol = 0.001 count = investVect.Nonzeros.Count investAmount = arange(count, dtype=float32) stockNames = range(count) for i, var in enumerate(investVect.Nonzeros): investAmount[i] = var.Activity stockNames[i] = investVect.stock.ValueStr print((stockNames[i] + ":").ljust(8) + ("%1.1f%%" % (investAmount[i] * 100.0)).rjust(6)) Copyright © 2012 Maximal Software, Inc. All rights reserved 22
  • 23. EFrontier Example - Changing RHS iterCount = 100 deltaPercent = 0.02 CPLEX_OPTIMAL = 1 targetReturnData = model.TargetReturn varianceMacro = model.Variance meetTargetCon = model.MeetTarget TargetArray = arange(iterCount, dtype=float32) VarianceArray = arange(iterCount, dtype=float32) for i in range(iterCount): target = targetReturnData.Value * (1 + i * deltaPercent) meetTargetCon.RHSValue = target model.Solve(mpl.cplex) print(str(i) + ") " + str(target) + ", " + str(varianceMacro.Value)) if model.Solution.ResultCode == CPLEX_OPTIMAL: TargetArray[i] = target VarianceArray[i] = varianceMacro.Value else: solCount = i print(str(solCount + 1) + ") " + model.Solution.ResultString + " (" + str(model.Solution.ResultCode) + ")") break Copyright © 2012 Maximal Software, Inc. All rights reserved 23
  • 24. CutStock Example – Add() Statements def LoadModel(self, model, cutNames, patternNames, priceSheet, sheetsAvail, cutDemand, cutsInPattern): try: model.IndexSets.AddNameSet("cuts", cutNames) model.IndexSets.AddNameSet("patterns", patternNames) model.DataConstants.Add("PriceSheet", priceSheet) model.DataConstants.Add("SheetsAvail", sheetsAvail) model.DataVectors.AddDense("CutDemand[cuts]", cutDemand) model.DataVectors.Add("CutsInPattern[patterns, cuts]", cutsInPattern) model.PlainVariables.Add("SheetsCut", "-> T1") model.PlainVariables.Add("TotalCost", "-> TC") model.VariableVectors.Add("PatternCount[patterns]", "-> """) model.VariableVectors.Add("ExcessCuts[cuts]", "-> X") model.Objectives.Add("TotalCost", ObjectSense.Minimize) model.PlainConstraints.Add("TotCost", "TotalCost = PriceSheet*SheetsCut") model.PlainConstraints.Add("RawAvail", "SheetsCut < SheetsAvail") model.PlainConstraints.Add("Sheets", "SheetsCut = SUM(patterns: PatternCount[patterns])") model.ConstraintVectors.Add("CutReq[cuts]", "SUM(patterns: CutsInPattern[patterns, cuts] * PatternCount[patterns]) CutDemand[cuts] + ExcessCuts[cuts]") except Exception as ex: print(str(ex)) result = model.LastResult return result Copyright © 2012 Maximal Software, Inc. All rights reserved 24
  • 25. Add Statements - IndexSet / DataVectors Adding IndexSet: cutNames = ['w1', 'w2', 'w3', 'w4', 'w5', 'w6', 'w7', 'w8'] model.IndexSets.AddNameSet("cuts", cutNames) Adding DataVectors: cutDemand = [500, 400, 300, 450, 350, 200, 800, 200] model.DataVectors.AddDense("CutDemand[cuts]", cutDemand) cutsInPattern = ['p1', 'w1', 1, 'p1', 'w8', 1, 'p2', 'w2', 1, 'p2', 'w7', 1, . . . 'p28', 'w8', 5, 'p29', 'w8', 7] model.DataVectors.Add("CutsInPattern[patterns, cuts]", cutsInPattern) Copyright © 2012 Maximal Software, Inc. All rights reserved 25
  • 26. Exceptions with Detailed Syntax Error Messages Syntax Error: model.PlainConstraints.Add("TotCost", "TotalCost = PriceSheet */ SheetsCut") Exception Output: The PlainConstraints.Add('TotCost', expr='TotalCost = PriceSheet */ SheetsCut') method returned 'SyntaxError' (2) with the following error message: **** A minor mistake was found in line 1: 6. I expected to see either a number or a variable, but found instead '/'. File: C:MplWin4OptiMaxPythonCutStock Line: (line=1, col=43) SUBJECT TO TotCost: TotalCost = PriceSheet */ SheetsCut; ^ Copyright © 2012 Maximal Software, Inc. All rights reserved 26
  • 27. Exceptions with Wrong Data Types Syntax Error: cutNames = ['w1', 'w2', 'w3', 'w4', 'w5', 'w6', 'w7', 'w8'] model.DataConstants.Add("SheetsAvail", cutNames) Exception Output: The argument 'dataValue' for the 'DataConstants.Add('SheetsAvail', dataValue, dataAttr)' method cannot be assigned the value '['w1', 'w2', 'w3', 'w4', 'w5', 'w6', 'w7', 'w8']' of type 'list'. Quick fix: Please enter either a numeric or string value. Copyright © 2012 Maximal Software, Inc. All rights reserved 27
  • 28. Applications with MPL OptiMax • Model written in MPL • Data transferred to/from MPL through • Excel Ranges • Database Connection • Text files • End-User Application Building • User-Interface done in VB/CSharp/C-API/C++/Java/Phyton • Process Input from User • Control Solver Runs • Process Output from Model • Display graphs • Model solved with any supported solver No limits on size, speed, or robustness Copyright © 2012 Maximal Software, Inc. All rights reserved 28