Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: linprog: displaying all solutions

Subject: linprog: displaying all solutions

From: H A

Date: 13 May, 2008 22:53:02

Message: 1 of 5


Hi,

I am using linprog to solve a linear programming problem
with the following call:

options=optimset
('LargeScale', 'off', 'Simplex', 'on', 'Diagnostics', 'on',
'Display', 'iter', 'MaxIter', 10000, 'TolFun', 10e-8);

[d,fval,exitflag]=linprog(fM,AM,bM,[],[],0,1,[],options)

I'd like to see all intermediate solutions of fval and d
(my variable set) that the program generates, while it is
converging. Is there a way of doing this? Setting the
display option to iter lets me see the objective function
values, but I haven't been able to find a way to see the d
(solution set) values.

The reason I am trying to see all intermediate values is
that I suspect that my problem has multiple optimal
solutions. So I'm just trying to see all the solutions that
linprog was able to generate... Is there an alternative way
of doing this?

I also have another related question: When I set display
to "iter", what do the "Dual Infeasibility" values that are
displayed imply?

Thanks a bunch for all your help!
h

Subject: Re: linprog: displaying all solutions

From: helper

Date: 13 May, 2008 23:30:22

Message: 2 of 5


> options=optimset
>
('LargeScale', 'off', 'Simplex', 'on', 'Diagnostics', 'on',
> 'Display', 'iter', 'MaxIter', 10000, 'TolFun', 10e-8);
>
> [d,fval,exitflag]=linprog(fM,AM,bM,[],[],0,1,[],options)
>
> I'd like to see all intermediate solutions of fval and d
> (my variable set) that the program generates, while it is
> converging.




Use the "OutputFcn" property of the options structure.
Check the documentation for OutputFcn.



 
> I also have another related question: When I set display
> to "iter", what do the "Dual Infeasibility" values that
are displayed imply?




Searching the MATLAB doc for "Dual Infeasibility" led me to
a line that says:

Dual Infeasibility: A'*y+z-w-f

I'm not even going to start to explain what this means
(because I won't be able to do it well). But I am hoping
Mr. D'Errico can and will explain it (well).



Subject: Re: linprog: displaying all solutions

From: Bruno Luong

Date: 14 May, 2008 08:14:02

Message: 3 of 5

"H A" <cositsjunk@yahoo.com> wrote in message
<g0d64e$97i$1@fred.mathworks.com>...
>
> The reason I am trying to see all intermediate values is
> that I suspect that my problem has multiple optimal
> solutions. So I'm just trying to see all the solutions that
> linprog was able to generate... Is there an alternative way
> of doing this?
>

You might take a look at the Lagrange variable (lambda)
output. Combined lambda with cost coefficients, you can see
whereas your LP is degenerated or not.

Bruno

Subject: Re: linprog: displaying all solutions

From: H A

Date: 14 May, 2008 16:12:03

Message: 4 of 5

"helper " <spamless@nospam.com> wrote in message
<g0d8ae$n3k$1@fred.mathworks.com>...
>
> > options=optimset
> >
>
('LargeScale', 'off', 'Simplex', 'on', 'Diagnostics', 'on',
> > 'Display', 'iter', 'MaxIter', 10000, 'TolFun', 10e-8);
> >
> > [d,fval,exitflag]=linprog(fM,AM,bM,[],[],0,1,[],options)
> >
> > I'd like to see all intermediate solutions of fval and
d
> > (my variable set) that the program generates, while it
is
> > converging.
>
>
>
>
> Use the "OutputFcn" property of the options structure.
> Check the documentation for OutputFcn.
>
>
>
>
> > I also have another related question: When I set
display
> > to "iter", what do the "Dual Infeasibility" values that
> are displayed imply?
>
>
>
>
> Searching the MATLAB doc for "Dual Infeasibility" led me
to
> a line that says:
>
> Dual Infeasibility: A'*y+z-w-f
>
> I'm not even going to start to explain what this means
> (because I won't be able to do it well). But I am hoping
> Mr. D'Errico can and will explain it (well).
>
>
>

Thanks for your responses.

I tried using OutputFcn as follows:

.....................................

history.x = []; history.fval = [];

options=optimset('OutputFcn',
@outfun, 'LargeScale', 'off', 'Simplex', 'on', 'Diagnostics'
, 'on', 'Display', 'iter', 'MaxIter', 10000, 'TolFun', 10e-
8);

[d,fval,exitflag]=linprog(fM,AM,bM,[],[],0,1,[],options);

function stop = outfun (x, optimValues, state)
    stop = false;
    switch state
        case 'iter'
            history.fval = [history.fval; optimValues.fval];
            history.x = [history.x; x];
        otherwise
    end
end

history.fval
history.x

.....................................

But both history.fval and history.x come back empty... am I
missing something?

Thanks!
h

Subject: Re: linprog: displaying all solutions

From: H A

Date: 14 May, 2008 16:32:02

Message: 5 of 5

"helper " <spamless@nospam.com> wrote in message
<g0d8ae$n3k$1@fred.mathworks.com>...
>
> > options=optimset
> >
>
('LargeScale', 'off', 'Simplex', 'on', 'Diagnostics', 'on',
> > 'Display', 'iter', 'MaxIter', 10000, 'TolFun', 10e-8);
> >
> > [d,fval,exitflag]=linprog(fM,AM,bM,[],[],0,1,[],options)
> >
> > I'd like to see all intermediate solutions of fval and
d
> > (my variable set) that the program generates, while it
is
> > converging.
>
>
>
>
> Use the "OutputFcn" property of the options structure.
> Check the documentation for OutputFcn.
>
>
>
>
> > I also have another related question: When I set
display
> > to "iter", what do the "Dual Infeasibility" values that
> are displayed imply?
>
>
>
>
> Searching the MATLAB doc for "Dual Infeasibility" led me
to
> a line that says:
>
> Dual Infeasibility: A'*y+z-w-f
>
> I'm not even going to start to explain what this means
> (because I won't be able to do it well). But I am hoping
> Mr. D'Errico can and will explain it (well).
>
>
>

Thanks for your response.

I tried using OutputFcn as follows:

.....................................

history.x = []; history.fval = [];

options=optimset('OutputFcn',
@outfun, 'LargeScale', 'off', 'Simplex', 'on', 'Diagnostics'
, 'on', 'Display', 'iter', 'MaxIter', 10000, 'TolFun', 10e-
8);
[d,fval,exitflag]=linprog(fM,AM,bM,[],[],0,1,[],options);

function stop = outfun (x, optimValues, state)
    stop = false;
    switch state
        case 'iter'
            history.fval = [history.fval; optimValues.fval];
            history.x = [history.x; x];
        otherwise
    end
end

history.fval
history.x

.....................................

But both history.fval and history.x come back empty... am I
missing something?

Thanks!
h


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
linprog H A 13 May, 2008 18:55:06
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics