[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to rewrite this m.file?

From: Hans Zoebelein
Subject: How to rewrite this m.file?
Date: Mon, 8 Jun 1998 18:01:53 +0200 (CEST)

I'm stuck with a MATLAB m-file which is used to give
solutions for a two player zero sum game.


Here comes the m file:
---- begin sprs.m ----
% solves the linear programming problem for two-player zero-sum
% games derived from the Koller-Megiddo-Von Stengel algorithm.

% the current directory should contain the matrices A, E, F, e, f

t1 = cputime;

load A;
AS = spconvert(A);
load E;
ES = spconvert(E);
load F;
FS = spconvert(F);
load e;
load f;

%get dimensions
S = size(ES);
T = size(FS);

% extend e and f to cover yp entirely
j = [zeros(T(2), 1) ; e];
k = [f ; zeros(S(2), 1)];

% build constraint matrix
HS = [FS , zeros(T(1), S(1)) ; AS, -ES'];
H = full(HS);
SIZE = size(H)

% build bounds, with slight 'error' to simulate <=, >=
LB = [zeros(T(2), 1) ; -inf * ones(S(1), 1)];
UB = [ones(T(2), 1) ; inf * ones(S(1), 1)];

% solve lp problem
% (don't bother with lagrange multipliers for now)
[yp, lagrange] = lp(j, H, k, LB, UB, [], T(1));

% get y and p from solution
x = lagrange(T(1)+1 : T(1)+S(2));
y = yp(1 : T(2))
p = yp(T(2)+1 : T(2)+S(1))
q = lagrange(1 : T(1));

t2 = cputime;
TIME = t2 - t1

% save results
save x x -ascii;
save y y -ascii;
save p p -ascii;
save q q -ascii;
save lg lagrange -ascii;
save time TIME -ascii;
save size SIZE -ascii;
---- end sprs.m ----

The spconvert() function should be no problem (thanks to John W. Eaton)
Main problem for me is the lp() function. Since I'm a non mathematician
I'm standing before a locked door. How could the MATLAB lp() function
be replaced in OCTAVE?


Hans Zoebelein             * You are interested in Linux blind support?
address@hidden    * Join the blinux mailing list and mail to:
 Check out Blinux Project: * address@hidden * with subject line: subscribe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]