| 449 | assert(!"Cddlib reported error when called by Gfanlib."); |
| 450 | } |
| 451 | ZVector relativeInteriorPoint(const ZMatrix &inequalities, const ZMatrix &equations) |
| 452 | { |
| 453 | QVector retUnscaled(inequalities.getWidth()); |
| 454 | ensureCddInitialisation(); |
| 455 | int numberOfEqualities=equations.getHeight(); |
| 456 | int numberOfInequalities=inequalities.getHeight(); |
| 457 | int numberOfRows=numberOfEqualities+numberOfInequalities; |
| 458 | |
| 459 | // dd_rowset r=NULL; |
| 460 | ZMatrix g=inequalities; |
| 461 | g.append(equations); |
| 462 | |
| 463 | dd_LPSolverType solver=dd_DualSimplex; |
| 464 | dd_MatrixPtr A=NULL; |
| 465 | dd_ErrorType err=dd_NoError; |
| 466 | |
| 467 | A=ZMatrix2MatrixGmp(g,&err); |
| 468 | if (err!=dd_NoError) goto _L99; |
| 469 | { |
| 470 | dd_LPSolutionPtr lps1; |
| 471 | dd_LPPtr lp,lp1; |
| 472 | |
| 473 | for(int i=0;i<numberOfInequalities;i++) |
| 474 | dd_set_si(A->matrix[i][0],-1); |
| 475 | for(int i=numberOfInequalities;i<numberOfRows;i++) |
| 476 | set_addelem(A->linset,i+1); |
| 477 | |
| 478 | A->objective=dd_LPmax; |
| 479 | lp=dd_Matrix2LP(A, &err); |
| 480 | if (err!=dd_NoError) goto _L99; |
| 481 | |
| 482 | lp1=dd_MakeLPforInteriorFinding(lp); |
| 483 | dd_LPSolve(lp1,solver,&err); |
| 484 | if (err!=dd_NoError) goto _L99; |
| 485 | |
| 486 | lps1=dd_CopyLPSolution(lp1); |
| 487 | |
| 488 | assert(!dd_Negative(lps1->optvalue)); |
| 489 | |
| 490 | for (int j=1; j <(lps1->d)-1; j++) |
| 491 | retUnscaled[j-1]=Rational(lps1->sol[j]); |
| 492 | |
| 493 | dd_FreeLPData(lp); |
| 494 | dd_FreeLPSolution(lps1); |
| 495 | dd_FreeLPData(lp1); |
| 496 | dd_FreeMatrix(A); |
| 497 | return QToZVectorPrimitive(retUnscaled); |
| 498 | } |
| 499 | _L99: |
| 500 | assert(0); |
| 501 | return QToZVectorPrimitive(retUnscaled); |
| 502 | } |
| 503 | void dual(ZMatrix const &inequalities, ZMatrix const &equations, ZMatrix &dualInequalities, ZMatrix &dualEquations) |
| 504 | { |
| 505 | int result; |
no test coverage detected