lemon/mip_cplex.cc~
changeset 2220 4473c872599a
parent 2219 c263168e0964
child 2221 c7261e981330
     1.1 --- a/lemon/mip_cplex.cc~	Mon Sep 25 08:50:36 2006 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,135 +0,0 @@
     1.4 -/* -*- C++ -*-
     1.5 - *
     1.6 - * This file is a part of LEMON, a generic C++ optimization library
     1.7 - *
     1.8 - * Copyright (C) 2003-2006
     1.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11 - *
    1.12 - * Permission to use, modify and distribute this software is granted
    1.13 - * provided that this copyright notice appears in all copies. For
    1.14 - * precise terms see the accompanying LICENSE file.
    1.15 - *
    1.16 - * This software is provided "AS IS" with no warranty of any kind,
    1.17 - * express or implied, and with no claim as to its suitability for any
    1.18 - * purpose.
    1.19 - *
    1.20 - */
    1.21 -
    1.22 -#ifndef LEMON_MIP_CPLEX_CC
    1.23 -#define LEMON_MIP_CPLEX_CC
    1.24 -
    1.25 -///\file
    1.26 -///\brief Implementation of the LEMON-CPLEX mip solver interface.
    1.27 -
    1.28 -#include <lemon/mip_cplex.h>
    1.29 -
    1.30 -namespace lemon {
    1.31 -  
    1.32 -  MipCplex::MipCplex() {
    1.33 -    //This is unnecessary: setting integrality constraints on
    1.34 -    //variables will set this, too 
    1.35 -
    1.36 -    ///\todo The constant CPXPROB_MIP is
    1.37 -    ///called CPXPROB_MILP in later versions
    1.38 -    CPXchgprobtype( env,  lp, CPXPROB_MIP);
    1.39 -  }
    1.40 -
    1.41 -  void MipCplex::_colType(int i, MipCplex::ColTypes col_type){
    1.42 -
    1.43 -    // Note If a variable is to be changed to binary, a call to CPXchgbds
    1.44 -    // should also be made to change the bounds to 0 and 1.
    1.45 -
    1.46 -    int indices[1];
    1.47 -    indices[0]=i;
    1.48 -    char ctype[1];
    1.49 -    switch (col_type){
    1.50 -      case INTEGER:
    1.51 -	ctype[0]=CPX_INTEGER;//'I'
    1.52 -	break;
    1.53 -      case REAL:
    1.54 -	ctype[0]=CPX_CONTINUOUS	;//'C'
    1.55 -	break;
    1.56 -    default:;
    1.57 -        //FIXME problem
    1.58 -    }
    1.59 -    CPXchgctype (env, lp, 1, indices, ctype);
    1.60 -  }
    1.61 -  
    1.62 -  MipCplex::ColTypes MipCplex::_colType(int i){
    1.63 -    
    1.64 -    char ctype[1];
    1.65 -    status = CPXgetctype (env, lp, ctype, i, i);
    1.66 -    std::cout<<"Kukucska: "<<INTEGER<<std::endl;
    1.67 -    return REAL;
    1.68 -//     switch (ctype[0]){
    1.69 -
    1.70 -//     case CPX_INTEGER:
    1.71 -//       return INTEGER;
    1.72 -//     case CPX_CONTINUOUS:
    1.73 -//       return REAL;
    1.74 -//     default:
    1.75 -//       return REAL;//Error!
    1.76 -//     }
    1.77 -
    1.78 -  }
    1.79 -  
    1.80 -  LpCplex::SolveExitStatus MipCplex::_solve(){
    1.81 -
    1.82 -    status = CPXmipopt (env, lp);
    1.83 -    if (status==0)
    1.84 -      return SOLVED;
    1.85 -    else
    1.86 -      return UNSOLVED;
    1.87 -
    1.88 -  }
    1.89 -
    1.90 -
    1.91 -  LpCplex::SolutionStatus MipCplex::_getMipStatus(){
    1.92 -
    1.93 -    int stat = CPXgetstat(env, lp);
    1.94 -
    1.95 -    //Fortunately, MIP statuses did not change for cplex 8.0
    1.96 -    switch (stat)
    1.97 -    {
    1.98 -      case CPXMIP_OPTIMAL:
    1.99 -        return OPTIMAL;
   1.100 -	//This also exists in later issues
   1.101 -	//    case CPXMIP_UNBOUNDED:
   1.102 -        //return INFINITE;
   1.103 -      case CPXMIP_INFEASIBLE:
   1.104 -        return INFEASIBLE;
   1.105 -      default:
   1.106 -        return UNDEFINED;
   1.107 -    }
   1.108 -    //Unboundedness not treated well: the following is from cplex 9.0 doc
   1.109 -    // About Unboundedness
   1.110 -
   1.111 -    // The treatment of models that are unbounded involves a few
   1.112 -    // subtleties. Specifically, a declaration of unboundedness means that
   1.113 -    // ILOG CPLEX has determined that the model has an unbounded
   1.114 -    // ray. Given any feasible solution x with objective z, a multiple of
   1.115 -    // the unbounded ray can be added to x to give a feasible solution
   1.116 -    // with objective z-1 (or z+1 for maximization models). Thus, if a
   1.117 -    // feasible solution exists, then the optimal objective is
   1.118 -    // unbounded. Note that ILOG CPLEX has not necessarily concluded that
   1.119 -    // a feasible solution exists. Users can call the routine CPXsolninfo
   1.120 -    // to determine whether ILOG CPLEX has also concluded that the model
   1.121 -    // has a feasible solution.
   1.122 -      
   1.123 -  }  
   1.124 -
   1.125 -  MipCplex::Value MipCplex::_getPrimal(int i){
   1.126 -    Value x;
   1.127 -    CPXgetmipx(env, lp, &x, i, i);
   1.128 -    return x;
   1.129 -  }
   1.130 -  
   1.131 -  MipCplex::Value MipCplex::_getPrimalValue(){
   1.132 -    Value objval;
   1.133 -    status = CPXgetmipobjval(env, lp, &objval);
   1.134 -    return objval;
   1.135 -  }
   1.136 -} //END OF NAMESPACE LEMON
   1.137 -
   1.138 -#endif //END OF MIP_CPLEX_CC