Previous Page Next Page Contents

linopt::plot_data -- plot the feasible region of a linear program

Introduction

linopt::plot_data([constr, obj], vars) returns a graphical description of the feasible region of the linear program [constr, obj], and the line vertical to the objective function vector through the corner with the maximal objective function value found.

Call(s)

linopt::plot_data([constr, obj], vars)
linopt::plot_data([constr, obj <, NonNegative> <, seti>], vars)
linopt::plot_data([constr, obj <, NonNegative> <, All>], vars)
linopt::plot_data([constr, obj <, setn> <, seti>], vars)
linopt::plot_data([constr, obj <, setn> <, All>], vars)

Parameters

constr - a set or list of linear constraints
obj - a linear expression
seti - a set which contains identifiers interpreted as indeterminates
setn - a set which contains identifiers interpreted as indeterminates
vars - a list containing the two variables of the linear program described by constr and obj and the existing options

Options

All - all variables are constrained to be integer
NonNegative - all variables are constrained to be nonnegative

Returns

an expression describing a graphical object which can be used by plot2d.

Related Functions

linopt::maximize, linopt::minimize, linopt::corners

Details

Example 1

We plot the feasible region of the given linear program. Here the valid corners of the linear program are easy to see:

>> k := [[2*x + 2*y >= 4, -2*x + 4*y >= -2, -2*x + y >= -8,
          -2*x + y <= -2, y <= 6], x + y, NonNegative]:
   g := linopt::plot_data(k, [x, y]):
   plot2d(g):
     

In this example there is no difference if the Option NonNegative is given for the linear program or not:

>> k := [[2*x + 2*y >= 4, -2*x + 4*y >= -2, -2*x + y >= -8,
          -2*x + y <= -2, y <= 6], x + y]:
   g := linopt::plot_data(k, [x, y]):
   plot2d(g):
     
>> delete k, g:
     

Example 2

Now we give an example where one can see a difference if the variables are constrained to be nonnegative:

>> k := [[x + y >= -1, x + y <= 3], x + 2*y]:   
   g := linopt::plot_data(k, [x, y]):
   plot2d(g):
     
>> k := [[x + y >= -1, x + y <= 3], x + 2*y, NonNegative]:
   g := linopt::plot_data(k, [x, y]):
   plot2d(g):
     
>> delete k, g:
     

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000