COIN-OR::LEMON - Graph Library

Changeset 1577:15098fb5275c in lemon-0.x for demo/lp_demo.cc


Ignore:
Timestamp:
07/20/05 18:05:04 (19 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2078
Message:

Documentation (lp_demo,lp_maxflow) and slight changes (rest).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • demo/lp_demo.cc

    r1530 r1577  
     1/* -*- C++ -*-
     2 * demo/graph_to_eps.cc - Part of LEMON, a generic C++ optimization library
     3 *
     4 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     5 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     6 *
     7 * Permission to use, modify and distribute this software is granted
     8 * provided that this copyright notice appears in all copies. For
     9 * precise terms see the accompanying LICENSE file.
     10 *
     11 * This software is provided "AS IS" with no warranty of any kind,
     12 * express or implied, and with no claim as to its suitability for any
     13 * purpose.
     14 *
     15 */
     16
     17/// \ingroup demos
     18/// \file
     19/// \brief A program demonstrating the LEMON LP solver interface
     20///
     21/// This program is a simple application of the LEMON LP solver
     22/// interface: we formulate a linear programming (LP) problem and then
     23/// solve it using the underlying solver (GLPK or CPLEX for
     24/// example). For the detailed documentation of the LEMON LP solver
     25/// interface read \ref lemon::LpSolverBase "this".
     26
    127#ifdef HAVE_CONFIG_H
    228#include <config.h>
     
    1440using namespace lemon;
    1541
     42
     43
    1644#ifdef HAVE_GLPK
    1745typedef LpGlpk LpDefault;
     46const char default_solver_name[]="GLPK";
    1847#elif HAVE_CPLEX
    1948typedef LpCplex LpDefault;
     49const char default_solver_name[]="CPLEX";
    2050#endif
    2151
     
    3060  typedef LpDefault::Col Col;
    3161 
     62
     63  std::cout<<"A program demonstrating the LEMON LP solver interface"<<std::endl;
     64  std::cout<<"Solver used: "<<default_solver_name<<std::endl;
    3265
    3366  //This will be a maximization
     
    5588  //Print results
    5689  if (lp.primalStatus()==LpSolverBase::OPTIMAL){
    57     printf("Z = %g; x1 = %g; x2 = %g; x3 = %g\n",
     90    std::cout<<"Optimal solution found!"<<std::endl;
     91    printf("optimum value = %g; x1 = %g; x2 = %g; x3 = %g\n",
    5892           lp.primalValue(),
    5993           lp.primal(x1), lp.primal(x2), lp.primal(x3));
Note: See TracChangeset for help on using the changeset viewer.