source: html/userguide/ch02s02.html @ 2182

Last change on this file since 2182 was 966, checked in by ddelanu, 16 years ago

Temporary version, trying to fix problems in server change, real release to follow

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>
2  First Example
3  </title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="CLP User Guide"><link rel="up" href="ch02.html" title="Chapter 2. 
4  Basic Model Classes
5  "><link rel="prev" href="ch02.html" title="Chapter 2. 
6  Basic Model Classes
7  "><link rel="next" href="ch02s03.html" title="
8  Getting at the Solution
9  "></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
10  First Example
11  </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
12  Basic Model Classes
13  </th><td width="20%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="firstexample"></a>
14  First Example
15  </h2></div></div></div><p>
16  Below is our first CLP sample program.  It is short enough to present in full
17  (this code can be found in the CLP Samples directory, see
18  <a href="ch04.html" title="Chapter 4. 
19More Samples
20">Chapter 4, <i>
21More Samples
22</i></a>).  Most of the remaining examples in this Guide
23  will take the form of small code fragments.
24  </p><div class="example"><a name="id4768485"></a><p class="title"><b>Example 2.1. minimum.cpp</b></p><pre class="programlisting">
25   
26// Copyright (C) 2002, International Business Machines
27// Corporation and others.  All Rights Reserved.
28
29#include "ClpSimplex.hpp"
30int main (int argc, const char *argv[])
31{
32  ClpSimplex  model;
33  int status;
34  if (argc&lt;2)
35    status=model.readMps("../../Mps/Sample/p0033.mps");
36  else
37    status=model.readMps(argv[1]);
38  if (!status) {
39    model.primal();
40  }
41  return 0;
42}
43     
44  </pre></div><p>
45  This sample program creates a  <tt class="classname">ClpSimplex</tt> model,
46  reads an MPS file, and if there are no errors, solves it using the primal
47  algorithm.  The program is easy to follow, but it is not terribly useful:
48  it does not attempt to inspect the results of the solve.  There are two main
49  kinds of results: a "status" describing what happened to the model
50  during the solve, and arrays filled with solution values.  Both will be
51  addressed in this chapter.
52  </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. 
53  Basic Model Classes
54   </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
55  Getting at the Solution
56  </td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.