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

How do we define an "objective function" and maximize or minimize it? #176

Open
trusktr opened this issue Jan 26, 2024 · 1 comment
Open

Comments

@trusktr
Copy link

trusktr commented Jan 26, 2024

I have a feeling this concept is implicit in the usage of Kiwi, but I'm new to this stuff, and wondering if you can help point it out, if in fact the API allows it.

I read the Cassowary paper (API very similar to Kiwi's),

https://cassowary.readthedocs.io/_/downloads/en/latest/pdf/

and it mentions that it is great for solving objective function min/maximization problems, however after that brief mention at the top of the doc, it no longer mentions "objective function" anywhere else.

Where exactly in that doc is the "objective function", and is it being minimized or maximized?

(I'm trying to figure it out for use in the TypeScript fork of kiwi, and I'd like to document these concepts more clearly if in fact they are doable).


In Google OR-Tools, there's actually an API for explicitly defining objective functions, with "objective" in the API naming:

https://developers.google.com/optimization/lp/lp_example#define_the_objective_function

// Maximize 3 * x + 4 * y.
MPObjective objective = solver.objective();
objective.setCoefficient(x, 3);
objective.setCoefficient(y, 4);
objective.setMaximization();
@trusktr trusktr changed the title How to we define an "objective function" and maximize or minimize it? How do we define an "objective function" and maximize or minimize it? Jan 26, 2024
@MatthieuDartiailh
Copy link
Member

Indeed in kiwi one cannot directly access the objective function. Kiwi attempts to satisfy all constraints and minimize the deviation for constraints with a non-required strength.

I am not sure how best to help you however. @sccolbert may have a clearer image of kiwi inner working than I do though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants