1

According to the SCIP Optimization Suite 8.0 manual, SCIP contains an expression handler for the entropy function. I want to use it for the objective of my optimization program, but I don't understand how to access it in the SCIP program, e.g. using the ZIMPL language -- or alternatively using PySCIPOpt.

I understand that there is an entry in the SCIP reference, but it only describes the C++ interface.

Consider for example the objective function h=∑n=1N -pn log(pn) with N=4. In ZIMPL, I would start the problem with

param N := 4;
set Nset := {1 .. N};
var p[Nset] >=0 <=1;

maximize h: sum<n> in Nset: ???????;

What do I need to write instead of the question marks?

If I use PySCIPOpt instead, I would write

from pyscipopt import Model
N=4
model=Model('entropy')
p=[]
for n in range(N):
    p.append(model.addVar(lb=0.0, ub=1.0, name='p(%s)' % n))
model.setObjective(??????,sense='maximize')

What do I need to write instead of the question marks?

1 Answer 1

0

Supporting an expression means that SCIP can read such an expression and handle it internally, not that there is a special method that adds it to a model.

The problem with your code is that SCIP does not support nonlinear objective functions directly, so you would need to do an epigraph reformulation. If you're using PySCIPOpt, you can just do

from pyscipopt import Model, quicksum, log
from pyscipopt.recipes.nonlinear import set_nonlinear_objective

N=4
model=Model('entropy')
p=[]
for n in range(N):
    p.append(model.addVar(lb=0.0, ub=1.0, name='p(%s)' % n))
obj = quicksum(-p[n]*log(p[n]) for n in range(N))
set_nonlinear_objective(model, obj, sense="maximize")

model.optimize()

(Be mindful that you have a lower bound of 0 for the variables)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.