Giter Club home page Giter Club logo

gelpia's People

Contributors

ianbriggs avatar keram88 avatar wfchiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gelpia's Issues

Gelpia is not returning variables in the order declared

At least for dop.
goldstein_price.dop:

var:
[-2, 2] x1;
[-2, 2] x2;

cost:
-(1 + (x1 + x2 + 1)^2 * (19 - 14*x1 + 3*x1^2 - 14*x2 + 6*x1*x2 + 3*x2^2)) * (30 + (2*x1 - 3*x2)^2 * (18 - 32*x1 + 12*x1^2 + 48*x2 - 36*x1*x2 + 27*x2^2));

Gelpia returns:
[[-3.000000010951467, -2.324965035674893], {'x2': [-1.001708984375, -1.0009765625], 'x1': [0.0009765625, 0.001953125]}]

This is a front end issue. I would prefer that the order of returned variables match the order of declaration.

Named constants (pi)

Common mathematical constants should be supported in .dop files. The most important constant is pi. Internally, the best possible interval approximation should be used.

A simple test with "pi" fails

Code:

var:
[0,0] x;

cost:
pi * 2;

Result:

bin/dop_gelpia benchmarks/tests/pi.dop
ERROR:  An Error has occured
ERROR:  Return code: 101
ERROR:  Command used: ['/home/alexey/Work/Projects/gelpia/target/release/cooperative', '-c', '[0]|(pi*[2])', '-f', 'c1', '-i', '', '-x', '0.\
001', '-y', '0.001', '-r', '0', '-S', 'generated_93d011a102a0', '-n', '', '-t', '0', '-u', '0', '-M', '0', '--seed', '0', '', '']
ERROR:  Unable to run given executable, does it exist?
ERROR:  executable: ['/home/alexey/Work/Projects/gelpia/target/release/cooperative', '-c', '[0]|(pi*[2])', '-f', 'c1', '-i', '', '-x', '0.00\
1', '-y', '0.001', '-r', '0', '-S', 'generated_93d011a102a0', '-n', '', '-t', '0', '-u', '0', '-M', '0', '--seed', '0', '', '']

Can't terminate update thread

The update thread in the cooperative solver will most likely never see the termination signal as it will be waiting at one of the two barriers. Find a way to cleanly halt the thread.

Hyperbolic functions in constant lifting

The functions cosh, sinh and cosh in the constant lifting pass will use Gaol's built in implementations. During constant lifting, any expression using these functions cannot be considered "constant" even if their argument is constant.

NaN result in a simple test

Test code:

var:  
[7.84, 8] x1;

cost:
sqrt(x1) * 1;

Result:

bin/dop_gelpia benchmarks/tests/sqrt.dop
[[2.82842712474619,NaN], {'x1' : [7.839999999999999, 8],}]

atan + sqrt bug

Code:

var:
[4.0, 6.3504] x1;
[4.0, 6.3504] x2;

cost:
atan(sqrt((x1 - 5) * (x2 - 5) * (x1 + x2 - x2 - 5) * (x2 - 5)));

Result:

bin/dop_gelpia benchmarks/tests/atan_bug.dop
[[1.536809325000001, 1.109576699561335], {'x2': [6.0566, 6.350400000000001], 'x1': [6.2035, 6.350400000000001]}]
Parsing time: 0.0034666061401367188
Solver time: 0.10190701484680176

The result should be a valid interval (lower_bound <= upper_bound) which is not true for this example: 1.5368... > 1.1095...

It seems that the lower bound is computed for atan(x) where x is a large number (because atan(+infinity) = pi / 2 = 1.57...)

Duplicate variable declarations allowed

This one picks up the second declaration:
$gelpia -i "{'x' : (0,1), 'x' : (0,2), 'y' : (0,1)}" -f "(x*y*[-10,1])"
[[2, 2], {'x': [0, 2], 'y': [0, 1]}]

This happens in dop as well:
var:
[0,1] x;
[0,2] x;
[0,1] y;

cost:
x*y;

I'll fix the first (that's my parser), Ian can fix the second. Such queries should not be allowed.

Invalid intervals are allowed

$ gelpia -i "{y:[0,-1]}" -f "(y)"

[[0,0], {'y' : [empty],}]

And in dop_gelpia:

var:
  [0,-1] y;

cost:
  y;

[[0,0], {'y' : [empty],}]

Unary minus parsing problem

The following problem is not parsed correctly:

var:
[-10, 10] x;

cost:
-x^2;

The correct parsing should be -(x^2) but it is parsed as (-x)^2.

GAOL formula constructor

