1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title> |
---|
2 | Building and Modifying a Model |
---|
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="ch02s03.html" title=" |
---|
6 | Getting at the Solution |
---|
7 | "><link rel="next" href="ch02s05.html" title="Tolerances"></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"> |
---|
8 | Building and Modifying a Model |
---|
9 | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><th width="60%" align="center">Chapter 2. |
---|
10 | Basic Model Classes |
---|
11 | </th><td width="20%" align="right"> <a accesskey="n" href="ch02s05.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="buildandmodify"></a> |
---|
12 | Building and Modifying a Model |
---|
13 | </h2></div></div></div><p> |
---|
14 | Rather than reading a model from an MPS file we can load a model from arrays |
---|
15 | in memory. There are various <tt class="function">loadProblem</tt> methods which |
---|
16 | are similar to those in OSI. It is easy to add more such methods to CLP if the need arises. |
---|
17 | </p><p>We can copy in integer information by |
---|
18 | <tt class="function">copyInIntegerInformation(const char * array)</tt> where array |
---|
19 | is 0 or 1 to say integer and we can drop existing information by |
---|
20 | <tt class="function">deleteIntegerInformation()</tt>. There are various ways of |
---|
21 | changing the size of a model. The simplest is by the use of the method |
---|
22 | <tt class="function">resize(newNumberRows,newNumberColumns)</tt> - this will either |
---|
23 | truncate the model or add "default" rows or columns - a default row |
---|
24 | has lower bound of -infinity and upper bound of +infinity, while a default |
---|
25 | column has zero cost, zero lower bound and an upper bound of +infinity. |
---|
26 | </p><p> |
---|
27 | Normally we would use <tt class="function">deleteRows</tt>, |
---|
28 | <tt class="function">addRows</tt>, <tt class="function">deleteColumns</tt> and |
---|
29 | <tt class="function">addColumns</tt>, where the <tt class="function">add</tt> methods |
---|
30 | will also add in the elements. A potentially very useful way of modifying a model is strictly a |
---|
31 | constructor. Given a large model and a list of rows and a list of columns it |
---|
32 | constructs the model as a subset of the large model. It is possible to change |
---|
33 | the order of the columns/rows and to duplicate columns/rows. So a list of |
---|
34 | columns 4,4,1,0 will create a new model where the first two columns are copies |
---|
35 | of column 4 in original model and the next two are the first two of original |
---|
36 | model in reverse order. This can be useful to form a model with piecewise |
---|
37 | linear costs by duplicating columns and then modifying bounds and costs. |
---|
38 | </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s03.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="ch02s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> |
---|
39 | Getting at the Solution |
---|
40 | </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Tolerances</td></tr></table></div></body></html> |
---|