GithubHelp home page GithubHelp logo

Adding stay with required strength about rhea HOT 6 CLOSED

nocte- avatar nocte- commented on July 30, 2024
Adding stay with required strength

from rhea.

Comments (6)

hfossli avatar hfossli commented on July 30, 2024

Test report

Running 39 test cases...
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:758: error in "required_strength_stay": check v.value() == 2 failed [0 != 2]
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:769: error in "required_strength_stay_and_constraint": check y.value() == 2 failed [0 != 2]
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:778: error in "required_strength_stay_and_constraint": check v.value() == 2 failed [0 != 2]
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:779: error in "required_strength_stay_and_constraint": check y.value() == 4 failed [2 != 4]

*** 4 failures detected in test suite "rhea"

from rhea.

Nocte- avatar Nocte- commented on July 30, 2024

'required' is a special value, the weight factor isn't meaningful here. (Now we know what happens when the immovable object meets the unstoppable force, it appears the stay constraint wins. ;) )

from rhea.

hfossli avatar hfossli commented on July 30, 2024

If I got you right you are saying that the weight factor is the problem. Removing that from the unit test still yields the same output/error.

BOOST_AUTO_TEST_CASE(required_strength_stay)
{
    variable v(0);
    simplex_solver solver;

    solver.add_stay(v, strength::required());

    BOOST_CHECK_EQUAL(v.value(), 0);

    solver.add_edit_var(v);
    solver.begin_edit();
    solver.suggest_value(v, 2);
    solver.end_edit();

    BOOST_CHECK_EQUAL(v.value(), 2);
}

Result

 error in "required_strength_stay": check v.value() == 2 failed [0 != 2]

from rhea.

Nocte- avatar Nocte- commented on July 30, 2024

The value remains 0 because the edit constraint is weaker than the stay constraint in this case. (Stays are weak and edits are strong by default.)

from rhea.

hfossli avatar hfossli commented on July 30, 2024

Aha. It's details like this that would be awesome to have documented.

This is quite good, but it too short IMO http://cassowary.readthedocs.org/en/latest/

from rhea.

Nocte- avatar Nocte- commented on July 30, 2024

For some reason, people started starring this project left and right in the past couple of days. Maybe this is a good time to get some documentation going. ;)

That Python implementation you linked to explains the concepts of Cassowary very well, that's definitely a good basis.

from rhea.

Related Issues (20)

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.