[Symphony] Bug in Symphony uisng vc++10

Yacine Gaoua y.gaoua at yahoo.com
Mon Mar 27 11:19:45 EDT 2017


Hi Ted,
I post the problem on Symphony mailing list for the benefit of community.
I built a new example using only CoinOR classes (on windows using vc++2010).
In the code attached, when the solver is CLP/CBC corresponding to solver_id=0 => its OK, but when solver is SYMPHONY (solver_id=1) i get a bug with an error window but when i click on several times the problem is solved.
Thank you for your help
Yacine,

#include "stdafx.h"
#include <stdio.h>#include <tchar.h>#include <stdlib.h>#include <iostream>#include <string>#include <vector>#include <cmath>
#include "OsiClp/OsiClpSolverInterface.hpp"#include "SYMPHONY\src\OsiSym\OsiSymSolverInterface.hpp"#include "OsiSolverInterface.hpp"#include "CoinBuild.hpp"#include "CoinModel.hpp"
using namespace std;
int main(int argc, char *argv[]){  vector<OsiSolverInterface*> vecSi; OsiSolverInterface* solver1 = new OsiClpSolverInterface(); OsiSolverInterface* solver2 = new OsiSymSolverInterface(); vecSi.push_back(solver1); vecSi.push_back(solver2);    int solver_id = 0;
 double objValue[]={1.0,2.0,0.0,0.0,0.0,0.0,0.0,-1.0}; double columnLower[]={2.5,0.0,0.0,0.0,0.5,0.0,0.0,0.0}; double columnUpper[]={COIN_DBL_MAX,4.1,1.0,1.0,4.0,COIN_DBL_MAX,COIN_DBL_MAX,4.3}; double rowLower[]={2.5,-COIN_DBL_MAX,-COIN_DBL_MAX,1.8,3.0}; double rowUpper[]={COIN_DBL_MAX,2.1,4.0,5.0,15.0}; int column[] = {0,1,3,4,7, 1,2, 2,5, 3,6, 4,7}; double element[] = {3.0,1.0,-2.0,-1.0,-1.0, 2.0,1.1, 1.0,1.0, 2.8,-1.2, 1.0,1.9}; int starts[]={0,5,7,9,11,13};
 // Integer variables (note upper bound already 1.0) int whichInt[]={2,3}; int numberRows=(int) (sizeof(rowLower)/sizeof(double)); int numberColumns=(int) (sizeof(columnLower)/sizeof(double));
 // Using CoinBuild // First do columns (objective and bounds) // We are not adding elements for (int i=0;i<numberColumns;i++)   {    vecSi[solver_id]->addCol(0,NULL,NULL,columnLower[i],columnUpper[i], objValue[i]);    }
       // mark as integer   for (int i=0;i<(int) (sizeof(whichInt)/sizeof(int));i++)   {   vecSi[solver_id]->setInteger(whichInt[i]);   }
   // Now build rows   CoinBuild build;   for (int i=0;i<numberRows;i++)   {     int startRow = starts[i];     int numberInRow = starts[i+1]-starts[i];     build.addRow(numberInRow,column+startRow,element+startRow, rowLower[i],rowUpper[i]);   } 
   // add rows into solver   vecSi[solver_id]->addRows(build);   vecSi[solver_id]->writeLp("problem");   vecSi[solver_id]->initialSolve();   vecSi[solver_id]->branchAndBound();      cout<<"Objective: "<<vecSi[solver_id]->getObjValue()<<endl;
  system("pause");
 return 0;}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/symphony/attachments/20170327/74baedc2/attachment-0001.html>


More information about the Symphony mailing list