Multidimensional Variable Optimization: Exploring Optaplanner

154 views
Skip to first unread message

A.S.Shoukat Ghouse

unread,
Dec 17, 2015, 6:39:58 AM12/17/15
to OptaPlanner development
Hi,
I have been tasked to explore open source Optimization APIs. 
I am exploring Opta Planner but i have not found any practical example solving the below kind of problem.I have explored JOM ( Java Optimization Modeler) but have to give up due to lack of documentation and proper examples and support communities.
Trying to explore Opta Planner. Any inputs will be appreciated. Thanks in advance.
 
I have to solve the below objective function. Is this kind of multidimensional optimization possible in Opta Planner. Any examples i can refer to in the documentation >



Fj

Value (Fj)

pj

Value (pj)

F1

2400

p1

0.0003

F2

2500

p2

0.0022

F3

1500

p3

0.0129

 

 

Correctors-

 

 

 

Fj

Ci

Value (Ci)

F1

F2

F3

C1

1600

0.6

0

0

C2

1500

0.65

0.65

0

C3

1500

1

1

1

C4

2000

1

0

1

C5

1500

0

0.6

0

Green color denotes:

w_ij

 

Unknown xij, to be solved through optimization:

F1

F2

F3

C1

x11

x12

x13

C2

x21

x22

x23

C3

x31

x32

x33

C4

x41

x42

x43

C5

x51

x52

x53



Geoffrey De Smet

unread,
Dec 17, 2015, 7:29:47 AM12/17/15
to optapla...@googlegroups.com



With kind regards,
Geoffrey De Smet

On 17/12/15 12:39, A.S.Shoukat Ghouse wrote:
Hi,
I have been tasked to explore open source Optimization APIs. 
I am exploring Opta Planner but i have not found any practical example solving the below kind of problem.I have explored JOM ( Java Optimization Modeler) but have to give up due to lack of documentation and proper examples and support communities.
Trying to explore Opta Planner. Any inputs will be appreciated. Thanks in advance.
 
I have to solve the below objective function. Is this kind of multidimensional optimization possible in Opta Planner. Any examples i can refer to in the documentation >

You might find this one interesting:
  https://www.youtube.com/watch?v=NdyIf0JG94Y
This is an abstract, mathematical formulation of an optimization problem.
Other solvers might require this, but the advantage of OptaPlanner is you can use a rich, type-safe, object orientated domain model.
So, I'd start by asking yourself:
  What is F? Is it a Vehicle? Or an Employee? Or a Room? Or a Timeslot?
  What is C? ...
And use that define a type safe domain model.

With the old names, the domain could look something like this:

class C {...}

class F {...}

@PlanningEntity class CellAssignment() {
    C c;
    F f;
    @PlanningVariable(...) BigDecimal value;

}

Unknown xij, to be solved through optimization:


F1

F2

F3

C1

x11

x12

x13

C2

x21

x22

x23

C3

x31

x32

x33

C4

x41

x42

x43

C5

x51

x52

x53



--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.
To post to this group, send email to optapla...@googlegroups.com.
Visit this group at https://groups.google.com/group/optaplanner-dev.
For more options, visit https://groups.google.com/d/optout.

A.S.Shoukat Ghouse

unread,
Dec 17, 2015, 6:34:44 PM12/17/15
to OptaPlanner development
Hi Geoffrey,
Thanks much. I will refer to the example you mentioned. My problem is similar to the video link you posted.
F in my problem stands for Facilities ( Loan Types) and C is the Collateral Amount alocated against each facility.
I need to find the optimal Collateral Allocation such that the bank loss ( calculated as per the Objective function) is minimum.

Is there any code walkthrough/tutorial for the investment portfolio example?

Thanks,
Shoukat
...

Geoffrey De Smet

unread,
Dec 18, 2015, 3:33:21 AM12/18/15
to optapla...@googlegroups.com

