source: html/trunk/Clp/userguide/ch02s02.html @ 956

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

First revision of user guide

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 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.65.1"><link rel="home" href="index.html" title="CLP User Manual"><link rel="up" href="ch02.html" title="Chapter 2. 
4  Basic Model Classes
5  "><link rel="previous" 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="id4757757"></a>
14  First Example
15  </h2></div></div><div></div></div><p>
16  Below is our first CLP example code.  It is short enough to present in full.
17  Most of the remaining examples in this Guide will take the form of small code
18  fragments.
19  </p><div class="example"><a name="id4757769"></a><p class="title"><b>Example 2.1. minimum.cpp</b></p><pre class="programlisting">
20   
21// Copyright (C) 2002, International Business Machines
22// Corporation and others.  All Rights Reserved.
23
24#include "ClpSimplex.hpp"
25int main (int argc, const char *argv[])
26{
27  ClpSimplex  model;
28  int status;
29  if (argc&lt;2)
30    status=model.readMps("../../Mps/Sample/p0033.mps");
31  else
32    status=model.readMps(argv[1]);
33  if (!status) {
34    model.primal();
35  }
36  return 0;
37}
38     
39  </pre></div><p>
40  This sample program creates a default <tt class="classname">ClpSimplex</tt> model,
41  reads an MPS file, and if there are no errors, solves it using the primal
42  algorithm.  Simple, but not terribly useful: there is no way to inspect the
43  results of the solve.  There are two main kinds of results: a status saying
44  what happened to the model, and arrays filled with the solution values.
45  </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. 
46  Basic Model Classes
47   </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
48  Getting at the Solution
49  </td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.