src/work/athos/lp/lp_cplex.cc
author alpar
Tue, 05 Apr 2005 06:41:21 +0000
changeset 1303 9bcc455da4f5
parent 1299 e2545ef5d7d8
child 1319 6e277ba3fc76
permissions -rw-r--r--
SolutionStatus -> SolveExitStatus
SolutionType -> SolutionStatus
     1 /* -*- C++ -*-
     2  * src/lemon/lp_cplex.cc
     3  * - Part of LEMON, a generic C++ optimization library
     4  *
     5  * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * (Egervary Combinatorial Optimization Research Group, EGRES).
     7  *
     8  * Permission to use, modify and distribute this software is granted
     9  * provided that this copyright notice appears in all copies. For
    10  * precise terms see the accompanying LICENSE file.
    11  *
    12  * This software is provided "AS IS" with no warranty of any kind,
    13  * express or implied, and with no claim as to its suitability for any
    14  * purpose.
    15  *
    16  */
    17 
    18 #include"lp_cplex.h"
    19 
    20 ///\file
    21 ///\brief Implementation of the LEMON-CPLEX lp solver interface.
    22 namespace lemon {
    23   
    24   int LpCplex::_addCol()
    25   {
    26     int i = CPXgetnumcols (env, lp);
    27     int lb[1],ub[1];
    28     lb[0]=-INF;//-CPX_INFBOUND;
    29     ub[0]=INF;//CPX_INFBOUND;
    30     status = CPXnewcols (env, lp, 1, NULL, lb, ub, NULL, NULL);
    31     return i;
    32   }
    33   
    34   int LpCplex::_addRow() 
    35   {
    36     int i = CPXgetnumrows (env, lp);
    37     status = CPXnewrows (env, lp, 1, NULL, NULL, NULL, NULL, NULL);
    38     return i;
    39   }
    40   
    41   ///\warning Data at index 0 is ignored iin the arrays.
    42   void LpCplex::_setRowCoeffs(int i, 
    43 			      int length,
    44 			      int  const * indices, 
    45 			      Value  const * values )
    46   {
    47     int rowlist[length+1];
    48     for (int k=1;k<=length;++k){
    49       rowlist[k]=i;
    50     }
    51     status = CPXchgcoeflist(env, lp, 
    52 			    length, 
    53 			    rowlist++, 
    54 			    inices++, 
    55 			    values++);
    56   }
    57   
    58   void LpCplex::_setColCoeffs(int i, 
    59 			      int length,
    60 			      int  const * indices, 
    61 			      Value  const * values)
    62   {
    63     int collist[length+1];
    64     for (int k=1;k<=length;++k){
    65       collist[k]=i;
    66     }
    67     status = CPXchgcoeflist(env, lp, 
    68 			    length, 
    69 			    inices++, 
    70 			    collist++, 
    71 			    values++);
    72   }
    73   
    74   void LpCplex::_setColLowerBound(int i, Value value)
    75   {
    76   }
    77   
    78   void LpCplex::_setColUpperBound(int i, Value value)
    79   {
    80   }
    81   
    82   void LpCplex::_setRowLowerBound(int i, Value value)
    83   {
    84   }
    85   
    86   void LpCplex::_setRowUpperBound(int i, Value value)
    87   {
    88   }
    89   
    90   void LpCplex::_setObjCoeff(int i, Value obj_coef)
    91   {
    92   }
    93 
    94   LpCplex::SolutionStatus LpCplex::_solve()
    95   {
    96     return OPTIMAL;
    97   }
    98 
    99   LpCplex::Value LpCplex::_getSolution(int i)
   100   {
   101     return 0;
   102   }
   103   
   104 } //namespace lemon
   105