On 18/12/15 00:34, A.S.Shoukat Ghouse wrote:
Hi Geoffrey,
Thanks much. I will refer to the example you mentioned. My problem is similar to the video link you posted.
F in my problem stands for Facilities ( Loan Types) and C is the Collateral Amount alocated against each facility.
I need to find the optimal Collateral Allocation such that the bank loss ( calculated as per the Objective function) is minimum.
Ah, that use case is familiar. I've dealt with it before for a customer (nothing publicly though).

Is there any code walkthrough/tutorial for the investment portfolio example?
No, but start with the Quick Start chapter, which is a tutorial for the Cloud Balance example.
When you understand the basic concepts, reading the other examples's source code becomes much easier.

http://docs.jboss.org/optaplanner/release/latest/optaplanner-docs/html_single/index.html

Some tips:

1) Also read docs chapter 4.3.5.2.4. ValueRangeFactory
because for financial optimization your value ranges that represent an amount can't be a Collection
or you'll get an out of memory exception.

2) Currently, for financial optimization you'll need to add a custom move
(in future versions we'll add generic moves that can deal well with amounts).
The investment portfolio examples also uses custom moves.


With kind regards,
Geoffrey De Smet


--

A.S.Shoukat Ghouse

unread,
Dec 18, 2015, 6:39:40 AM12/18/15
to OptaPlanner development
Thanks so much for the tips Geoffrey.
I will let you know how it goes.

Thanks,
Shoukat

On Thursday, December 17, 2015 at 7:39:58 PM UTC+8, A.S.Shoukat Ghouse wrote:
...

A.S.Shoukat Ghouse

unread,
Dec 21, 2015, 3:55:36 AM12/21/15
to OptaPlanner development
Hi Geoffrey,
I am kind of stuck using the OptaPlanner. 
I refer to the Investment Allocation example and compare it to the Cloud Balance example-  

1. In the Investment Allocation example, i do not see where solver.solve(unsolvedAllocation...) method is called and also do not see where and how the unsolved investment is created.

2. Also i see that in this example has only 1 dimensional variable "Quantity" while In my problem i have three variable like Quantity1, Quantity2 and Quantity3 to be spread across multiple investments. To solve my problem using OptaPlanner is possible? Any hints on this.


Regards.

On Thursday, December 17, 2015 at 7:39:58 PM UTC+8, A.S.Shoukat Ghouse wrote:
...

Geoffrey De Smet

unread,
Dec 21, 2015, 4:26:29 AM12/21/15
to optapla...@googlegroups.com

With kind regards,
Geoffrey De Smet

On 21/12/15 09:55, A.S.Shoukat Ghouse wrote:
Hi Geoffrey,
I am kind of stuck using the OptaPlanner. 
I refer to the Investment Allocation example and compare it to the Cloud Balance example-  

1. In the Investment Allocation example, i do not see where solver.solve(unsolvedAllocation...) method is called and also do not see where and how the unsolved investment is created.
See the Investment*Importer class in the example. That class reads an Excel spreadsheet to create the unsolved investment.



2. Also i see that in this example has only 1 dimensional variable "Quantity" while In my problem i have three variable like Quantity1, Quantity2 and Quantity3 to be spread across multiple investments. To solve my problem using OptaPlanner is possible? Any hints on this.

See proposed domain design in previous replies in this thread.

--

A.S.Shoukat Ghouse

unread,
Dec 21, 2015, 5:01:05 AM12/21/15
to OptaPlanner development
I understand that we always need to provide an abstract unsolved solution to the solver?
1. Is it possible to generate random solution and pass that as input to solve? I mean not create a random solution manually like in the cloud balance example.
2. Is it possible to import an unsolved solution from a xml file instead of xlsx?

Regards.

On Thursday, December 17, 2015 at 7:39:58 PM UTC+8, A.S.Shoukat Ghouse wrote:
...
Reply all
Reply to author
Forward
0 new messages