I want to use Shannon Capacity forumula as one of my constraint in the minimization problem. I am not sure how can I use it as AMPL doesnot support log2.
In simple form its here as: C = B * log2(1+ S/N)
Please guide.
As we know log2(x)=ln(x)/log(2)
We can apply in APML as AMPL supports natural logrithm.
Also you can use extended function libraries provided for AMPL at https://ampl.com/resources/extended-function-library/ by loading this package you can use log(x) as well :
gsl_sf_log(x)
Related
In this answer
#techwinder used in his-own code functions:
matMult() with 6 args where are this function from?
Also where I could find functions: invert33(), invert44(), inverseMatrixLapack(), and matMult(), which are used in #techwinder code?
Note: I think you should have asked himself :) maybe this will be closed or moved to stackoverflow...
Just to shed some light on the subject,
he mentions lapack, in the code.
You can find out how to compute the inverse matrix with lapack here, and matrix-matrix multiplication can be computed with dgemm
He has some specialized code for small matrix, but that is not necessary if you want a simple solution.
I'm relatively new in Pyomo and Gurobi. I'm trying to solve a Non-Convex quadratic programming but the solver output give me the following issue:
"gurobipy.GurobiError: Quadratic equality constraints are non-convex. Set NonConvex parameter to 2 to solve model."
So, I'm trying to modify the solver parameter in order to obtain the correct result.
p.s. I'm already tryed to install gurobipy but the package manager Pip give me: "Could not find a version that satisfies the requirement gurobipy (from versions: )
No matching distribution found for gurobipy"
Tanks a lot for your time and consideration!
This page explains how to set parameters in Pyomo: https://pyomo.readthedocs.io/en/stable/working_models.html#sending-options-to-the-solver
optimizer.options["NonConvex"] = 2
or
results = optimizer.solve(instance, options="NonConvex=2")
I would like to know how to use
SummarySaver
monitor with contrib.learn.estimator
I understand and used ValidationMonitor but I am struggling on
Understanding the use case for SummarySaver
Using it in conjunction with contrib.learn.estimator
As an aside, what is the best practice to add summaries that are not metrics defined in ValidationMonitor ?
SummarySaver is for writing summary out every n steps
manual summary can be most easily done by using tf.scalar_summary
I use already the fonction CGAL::centroid for Polygon_2. It works well :
return CGAL::centroid(vertices_begin (), vertices_end(),CGAL::Dimension_tag<0>());
When I'm trying to use the function in Polyhedron_3, it does not works.
CGAL::centroid shows only 3 possibles signatures returning 2D returns only.
Have you an example for using 3D centroid ?
Many thanks for help.
Gilles
Use points_begin(), points_end() instead.
In the CGAL::Polygon the "vertices" are points, in the Polyhedron_3 they are Vertex_handles. You could use a boost::transform_iterator to obtain a sequence of points.
Here you can see how I did this for CGAL::Surface_mesh
I was wondering if anyone who has used the Optimization Library in Dymola has been able to utilize the RealtimeOptimization function without having explicit plant constitutive equations to input into the criteriaFunction? Specifically, I am trying to use some of my model's states as the criteria function, but when I input y[1] := mymodel.state; with or without quotes around the state, Dymola rejects the function. Any thoughts would be very helpful. Thank you.
It is not possible to have access to model variables inside a function. You have to provide the values of the variables through the inputs to the function. The task RealtimeOptimization is aimed to be called during the simulation of a Modelica model. The criteria function has the defined inputs nTuners, nCriteria, tuners[nTuners]. You can add additional input variables, see the Example Optimization.Tasks.RealtimeOptimization.Examples.Example02.RunSampled and the record UserData in the function Optimization.Tasks.RealtimeOptimization.Examples.Example02.criteriaFunc02. By these additional variables you could transfer some state variables into the critiera function.
Maybe we can assist you, if you provide more information about your setting. I am the main developer of the Optimization library in Dymola.
You could try adding outputs (Modelica.Blocks.Interfaces.RealOutputs) to the top level of the model and then linking these to the states by using Modelica.Blocks.Sources.RealExpression blocks.
Then when using the optimisation function goto the criteria page and use the Select button and select these outputs to add them as criteria.