eplex cost expression simplification

From: Stefano Novello <stefano.novello_at_parc-technologies.com>
Date: Thu 18 Apr 2002 02:43:19 PM GMT
Message-ID: <0B9686DD2E83D411B67200508B9A9DA2459EAE@LON-SRV2>
Here is some test code, the first lp_probe call gets the wrong cost,
the second gets the right cost. It seems the problem relates to
repeated variables in the optimsation expression in lp_probe.

:- lib(eplex).

test :-
        [X,Y,Z]:: 0.0 .. 1.0,
        sum([X,Y,Z]) $= 2.0,
        collect_lp_constraints_norm(Norm),
        lp_setup(Norm, max(sum([X,Y])), [], H),

        lp_probe(H,max( sum([X,Y,Z]) + sum([X]) - sum([Y,Z]) ), Cost),
        lp_var_get(X,solution,VX),
        lp_var_get(Y,solution,VY),
        lp_var_get(Z,solution,VZ),
        RealCost is sum([VX,VY,VZ]) + sum([VX]) - sum([VY,VZ]),
        printf("x = %mw, y = %mw z = %mw cost = %w, realcost =
%w\n",[X,Y,Z,Cost,RealCost]),

        % same expr simplified
        lp_probe(H,max( 2 * sum([X])  ), Cost1),
        printf("x = %mw, y = %mw z = %mw cost = %w\n",[X,Y,Z,Cost1]),
        true.

I tried this only on solaris with cplex.
ECLiPSe Constraint Logic Programming System [kernel]
Copyright Imperial College London and ICL
Certain libraries copyright Parc Technologies Ltd
GMP library copyright Free Software Foundation
Version 5.3 #41, Sat Nov 24 13:49 2001
[eclipse 1]: 

2nd Floor The Tower Building	EMAIL: Stefano.Novello@parc-technologies.com
11 York Road                      TEL: +44 (0)20 72614068
SE1 7NX LONDON                    

This e-mail message is for the sole use of the intended recipient(s) - its
contents are the property of Parc Technologies Limited (or its licensors)
and are confidential. Please do not copy, review, use (except for the
intended purposes), disclose or distribute the e-mail or its contents or
allow anyone else to do so without our prior permission. 
Parc Technologies Limited does not guarantee that this e-mail has not been
intercepted and amended nor that it is virus-free. You should carry out your
own virus checks before opening any attachment. Any opinions expressed in
this e-mail message are those of the author and not necessarily Parc
Technologies Limited.

 
Received on Thu Apr 18 15:42:15 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:15 PM GMT GMT