Some inputs cause the formula constructor to crash, e.g.,
gaol::interval y("sqrt((sqrt(pow(2.0, 2)) + sqrt(pow(tan(cos(([3.0, 4.0] + sqrt(pow([0.5, 1.0], 2))))), 2))))");
Whereas the computation succeeds when computed outside the string constructor. We'll need to utilize other parts of the program to handle computed constants.

Finish the nitty-gritties

A map for the dark, deep mines within Gelpia. Adventurous users will want to avoid the Balrog at any cost!

Installation fails with Rust error messages

Hi,

I am trying to install Gelpia as part of FPTuner from the branch ArtifactEvaluation. make requirements successfully installs Rust, CRilbm and GAOL, but make fails with Rust error messages:

error: the struct `#[repr(align(u16))]` attribute is experimental (see issue #33626)
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/unicode-width-0.1.12/src/tables.rs:569:5
    |
569 |     #[repr(align(128))]
    |     ^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(repr_align)] to the crate attributes to enable

error: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/unicode-width-0.1.12/src/tables.rs:569:5
    |
569 |     #[repr(align(128))]
    |     ^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(attr_literals)] to the crate attributes to enable

error: aborting due to 2 previous errors
make: *** [Makefile:9: all] Error 101

I've also tried different versions of Rust, the one from develop branch (1.37.0 stable) fails with this message:

error[E0554]: #![feature] may not be used on the stable release channel
  --> /root/.cargo/git/checkouts/simd-a428b8cc9c1d1986/0d85d25/src/lib.rs:19:1
   |
19 | #![feature(cfg_target_feature, repr_simd, platform_intrinsics, const_fn)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unrecognized platform-specific intrinsic function: `x86_mm_movemask_ps`
  --> /root/.cargo/git/checkouts/simd-a428b8cc9c1d1986/0d85d25/src/x86/sse2.rs:10:5
   |
10 |     fn x86_mm_movemask_ps(x: f32x4) -> i32;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
< more of the same messages here >
error: unrecognized platform-specific intrinsic function: `x86_mm_subs_epu16`
  --> /root/.cargo/git/checkouts/simd-a428b8cc9c1d1986/0d85d25/src/x86/sse2.rs:45:5
   |
45 |     fn x86_mm_subs_epu16(x: u16x8, y: u16x8) -> u16x8;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 34 previous errors

For more information about this error, try `rustc --explain E0554`.
make: *** [Makefile:27: src/func/comp_comm.sh] Error 101

so I tried a nightly build from around the same date as this version was released (rustc 1.37.0-nightly (8ebd67e4e 2019-06-27)) but still got the same errors error: unrecognized platform-specific intrinsic function:...

Newest versions 1.79.0, 1.77.0 and the ones released around the same time with AE branch 1.20.0, 1.21.0, 1.22.0 also fail, all with various error messages.

Then I cloned the develop branch and tried to install it, here it fails with

mkdir bin
    Updating crates.io index
  Downloaded num-traits v0.2.19
error: failed to parse manifest at `/root/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.19/Cargo.toml`

Caused by:
  failed to parse the `edition` key

Caused by:
  supported edition values are `2015` or `2018`, but `2021` is unknown
make: *** [Makefile:24: src/func/comp_comm.sh] Error 101

Please help :) Is there a Rust version for which ArtifactEvaluation branch compiles? Can you reproduce the problem?

I am installing everything inside a VM running Debian GNU/Linux 12 (bookworm) with the following specs:

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 45 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: AuthenticAMD
BIOS Vendor ID: AuthenticAMD
Model name: AMD EPYC 7662 64-Core Processor
BIOS Model name: AMD EPYC 7662 64-Core Processor CPU @ 1.9GHz

FPTaylor abs_err

FPTaylor has a function, abs_err, which gelpia does not.
Implementation is trivial, but we should still add it.

Build problem

A collaborator tried to build Gelpia and he run into the following build error:

   Compiling getopts v0.2.18
error[E0301]: cannot mutably borrow in a pattern guard
    --> 
/home/volodya/.cargo/registry/src/github.com-1ecc6299db9ec823/getopts-0.2.18/src/lib.rs:407:73
     |
