knotR (version 1.0-2)

knotoptim: Optimization of knot appearance

Description

Optimization of knot appearance using user-definable objective functions

Usage

knotoptim(svg, weights=1, symobj=NULL,
  Mver = NULL, xver = NULL, Mhor = NULL, xhor = NULL, Mrot = NULL,
  mcdonalds = FALSE, celtic = FALSE, ou, prob = 0, useNLM=TRUE, ...)

Value

Returns a knot object

Arguments

svg

Name of an svg file to read

Mver,xver,Mhor,xhor,Mrot,mcdonalds,celtic

Arguments passed to symmetry_object(), specifying the symmetry of the knot

symobj

A symmetry object

ou

An overunder object

prob

The probability of plotting a knotplot; this is slow so don't make this too big

weights

A vector of weights, defaulting to all ones, passed to badness()

useNLM

Boolean, with default TRUE meaning to use nlm() and FALSE meaning to use optim()

...

Further arguments passed to nlm()

Author

Robin K. S. Hankin

Details

Function knotoptim() is a generic optimization routine that starts from an svg file and minimizes the knot's badness.

See Also

symmetry_object, badness

Examples

Run this code

if (FALSE)     #takes too long
knotoptim(
      svg = system.file("4_1_first_draft.svg",package="knotR"),
     Mver = rbind(c(2,3),c(9,7),c(10,6),c(1,4),c(5,11)),
     xver = 8,   # node on vertical axis
     ou   = rbind( c(1,5), c(9,2), c(4,8),c(6,11)),
     prob = 0.1,
  iterlim = 100, print.level=2)

Run the code above in your browser using DataLab