Changeset 1577:15098fb5275c in lemon-0.x for demo/lp_demo.cc
- Timestamp:
- 07/20/05 18:05:04 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2078
- 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 1 27 #ifdef HAVE_CONFIG_H 2 28 #include <config.h> … … 14 40 using namespace lemon; 15 41 42 43 16 44 #ifdef HAVE_GLPK 17 45 typedef LpGlpk LpDefault; 46 const char default_solver_name[]="GLPK"; 18 47 #elif HAVE_CPLEX 19 48 typedef LpCplex LpDefault; 49 const char default_solver_name[]="CPLEX"; 20 50 #endif 21 51 … … 30 60 typedef LpDefault::Col Col; 31 61 62 63 std::cout<<"A program demonstrating the LEMON LP solver interface"<<std::endl; 64 std::cout<<"Solver used: "<<default_solver_name<<std::endl; 32 65 33 66 //This will be a maximization … … 55 88 //Print results 56 89 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", 58 92 lp.primalValue(), 59 93 lp.primal(x1), lp.primal(x2), lp.primal(x3));
Note: See TracChangeset
for help on using the changeset viewer.