seminar: coinmp - open source solver - nov 2011
DESCRIPTION
TRANSCRIPT
![Page 1: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/1.jpg)
1Copyright © 2011 Maximal Software, Inc. All rights reserved
CoinMP - Open Source Solver
New CoinMP Release 1.6:
A Simple Free C-API Windows DLL and
Unix Solver Library (LP/MIP) based on COIN
Presented by
Bjarni Kristjansson
Maximal Software, Inc.
![Page 2: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/2.jpg)
2Copyright © 2011 Maximal Software, Inc. All rights reserved
Presentation Overview
• Why Callable Library of COIN? • What COIN functionality is supported?• Supported Platforms• Why implemented as C-API?• Description of the C-API interface• New upcoming release 1.6 of CoinMP• Future release 2.0 of CoinMP• Other open source solvers (GLPK, LPSolve)• Recent News and Trends in Optimization• New Academic/Free Development Programs
![Page 3: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/3.jpg)
3Copyright © 2011 Maximal Software, Inc. All rights reserved
Why Callable Library Version of COIN?
Main Design Goals for CoinMP:• Easy to use• High portability• No requirement to compile• Larger number of potential users• Can be used from any other application
Some users just want to use binaries!
![Page 4: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/4.jpg)
4Copyright © 2011 Maximal Software, Inc. All rights reserved
What COIN functionality is supported?
• Objects• ClpSimplex• CbcModel• OsiClpSolverInterface
• Callbacks• CBMessageHandler• CBIterHandler• CBNodeHandler
• Cuts• GglProbing, CglGomory, CglKnapsackCover, CglOddHole, CglClique,
CglLiftAndProject, CglSimpleRounding• Algorithmic
• Pivot Algorithms, Scaling, Crash, Perturbation, Primal/Dual, Barrier, Presolve, etc.
• Option Parameters
![Page 5: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/5.jpg)
5Copyright © 2011 Maximal Software, Inc. All rights reserved
Supported Platforms for CoinMP
• Microsoft Windows• Microsoft Visual Studio (v2008)• Cygwin/gcc• MinGW/gcc• MSys/cl
• Unix• Linux/gcc• OSX/gcc• SunOS/gcc
![Page 6: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/6.jpg)
6Copyright © 2011 Maximal Software, Inc. All rights reserved
Why implemented as C-API?
• Standard interface• Well established• Easy portability• Simple to learn
• High portability to other programming languages• Visual Basic• Java• C++• C#/VB.Net• Scripting
• Not object oriented!
![Page 7: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/7.jpg)
7Copyright © 2011 Maximal Software, Inc. All rights reserved
Standard Solver API Interfaces
All Solver Interfaces need to meet certain minimum requirements:
• Loading and Initializing the solver DLL• Query Solver Information• Create/Free Problem Object• Load Problem Elements
(matrix, init, integer, priority, semi-cont, SOS, quadratic, nonlinear, stochastic)
• Setup Callbacks/Log Handlers• Optimize Problem• Get Solution Values and Statistics (attributes)• File Handling (logs, basis, MPS, LP, XML, etc.)• Option Parameters (get, set)
Use existing standard interfaces – Do not reinvent the wheel!
![Page 8: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/8.jpg)
8Copyright © 2011 Maximal Software, Inc. All rights reserved
#ifndef _COINMP_H_
#define _COINMP_H_
SOLVAPI int CoinInitSolver(char* LicenseStr);
SOLVAPI int CoinFreeSolver(void);
SOLVAPI int CoinGetSolverName(char* SolverName, int buflen);
SOLVAPI int CoinGetVersionStr(char* VersionStr, int buflen);
SOLVAPI double CoinGetVersion(void);
SOLVAPI int CoinGetFeatures(void);
SOLVAPI int CoinGetMethods(void);
SOLVAPI double CoinGetInfinity(void);
SOLVAPI HPROB CoinCreateProblem(char *ProblemName);
SOLVAPI int CoinUnloadProb(HPROB hProb);
CoinMP C-API - Initialization
![Page 9: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/9.jpg)
9Copyright © 2011 Maximal Software, Inc. All rights reserved
CoinMP C-API – Loading Problem
SOLVAPI int CoinLoadProblem(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues, char** ColNames, char** RowNames, char* ObjectName);
SOLVAPI int CoinLoadInitValues(HPROB hProb, double* InitValues);
SOLVAPI int CoinLoadInteger(HPROB hProb, char* ColumnType);
SOLVAPI int CoinLoadPriority(HPROB hProb, int PriorCount, int* PriorIndex, int* PriorValues, int* BranchDir);
SOLVAPI int CoinLoadSemiCont(HPROB hProb, int* SemiCount, int* SemiIndex);
SOLVAPI int CoinLoadSos(HPROB hProb, int SosCount, int SosNZCount, int* SosType, int* SosPrior, int* SosBegin, int* SosIndex, double* SosRef);
SOLVAPI int CoinLoadQuadratic(HPROB hProb, int* QuadBegin, int* QuadCount, int* QuadIndex, double* QuadValues);
SOLVAPI int CoinLoadNonLinear(HPROB hProb, int NlpTreeCount, int NlpLineCount, int* NlpBegin, int* NlpOper, int* NlpArg1, int* NlpArg2, int* NlpIndex1, int* NlpIndex2, double* NlpValue1, double* NlpValue2);
![Page 10: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/10.jpg)
10Copyright © 2011 Maximal Software, Inc. All rights reserved
SOLVAPI int CoinSetMsgLogCallback(HPROB hProb, MSGLOGCALLBACK MsgLogCallback);
SOLVAPI int CoinSetIterCallback(HPROB hProb, ITERCALLBACK IterCallback);
SOLVAPI int CoinSetMipNodeCallback(HPROB hProb, MIPNODECALLBACK MipNodeCallback);
SOLVAPI int CoinOptimizeProblem(HPROB hProb, int Method);
SOLVAPI int CoinGetSolutionStatus(HPROB hProb);
SOLVAPI int CoinGetSolutionText(HPROB hProb, int SolutionStatus, char* SolutionText, int buflen);
SOLVAPI double CoinGetObjectValue(HPROB hProb);
SOLVAPI double CoinGetMipBestBound(HPROB hProb);
SOLVAPI int CoinGetIterCount(HPROB hProb);
SOLVAPI int CoinGetMipNodeCount(HPROB hProb);
SOLVAPI int CoinGetSolutionValues(HPROB hProb, double* Activity, double* ReducedCost, double* SlackValues, double* ShadowPrice);
SOLVAPI int CoinGetSolutionRanges(HPROB hProb, double* ObjLoRange, double* ObjUpRange, double* RhsLoRange, double* RhsUpRange);
SOLVAPI int CoinGetSolutionBasis(HPROB hProb, int* ColStatus, double* RowStatus);
CoinMP C-API - Solving
![Page 11: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/11.jpg)
11Copyright © 2011 Maximal Software, Inc. All rights reserved
SOLVAPI int CoinReadFile(HPROB hProb, int FileType, char* ReadFilename);
SOLVAPI int CoinWriteFile(HPROB hProb, int FileType, char* WriteFilename);
SOLVAPI int CoinOpenLogFile(HPROB hProb, char* LogFilename);
SOLVAPI int CoinCloseLogFile(HPROB hProb);
SOLVAPI int CoinGetOptionCount(HPROB hProb);
SOLVAPI int CoinGetOptionInfo(HPROB hProb, int OptionNr, int* OptionID, int* GroupType, int* OptionType, char* OptionName, char* ShortName, int buflen);
SOLVAPI int CoinGetIntOptionMinMax(HPROB hProb, int OptionNr, int* MinValue, int* MaxValue);
SOLVAPI int CoinSetRealOptionMinMax(HPROB hProb, int OptionNr, double* MinValue, double* MaxValue);
SOLVAPI int CoinGetIntOption(HPROB hProb, int OptionID);
SOLVAPI int CoinSetIntOption(HPROB hProb, int OptionID, int IntValue);
SOLVAPI double CoinGetRealOption(HPROB hProb, int OptionID);
SOLVAPI int CoinSetRealOption(HPROB hProb, int OptionID, double RealValue);
SOLVAPI int CoinGetStringOption(HPROB hProb, int OptionID, char* StringValue,
int buflen);
SOLVAPI int CoinSetStringOption(HPROB hProb, int OptionID, char* StringValue);
CoinMP C-API – File/Option Handling
![Page 12: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/12.jpg)
12Copyright © 2011 Maximal Software, Inc. All rights reserved
SOLVAPI int CoinLoadStochStages(HPROB hProb, int StageCount, int* VarStages, int* ConStages, char** StageNames);
SOLVAPI int CoinLoadStochTree(int ScenCount, int TreeType, int* TreeData, int* TreeData2);
SOLVAPI int CoinLoadStochScen(HPROB hProb, int ScenCount, double* ProbData,
int *TreeStageStart, int* ProbData, int* ScenBegin, int RandomCount,
int *RandomCol, int *RandomRow, double *RandomData, char** ScenNames);
SOLVAPI int CoinLoadStochIndep(HPROB hProb, int IndepCount, int* RandomCol, int* RandomRow, int* OutcomeCounts, int EventCount, double *ProbData,
double *RandomData, char** IndepNames, char** OutcomeNames, char** EventNames);
SOLVAPI int CoinLoadStochBlocks(HPROB hProb, int IndepCount, int* OutcomeCounts, int EventCount, double *ProbData, int* RandomCol, int* RandomRow, double *RandomData, char** IndepNames, char** OutcomeNames, char** EventNames);
CoinMP C-API – Stochastic
![Page 13: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/13.jpg)
13Copyright © 2011 Maximal Software, Inc. All rights reserved
New Release 1.6 of CoinMP
• New additions to the CoinMP API Interface• String arguments• Additional Option functions• Attribute handling (Gurobi style)
• CoinMP.cpp broken into separate modules:• CoinProblem.c• CoinOption.c• CoinAttr.c• CoinSolver.c• CoinCbc.cpp (driver)• CoinResult.c
• Preparations for the ability to support additional solvers• New example codes for Visual Basic, C#, and Java
![Page 14: Seminar: CoinMP - Open Source Solver - Nov 2011](https://reader030.vdocuments.net/reader030/viewer/2022020723/548bfd0eb4795983338b457e/html5/thumbnails/14.jpg)
14Copyright © 2011 Maximal Software, Inc. All rights reserved
Future Release 2.0 of CoinMP
• Add new solver drivers to CoinMP• OSI (DyLP, Volume, etc.)• Symphony• SMI (Stochastic)• IPOPT• CppAD• OS• Other
• Ability to switch between different solvers• Challenges
• More dependencies (checkout / compile)• Third-party libraries (Blas, HSL, Lapack, Mumps)• Complicates the release cycle (coordination issues)