Files
orx/orx-gradient-descent
Edwin Jakobs b7ba6f6daa Feature variants (#376)
Migrate from buildSrc to build-logic. Setup feature variants.
2025-09-17 10:03:02 +02:00
..
2025-09-17 10:03:02 +02:00

orx-gradient-descent

Finds equation inputs that output a minimum value: easy to use gradient descent based minimizer.

Usage

// define a model
class Model {
    var x = 0.0
    var y = 0.0 
}

val model = Model()
minimizeModel(model) { m ->
    (m.x-4.0)*(m.x-4.0) + (m.y-3.0)*(m.y-3.0)
}

// model.x is close to 4 and model y is close to 3 at this point

Data binding

Currently we support minimizing model classes that contain Double, Vector2, Vector3 and Vector4 typed properties, other types are silently ignored.

An example of a supported model:

class Model {
    var x = 0.0
    var y = 0.0
    var v2 = Vector2.ZERO
}