lemon/lp_skeleton.cc
author Peter Kovacs <kpeter@inf.elte.hu>
Fri, 17 Apr 2009 18:04:36 +0200
changeset 609 e6927fe719e6
parent 458 7afc121e0689
child 540 9db62975c32b
permissions -rw-r--r--
Support >= and <= constraints in NetworkSimplex (#219, #234)

By default the same inequality constraints are supported as by
Circulation (the GEQ form), but the LEQ form can also be selected
using the problemType() function.

The documentation of the min. cost flow module is reworked and
extended with important notes and explanations about the different
variants of the problem and about the dual solution and optimality
conditions.
deba@458
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
deba@458
     2
 *
deba@458
     3
 * This file is a part of LEMON, a generic C++ optimization library.
deba@458
     4
 *
deba@458
     5
 * Copyright (C) 2003-2008
deba@458
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
deba@458
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@458
     8
 *
deba@458
     9
 * Permission to use, modify and distribute this software is granted
deba@458
    10
 * provided that this copyright notice appears in all copies. For
deba@458
    11
 * precise terms see the accompanying LICENSE file.
deba@458
    12
 *
deba@458
    13
 * This software is provided "AS IS" with no warranty of any kind,
deba@458
    14
 * express or implied, and with no claim as to its suitability for any
deba@458
    15
 * purpose.
deba@458
    16
 *
deba@458
    17
 */
deba@458
    18
deba@458
    19
#include <lemon/lp_skeleton.h>
deba@458
    20
deba@458
    21
///\file
deba@458
    22
///\brief A skeleton file to implement LP solver interfaces
deba@458
    23
namespace lemon {
deba@458
    24
deba@459
    25
  int SkeletonSolverBase::_addCol()
deba@458
    26
  {
deba@458
    27
    return ++col_num;
deba@458
    28
  }
deba@458
    29
deba@459
    30
  int SkeletonSolverBase::_addRow()
deba@458
    31
  {
deba@458
    32
    return ++row_num;
deba@458
    33
  }
deba@458
    34
deba@459
    35
  void SkeletonSolverBase::_eraseCol(int) {}
deba@459
    36
  void SkeletonSolverBase::_eraseRow(int) {}
deba@459
    37
deba@459
    38
  void SkeletonSolverBase::_getColName(int, std::string &) const {}
deba@459
    39
  void SkeletonSolverBase::_setColName(int, const std::string &) {}
deba@459
    40
  int SkeletonSolverBase::_colByName(const std::string&) const { return -1; }
deba@459
    41
deba@459
    42
  void SkeletonSolverBase::_getRowName(int, std::string &) const {}
deba@459
    43
  void SkeletonSolverBase::_setRowName(int, const std::string &) {}
deba@459
    44
  int SkeletonSolverBase::_rowByName(const std::string&) const { return -1; }
deba@459
    45
deba@459
    46
  void SkeletonSolverBase::_setRowCoeffs(int, ExprIterator, ExprIterator) {}
deba@459
    47
  void SkeletonSolverBase::_getRowCoeffs(int, InsertIterator) const {}
deba@459
    48
deba@459
    49
  void SkeletonSolverBase::_setColCoeffs(int, ExprIterator, ExprIterator) {}
deba@459
    50
  void SkeletonSolverBase::_getColCoeffs(int, InsertIterator) const {}
deba@459
    51
deba@459
    52
  void SkeletonSolverBase::_setCoeff(int, int, Value) {}
deba@459
    53
  SkeletonSolverBase::Value SkeletonSolverBase::_getCoeff(int, int) const
deba@459
    54
  { return 0; }
deba@459
    55
deba@459
    56
  void SkeletonSolverBase::_setColLowerBound(int, Value) {}
deba@459
    57
  SkeletonSolverBase::Value SkeletonSolverBase::_getColLowerBound(int) const
deba@459
    58
  {  return 0; }
deba@459
    59
deba@459
    60
  void SkeletonSolverBase::_setColUpperBound(int, Value) {}
deba@459
    61
  SkeletonSolverBase::Value SkeletonSolverBase::_getColUpperBound(int) const
deba@459
    62
  {  return 0; }
deba@459
    63
deba@459
    64
  void SkeletonSolverBase::_setRowLowerBound(int, Value) {}
deba@459
    65
  SkeletonSolverBase::Value SkeletonSolverBase::_getRowLowerBound(int) const
deba@459
    66
  {  return 0; }
deba@459
    67
deba@459
    68
  void SkeletonSolverBase::_setRowUpperBound(int, Value) {}
deba@459
    69
  SkeletonSolverBase::Value SkeletonSolverBase::_getRowUpperBound(int) const
deba@459
    70
  {  return 0; }
deba@459
    71
deba@459
    72
  void SkeletonSolverBase::_setObjCoeffs(ExprIterator, ExprIterator) {}
deba@459
    73
  void SkeletonSolverBase::_getObjCoeffs(InsertIterator) const {};
deba@459
    74
deba@459
    75
  void SkeletonSolverBase::_setObjCoeff(int, Value) {}
deba@459
    76
  SkeletonSolverBase::Value SkeletonSolverBase::_getObjCoeff(int) const
deba@459
    77
  {  return 0; }
deba@459
    78
deba@459
    79
  void SkeletonSolverBase::_setSense(Sense) {}
deba@459
    80
  SkeletonSolverBase::Sense SkeletonSolverBase::_getSense() const
deba@459
    81
  { return MIN; }
deba@459
    82
deba@459
    83
  void SkeletonSolverBase::_clear() {
deba@459
    84
    row_num = col_num = 0;
deba@458
    85
  }
deba@458
    86
deba@459
    87
  LpSkeleton::SolveExitStatus LpSkeleton::_solve() { return SOLVED; }
deba@458
    88
deba@459
    89
  LpSkeleton::Value LpSkeleton::_getPrimal(int) const { return 0; }
deba@459
    90
  LpSkeleton::Value LpSkeleton::_getDual(int) const { return 0; }
deba@459
    91
  LpSkeleton::Value LpSkeleton::_getPrimalValue() const { return 0; }
deba@458
    92
deba@459
    93
  LpSkeleton::Value LpSkeleton::_getPrimalRay(int) const { return 0; }
deba@459
    94
  LpSkeleton::Value LpSkeleton::_getDualRay(int) const { return 0; }
deba@458
    95
deba@459
    96
  LpSkeleton::ProblemType LpSkeleton::_getPrimalType() const
deba@459
    97
  { return UNDEFINED; }
deba@458
    98
deba@459
    99
  LpSkeleton::ProblemType LpSkeleton::_getDualType() const
deba@459
   100
  { return UNDEFINED; }
deba@458
   101
deba@459
   102
  LpSkeleton::VarStatus LpSkeleton::_getColStatus(int) const
deba@459
   103
  { return BASIC; }
deba@458
   104
deba@459
   105
  LpSkeleton::VarStatus LpSkeleton::_getRowStatus(int) const
deba@459
   106
  { return BASIC; }
deba@458
   107
deba@459
   108
  LpSkeleton* LpSkeleton::_newSolver() const
deba@459
   109
  { return static_cast<LpSkeleton*>(0); }
deba@458
   110
deba@459
   111
  LpSkeleton* LpSkeleton::_cloneSolver() const
deba@459
   112
  { return static_cast<LpSkeleton*>(0); }
deba@458
   113
deba@459
   114
  const char* LpSkeleton::_solverName() const { return "LpSkeleton"; }
deba@458
   115
deba@459
   116
  MipSkeleton::SolveExitStatus MipSkeleton::_solve()
deba@459
   117
  { return SOLVED; }
deba@458
   118
deba@459
   119
  MipSkeleton::Value MipSkeleton::_getSol(int) const { return 0; }
deba@459
   120
  MipSkeleton::Value MipSkeleton::_getSolValue() const { return 0; }
deba@458
   121
deba@459
   122
  MipSkeleton::ProblemType MipSkeleton::_getType() const
deba@459
   123
  { return UNDEFINED; }
deba@458
   124
deba@459
   125
  MipSkeleton* MipSkeleton::_newSolver() const
deba@459
   126
  { return static_cast<MipSkeleton*>(0); }
deba@458
   127
deba@459
   128
  MipSkeleton* MipSkeleton::_cloneSolver() const
deba@459
   129
  { return static_cast<MipSkeleton*>(0); }
deba@458
   130
deba@459
   131
  const char* MipSkeleton::_solverName() const { return "MipSkeleton"; }
deba@458
   132
deba@458
   133
} //namespace lemon
deba@458
   134