407 |                         } else if was_long || name_pos < names.len() 
|| args.peek().map_or(true, |n| is_arg(&n)) {
     | 
^^^^ borrowed mutably in pattern guard

error: aborting due to previous error

Build failed, waiting for other jobs to finish...
error: Could not compile `getopts`.

Could someone help us out to get to the bottom of this?

Exceptional float values

Currently gelpia will crash if nan or inf are used.
They are recognized as variable names leading to an invalid parse.

What should we do with these inputs?

It might be reasonable to accept infinite numbers.

Nan, on the other hand, I think should be treated as improper input and a descriptive error returned.

Inverse trigonometric functions

I would like to be able to use inverse trigonometric functions in .dop files. The following functions are requested:
arcsin
arccos
arctan
Alternative names for these functions should also be available: asin, acos, atan

Unused variables

We currently use all given input variables whether or not they appear in the cost function. This causes wasted search time.

The query

var:
[4.0, 6.3504] x1;
[4.0, 6.3504] x2;
[4.0, 6.3504] x3;
[-40000, 40000] unused;

cost:
atan(x2*x3 / sqrt(4 * x1));

Runs giving

./bin/dop_gelpia unused.dop
[[1.4719316334589239, 1.471931994344534], {'unused': [-0.125, 2.225073858507202e-308], 'x3': [6.2035, 6.350400000000001], 'x2': [6.2035, 6.350400000000001], 'x1': [4, 4.073450000000001]}]
Parsing time: 0.0024487972259521484
Solver time: 10.822314977645874

If the unused variable is removed it runs giving

./bin/dop_gelpia used.dop
[[1.4710343816861349, 1.471931994344534], {'x2': [6.2035, 6.350400000000001], 'x3': [6.2035, 6.350400000000001], 'x1': [4, 4.073450000000001]}]
Parsing time: 0.0023336410522460938
Solver time: 0.10143351554870605

Installation takes up >40G

Is this normal that the installation of Gelpia takes up more than 40G?
I checked that the directory src/func/target/release/deps alone needs 44G. It has a bunch of files called 'func_generated_*.d' (the last part of the name varies). Is it safe to remove them after the installation is successfully finished?

Constant consolidation

When using GAOL, abs should only be converted to sqrt(sqr(x)) inside a constant expression. We should not be converting inside the function expression.

Compilation problems with `make requirements` dependencies

I get compilation when executing make after having installed the dependencies with make requirements.

I have created this Docker container for installing gelpia:

FROM ubuntu:16.04
LABEL version="0.0"

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -yq --no-install-recommends \
    ca-certificates                             \
    git                                         \
    make                                        \
    gcc                                         \
    g++                                         \
    flex                                        \
    bison                                       \
    wget                                        \
    python3                                     \
    python3-ply                                 \
    patch                                      

RUN git clone  https://github.com/soarlab/gelpia.git /gelpia

WORKDIR /gelpia
RUN make requirements

If you run the container and execute make inside the /gelpia folder I get this error while the getopts Rust library is being compiled:

   Compiling getopts v0.2.18
error[E0301]: cannot mutably borrow in a pattern guard
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/getopts-0.2.18/src/lib.rs:407:73
    |
407 |                         } else if was_long || name_pos < names.len() || args.peek().map_or(true, |n| is_arg(&n)) {
    |                                                                         ^^^^ borrowed mutably in pattern guard

error: aborting due to previous error

It seems that the Rust version that is being installed does not support the feature that this code is using. I have rewritten that code in a custom getopts repository and updated the Cargo.toml file in my repository https://github.com/mfeliu/gelpia.git to use it instead of the official one. If you create the container using my repository, make succeeds.

I have also try to change the version numbers of the dependencies but when getopts gets fixed, something else breaks.

I hope that you can provide a better fix.

Additionally, I think that including a Dockerfile for automating the installation would help new people.

Thanks.

Invalid syntax error while using Gelpia for the first time

I get a invalid syntax error using gelpia for the first time after installation.

  • I installed Gelpia for using "make requirements" and then "make".
  • Afterwards I ran this command: "./bin/gelpia --function "x=[1,10]; y=[5,15]; x^2 + x*y" " and I got an exception that the "sly" module was not installed.
  • Then I installed "sly" and after that I got the "SyntaxError: invalid syntax" error.

Here is the log:

./bin/gelpia --function "x=[1,10]; y=[5,15]; x^2 + x*y"
Traceback (most recent call last):
File "gelpia/gelpia/bin/function_to_lexed.py", line 16, in
from sly import Lexer
File ".local/lib/python3.5/site-packages/sly/init.py", line 2, in
from .lex import *
File "/.local/lib/python3.5/site-packages/sly/lex.py", line 78
return f'Token(type={self.type!r}, value={self.value!r}, lineno={self.lineno}, index={self.index})'
^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./bin/gelpia", line 7, in
from process_function import process_function
File "gelpia/gelpia/bin/process_function.py", line 6, in
from pass_utils import extract_exp_from_diff
File "gelpia/gelpia/bin/pass_utils.py", line 5, in
import function_to_lexed
File "gelpia/gelpia/bin/function_to_lexed.py", line 17, in
except ModuleNotFoundError:
NameError: name 'ModuleNotFoundError' is not defined

Generated function files are not always cleaned up

For each query we generate a rust file that get compiled into a file in src/func/target/release/deps that matches the name 'func_generated_*.d'

We try to clean these files up in lines 152 to 163 in src/frontend/gelpia.py but this seems to not always run.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.