Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with optimizing constraints and subsets #45

Closed
kai-qu opened this issue Jan 13, 2018 · 1 comment
Closed

Problems with optimizing constraints and subsets #45

kai-qu opened this issue Jan 13, 2018 · 1 comment

Comments

@kai-qu
Copy link
Contributor

kai-qu commented Jan 13, 2018

The system seems to have problems optimizing certain constraints. Running the following command has several problems. ./Main snap sub/twosets.sub sty/venn_comp.sty

  • constraint contains(y, x) does not work well in two scenarios: 1. with any objective on the labels, or 2. if the constraint on containment starts off violated.
  • In principle, the exterior point method requires constraints to be violated in the initial state (that is, the "point" lies in the exterior). Setting constraintFlag = True means that the Subset constraint is initially satisfied, which defeats the purpose. Even if the flag is false, the system does not guarantee that at least one constraint is violated, as the rng seed might be set such that the constraints happen to be satisfied.
  • For some reason, if the x and y coordinates of the two sets are set to varying, then they are NaNing after one step. Only those coordinates NaN out first; the radii are fine. If the x and y coordinates are set to fixed, then there aren't problems.
  • A lot of things could possibly be causing this problem. Autodiff? Initial changes made to implement the computational graph? The objective function strictSubset being written incorrectly? (Seems to work though.) A problem with circle packing and unpacking?

Temporarily resolved. To fully resolve:

  • If I square both sides, will strictSubset still work as a valid penalty?
  • Check if state starts in the exterior now
  • Why did distance work sometimes originally?
  • Document the solution with avoiding divide by zero
  • Why is the optimization so slow? Might have to do with starting in exterior vs. interior
  • Test the full subset program
  • Regression-test the existing programs that might have NaNs
  • Add test suite

screenshot 2018-01-12 19 55 23

@kai-qu kai-qu self-assigned this Jan 13, 2018
kai-qu pushed a commit that referenced this issue Jan 15, 2018
…divide by zero in the derivative for distance, not distance squared). Add RealFrac to typeclass list to catch NaNs
kai-qu pushed a commit that referenced this issue Jan 15, 2018
@kai-qu
Copy link
Contributor Author

kai-qu commented Jan 15, 2018

Resolved. Also works for tree.sub with venn.sty.

  • Should deal with tangency, as due to how EP works, the state will stop as it reaches just inside the interior region.
  • Use isNan in the future to catch NaNs.
  • In the future, watch out for divide-by-zeros (derivatives with variable denominators) and add epsilon strategically, or avoid those kinds of functions.

screenshot 2018-01-15 16 22 23

screenshot 2018-01-15 16 25 58

@kai-qu kai-qu closed this as completed Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant