Adept Scientific - English
The world's best software for research, science and engineering.
flag arrow
clearclear
 

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKusdedksvnofi
Home
Products
Training
Consultancy
 Buy Online
Downloads
Education
Support
My Adept
International |  About Us |  Contact Us |  Press Room |  Jobs


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request a Brochure
• Download a Demo
• Request a Demo
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 12 Professional
Maple 12 Academic
Maple 12 Student Use
Recorded Online Seminars
FREE Training Resources
Maple Application Briefs
Maple Adoption Program

MapleNet
Maple T.A.
MapleConnect
BlockImporter for Simulink
BlockBuilder for Simulink
Maple Toolboxes
Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
The Maple Reporter Online
Numerical Algorithms Group
(NAG)


Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] Simplex Bug (?)

Search email archive for  

[MUG] Simplex Bug (?)
Author: PierLuigi Zezza    Posted: Sun, 13 Oct 2002 22:31:18 +0200

>> From: PierLuigi Zezza "pzezza"

In the description of many commands of the simplex package one of the input
is a set or list of equations (the constraints). The use of a list of
equation can lead easily to wrong results as it is shown by the following
trivial example

> restart: with(simplex):
Warning, new definition for maximize
Warning, new definition for minimize
Constraints
> cnsts:={2*x[2]- x[3]<=3,x[1]-3*x[2]- x[3]<=2,x[1]+3*x[2]+x[3]<=5};

cnsts := {2 x[2] - x[3] <= 3, x[1] - 3 x[2] - x[3] <= 2,

x[1] + 3 x[2] + x[3] <= 5}

Objective function
> ob:=x[1]-3*x[2]+3*x[3];

ob := x[1] - 3 x[2] + 3 x[3]

Slack variables
> eqs:=setup(cnsts);

eqs := {_SL1 = 3 - 2 x[2] + x[3], _SL2 = 2 - x[1] + 3 x[2] + x[3],

_SL3 = 5 - x[1] - 3 x[2] - x[3]}

The pivot variable
> pivotvar(ob);

x[3]

THE RATIO TEST
> ratio(eqs,%);

{infinity, 5}

Since two of ratios are infinity we obtain a set of TWO elements (The pivot
equation should be the third and it will never be the one !!!)
> pivoteqn(eqs,%%);

[_SL2 = 2 - x[1] + 3 x[2] + x[3]]

> eqs:=pivot(eqs,pivotvar(ob),pivoteqn(eqs,pivotvar(ob)));

eqs := {x[3] = -2 + x[1] - 3 x[2] + _SL2,

_SL1 = 1 - 5 x[2] + x[1] + _SL2, _SL3 = 7 - 2 x[1] - _SL2}

> basis(%)=cterm(%);

{x[3], _SL1, _SL3} = {1, -2, 7}

and we end up with negative values !!!
gigi zezza


PierLuigi Zezza
"pzezza"

[MUG] Re: Simplex Bug (?)
Author: Robert Israel    Posted: Thu, 17 Oct 2002 15:33:51 -0700

>> From: Robert Israel "israel"

On the contrary, the problem comes from the use of a _set_ of equations
rather than a list. Since the ordering of elements of a set is arbitrary,
and duplicate entries are removed, it does not really make much sense to
use this on a set.

The description in the help page ?simplex,ratio is incorrect:

-------------
simplex[ratio] - return a list of ratios
...
C - set of linear equations
...
The call ratio(C, x) returns a list of ratios
...
-------------

It should say that C is a list or set of ratios, and ratio(C,x) returns
a list or set (whichever type is C). And there should probably be a
warning that if you use a set the results should not be expected to
be in the same order as the constraints. Since there may be some
rare cases where you would want to use this on a set (where you aren't
going to rely on the order of the results), I hesitate to say that
the use of a set here should be an error. But probably it should at
least result in a warning.

Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2

On Sun, 13 Oct 2002, PierLuigi Zezza wrote:

> In the description of many commands of the simplex package one of the input
> is a set or list of equations (the constraints). The use of a list of
> equation can lead easily to wrong results as it is shown by the following
> trivial example
>
> > restart: with(simplex):
> Warning, new definition for maximize
> Warning, new definition for minimize
> Constraints
> > cnsts:={2*x[2]- x[3]<=3,x[1]-3*x[2]- x[3]<=2,x[1]+3*x[2]+x[3]<=5};
>
> cnsts := {2 x[2] - x[3] <= 3, x[1] - 3 x[2] - x[3] <= 2,
>
> x[1] + 3 x[2] + x[3] <= 5}
>
> Objective function
> > ob:=x[1]-3*x[2]+3*x[3];
>
> ob := x[1] - 3 x[2] + 3 x[3]
>
> Slack variables
> > eqs:=setup(cnsts);
>
> eqs := {_SL1 = 3 - 2 x[2] + x[3], _SL2 = 2 - x[1] + 3 x[2] + x[3],
>
> _SL3 = 5 - x[1] - 3 x[2] - x[3]}
>
> The pivot variable
> > pivotvar(ob);
>
> x[3]
>
> THE RATIO TEST
> > ratio(eqs,%);
>
> {infinity, 5}
>
> Since two of ratios are infinity we obtain a set of TWO elements (The pivot
> equation should be the third and it will never be the one !!!)
> > pivoteqn(eqs,%%);
>
> [_SL2 = 2 - x[1] + 3 x[2] + x[3]]
>
> > eqs:=pivot(eqs,pivotvar(ob),pivoteqn(eqs,pivotvar(ob)));
>
> eqs := {x[3] = -2 + x[1] - 3 x[2] + _SL2,
>
> _SL1 = 1 - 5 x[2] + x[1] + _SL2, _SL3 = 7 - 2 x[1] - _SL2}
>
> > basis(%)=cterm(%);
>
> {x[3], _SL1, _SL3} = {1, -2, 7}
>
> and we end up with negative values !!!
> gigi zezza
>
>
> PierLuigi Zezza
> "pzezza"
>
>

Previous by date: [MUG] Problem with inequal, Dean Bernsten
Next by date: [MUG] convert question, Carl Eberhart
Previous thread: [MUG] Symbol display problem, Maple
Next thread: [MUG] convert question, Carl Eberhart



Ready to buy?

Maple - single user licence
Add to shopping basket
$ 1,895.00
Upgrade to Maple 12 from v11
Add to shopping basket
$ 995.00
Upgrade to Maple 12 from v10 & below
Add to shopping basket
$ 1,395.00

Featured Downloads

Maple White Paper: Technical Knowledge - An Asset You Can Afford to Lose?
Maple in Electronics Application Pack
Maple in Robotics & Aerospace Application Pack
Maple in Finance Application Pack

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks
adept

Top of the Page

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2007, Adept Scientific plc.
Site designed and maintained by Adeptise

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055