you'd might review this code, I think that would be a match.
// See
https://aka.ms/new-console-template for more information
using OPTANO.Modeling.Optimization;
using OPTANO.Modeling.Optimization.Configuration;
// all modeling config and scope just to have manuel variable names
var config = new Configuration();
config.NameHandling = NameHandlingStyle.Manual;
using (var scope = new ModelScope(config))
{
// create two variables
var x = new Variable("x", 0, 100, OPTANO.Modeling.Optimization.Enums.VariableType.Integer);
var y = new Variable("y", 0, 100);
// create some expressions (might be part of constraints if a solver is used)
var myExpressions = new Expression[]
{
2 * x + y,
0 * x + 100 * y,
x * -1 - 15 * y
};
// this is the same format, a Solver.Solve().VariableValues would give
var resultsFromSolver = new Dictionary<string, double>();
resultsFromSolver.Add(x.Name, 100);
resultsFromSolver.Add(y.Name, 10);
// evaluate each expression with the variable values provided and return a tuple with expression and value, then order by value ascending
var prioList = myExpressions.Select(e =>
new { Expression = e, Value = e.Evaluate(resultsFromSolver) }).OrderBy(e => e.Value);
// print the results
foreach (var prioItem in prioList)
{
Console.WriteLine($"{prioItem.Expression}: {prioItem.Value}");
}
}